Black Art Of Java Game Programming:Introduction

3y ago
32 Views
3 Downloads
6.02 MB
983 Pages
Last View : 1m ago
Last Download : 3m ago
Upload by : Mika Lloyd
Transcription

Black Art of Java Game Programming:IntroductionBlack Art of Java Game Programmingby Joel FanSams, Macmillan Computer PublishingISBN: 1571690433 Pub Date: 11/01/96Table of ContentsIntroductionGaming on the Web is the next blockbuster business. Have any doubts? The video game industry,which already eclipses Hollywood in terms of revenue, targets the Web as the next huge growth area.Software developers are busily porting games to the online environment, or developing entirely newones. And numerous popular Web sites, many of which charge fees, are devoted to gameentertainment.With Black Art of Java Game Programming, you’ll learn how to create your own dynamic onlineentertainment using the Java programming language. Java heralds a revolutionary shift in gaming,away from the desktop and into the network. Using Java, you’ll create games that people candownload through the Web and play. Using Java, you’ll enable players from around the world tocompete against one another. As Java enters its maturity, the possibilities of creating innovativeentertainment are endless, and the potential for profit unbounded.This book provides you with the foundations for creating Java games of all types, such as boardgames, video games, and networked/multiplayer games. We recommend that you have some basicknowledge of C, C , or Java before diving in. The underlying thread of this book is that good objectoriented design and good Java games go hand in hand, so we devote the early chapters of the book tocovering and applying object-oriented principles to graphics and games. Once the foundations havebeen laid, we build a wide variety of games. As you will see, game programming is almost a game initself, and once you learn the basics, you’ll be well equipped to write innovative games on your own.OrganizationBlack Art of Java Game Programming is divided into three parts:Part I, Fundamentals of Java Game DevelopmentPart II, Advanced Game and Graphics TechniquesPart III, Game Galleryfile:///D Game%20Programming/index.html (1 von 3) [13.03.2002 13:17:32]

Black Art of Java Game Programming:IntroductionPart I, FundamentalsPart I takes you on a whirlwind tour of Java, graphics, and object-oriented game programming. Thissection is for you if you’re learning Java, if you’re new to object-oriented design, or if you want to seehow to build a game step by step.This is what’s covered in the Fundamentals section:Chapter 1, “Fundamental Java,” delivers a turbocharged introduction to the Java language, the API,and object-oriented design. By the end, you’ll create graphics applets.Chapter 2, “Using Objects for Animation,” shows you how classes, inheritance, and dynamic methodbinding help you animate objects. You’ll also learn about clipping and double-buffering, two basicgraphics techniques.Chapter 3, “Animating Sprites,” teaches you to create a simple abstract class for representing graphicsobjects called sprites. In addition, you’ll learn about interfaces, bitmap animation, and sound.Chapter 4, “Adding Interactivity,” shows you how to create applets that respond in real time to playerinput.Chapter 5, “Building a Video Game,” shows you how to apply what you’ve learned in the first fourchapters to create a shoot-’em-up video game. What you learn here can be applied to creating manyother types of games.Chapter 6, “Extending Your Video Game,” shows you how to take a game that you’ve developed andadd new features to it without starting from scratch.Chapter 7, “Creating Customizable Games with the AWT,” demonstrates how Java’s AbstractWindowing Toolkit allows players to change parameters in your games. What you learn here aboutthe AWT will be applied throughout the rest of the book.Part II, Advanced Game and Graphics TechniquesIn Part II, you’ll learn the skills necessary to bring your games into the next dimension, such asmultithreading, networking and multiplayer techniques, and 3D.Chapter 8, “Implementing a High Score Server on a Network,” takes you through Java’s networkingand GUI facilities, and teaches you to build a high score server for your games.Chapter 9, “Advanced Networking and Multiplayer Gaming Concepts,” illustrates techniques forenabling multiuser game play over the Web. In addition, you’ll deepen your understanding of Java’snetworking capabilities by implementing a chat room.file:///D Game%20Programming/index.html (2 von 3) [13.03.2002 13:17:32]

Black Art of Java Game Programming:IntroductionChapter 10, “Advanced Techniques,” covers features of Java and the Java API that are useful inwriting games and organizing programs.Chapter 11, “Into the Third Dimension,” demonstrates the process of defining, transforming,projecting, and painting three-dimensional models, and builds classes that can be used to make asimple 3D engine.Chapter 12, “Building 3D Applets with App3Dcore,” shows how the App3Dcore (a set of classes)works and how it can be used to develop some simple 3D applets and an advanced 3D game.Part III, Game GalleryIn Part III, you’ll apply the skills you’ve learned in earlier chapters as leading Java game designerstake you step by step through the creation of a wide spectrum of cool games.Chapter 13,“Building the JAVAroids Game,” shows you how to create a Java version of the videogame classic Asteroids.Chapter 14, “Daleks!,” takes you through the creation of an enhanced Java version of a classiccomputer game.Chapter 15, “NetOthello,” builds on your networking skills learned in earlier chapters to create anetworked implementation of the classic game Othello.Chapter 16, “WordQuest,” takes you through the creation of a Java game specifically designed toteach vocabulary, but which could easily be extended to teach a plethora of other concepts,demonstrating Java’s potential as a learning tool.Chapter 17, “The Magic Squares Puzzle,” is an example of a deceptively simple, yet challengingpuzzle game that will delight Rubik’s Cube enthusiasts (and many others).Chapter 18, “The Internet MahJong Server,” demonstrates a software package that allows people toplay the classic Chinese strategy game MahJong with each other online.Chapter 19, “Slider Puzzle,” shows you how to write a Java applet for a simple slider puzzle enhancedwith animation and sound.Chapter 20, “The Game of Worm,” develops a game in which you control the direction of a virtualworm on a rectangular playing surface, collecting treats while avoiding collision with solid objects.Table of Contentsfile:///D Game%20Programming/index.html (3 von 3) [13.03.2002 13:17:32]

Black Art of Java Game Programming:Table of ContentsBlack Art of Java Game Programmingby Joel FanSams, Macmillan Computer PublishingISBN: 1571690433 Pub Date: 11/01/96IntroductionWhat's on the CD-ROM?About the AuthorsPart I—Fundamentals of Java Game DevelopmentChapter 1—Fundamental JavaWhat Is Java?The World Wide WebWhat Is a Java Applet?Advantages to Writing Games in JavaOther BenefitsCurrent Limitations to Writing Games in JavaObject-Oriented FundamentalsThinking with States and BehaviorsDefining a ClassVariablesMethodsConstructorsCreating an ObjectAccessing Object Variables and MethodsInheritanceJava SummaryThe Java CorePrimitive Data TypesArraysClasses and ObjectsInstance, Static, and Final Variables and MethodsMemory ManagementPackagesOperatorsControl FlowThreadsExceptionsMajor Differences Between Java, C, and C The Java APIfile:///D me%20Programming/ewtoc.html (1 von 20) [13.03.2002 13:17:36]

Black Art of Java Game Programming:Table of peerjava.iojava.langjava.netjava.utilThe Java InterpreterThree Sample ApplicationsProgram 1: Your First Java ProgramProgram 2: Parameter PassingProgram 3: A Linked ListUnderstanding AppletsExecuting an AppletCreating GraphicsDrawingFillingColorA Graphics AppletThe Applet Life CycleSuggestion BoxSummaryChapter 2—Using Objects for AnimationWhat Is Animation?Creating Our First Animation AppletUsing the Universal Animation LoopTracing the Applet’s Execution PathImproving Animation QualityUnderstanding Animation FlickerUsing Double-Buffering to Eliminate FlickerUsing Clipping to Improve PerformanceAdding Complexity to Your AnimationUsing ObjectsDefining the ClassThe this KeywordUsing this in ConstructorsUsing the DancingRect ClassUsing InheritanceWhen to Use InheritanceWhen Not to Use Inheritancefile:///D me%20Programming/ewtoc.html (2 von 20) [13.03.2002 13:17:36]

Black Art of Java Game Programming:Table of ContentsInheritance DetailsThe Object ClassMethod OverridingThe super KeywordUsing super in ConstructorsFinal Classes and MethodsUsing Inheritance in Our Example AppletUsing Dynamic Method BindingPutting It TogetherSuggestion BoxSummaryChapter 3—Animating SpritesWhat Are Sprites?Sprite StatesSprite BehaviorsUsing Abstract ClassesDefining the Sprite ClassUsing Access SpecifiersPublic AccessPrivate AccessProtected AccessPackage/Default AccessAccessor MethodsApplying the Sprite Class to an Example AppletUsing InterfacesWhat Is an Interface?Java InterfacesMultiple InterfacesAbstract Classes vs. InterfacesCreating a Moveable InterfaceCreating an Applet with Bouncing SpritesUsing BitmapsBitmaps in JavaLoading and Drawing a Bitmap ImageSpecifying the Location of a Bitmap ImageCreating Bitmap SpritesUsing SoundLoading an AudioClipPlaying the SoundFour Rectangles and a Sushi ChefSuggestion Boxfile:///D me%20Programming/ewtoc.html (3 von 20) [13.03.2002 13:17:36]

Black Art of Java Game Programming:Table of ContentsSummaryChapter 4—Adding InteractivityHow Input Devices WorkWhat Is an Event?Mouse EventsKeyboard EventsThe Event ClassHandling Function KeysHandling Modifier KeysEvent Handling in the AWTOverview of Component classesHow the AWT Handles EventsDisplaying TextDefining StringsChoosing FontsDrawing StringsInserting a Text String into an AppletClicking and Dragging SpritesCreating Bitmap LoopsUsing MediaTrackerDefining the BitmapLoop ClassAn Interactive Applet Using BitmapLoop SpritesSuggestion BoxSummaryChapter 5—Building a Video GameOverview of the Alien Landing GameThe Video Game LoopDividing Responsibility Among Functional UnitsThe GunManager UnitThe UFOManager UnitThe GameManager UnitInterplay Among the Functional UnitsDefining the GunManagerGunSpriteThe BitmapSprite ClassThe Moveable InterfaceThe Intersect InterfaceDetermining Intersections with Bounding BoxesImplementing GunSpriteMissileSpriteThe RectSprite Classfile:///D me%20Programming/ewtoc.html (4 von 20) [13.03.2002 13:17:36]

Black Art of Java Game Programming:Table of ContentsIncorporating the Intersect InterfaceImplementing MissileSpriteGunManagerComputing VariablesDefining the UFOManagerThe UFO ClassThe BitmapLoop Sprite ClassThe Four UFO Behavioral StatesTransitioning Between StatesImplementing the UFO Sprite ClassThe UFOManager ClassDefining the GameManagerTwo Responsibilities of the GameManager ClassPassing Mouse Input to the GunManagerImplementing the Video Game LoopImplementing the GameManager ClassSuggestion BoxSummaryChapter 6—Extending Your Video GameChanging the UFO AnimationsExtending the UFO ClassModifying GameManager and UFOManagerAdding Levels of DifficultyTracking Game StatusModifying GunManagerCreating an Opening and ClosingSource Code for Modified ClassesSuggestion BoxSummaryChapter 7—Creating Customizable Games with the AWTCreating Graphical Interfaces with the AWTOverview of the AWTCreating Graphical InterfacesHandling Action EventsDefining the Action Handler in the ContainerDefining the Action Handler in the ComponentUsing Components, LayoutManagers, and ContainersComponentsButtonsCheckboxesCheckbox Groupsfile:///D me%20Programming/ewtoc.html (5 von 20) [13.03.2002 13:17:36]

Black Art of Java Game Programming:Table of ContentsLabelsText utOther Layout ManagersContainersPanelsFramesDialogsCustomizing Alien LandingDefining the GameFrame ContainerCreating a Menu BarHandling Menu ActionsDefining the Customization DialogCustomized Source Code for GameManagerUsing Applet ParametersWhat Are Applet Parameters?Reading Applet ParametersQuick AWT ReferenceThe Component and Container ClassesComponentsContainersCursorsMenu, MenuBar, and MenuItemThe Event ClassSuggestion BoxSummaryPart II—Advanced Game and Graphics TechniquesChapter 8—Implementing a High Score Server on a NetworkWhy Use Java for Network Programming?What Is Client-Server Networking?Basic Client-Server TerminologySome Additional ConceptsException HandlingStreamsImplementing Our Client Server Game ModelImplementing Client FeaturesCreating the HighScoreManager Classfile:///D me%20Programming/ewtoc.html (6 von 20) [13.03.2002 13:17:36]

Black Art of Java Game Programming:Table of ContentsHow HighScoreManager Reduces CalculationsImplementing Server FeaturesEffect of Client Design on Server PerformanceTasks Performed by the ServerCreating the High Score ObjectsThe HighScoreList ClassScoring VariablesThe HSob Object ClassData ParsingThe StringTokenizer ClassConverting Data to ObjectsThe parseData() MethodThe addScore() MethodThe tryScore() MethodThe getScore() MethodCreating the HighScoreManager ClassThe getScores() MethodThe paintScores() MethodMethods for Creating ColorsMethods for Creating FontsAdding New Scores to HighScoreListCreating a Testing AppletDouble-Buffering the Testing AppletThe testApp GUIThreading HighScoreManagerUsing ThreadsConverting HighScoreManager to a ThreadWriting the Networking CodeCreating a New SocketEstablishing the ConnectionUpdating and Requesting Information: The HighScore ProtocolUnderstanding BlockingTerminating the LinkCreating a Server ApplicationThe HighScoreServer ClassThe ServerThread ClassServer Initialization RoutineCoding the run() MethodTrying Out the New ServerWriting Scores Out to a FileRunning the New Serverfile:///D me%20Programming/ewtoc.html (7 von 20) [13.03.2002 13:17:36]

Black Art of Java Game Programming:Table of ContentsSuggestion BoxSummaryChapter 9—Advanced Networking and Multiplayer GamingConceptsWhy Create a Chat Room?Fundamentals of Multiplayer GamingTypes of Multiplayer Games: The User’s PerspectiveCooperative GamingCompetitive GamingTypes of Multiplayer Games: The Programmer’s PerspectiveLocal GamesRemote GamesChoosing the Proper Networking ArchitecturePeer-to-Peer NetworkingNetworking RingsPeer-to-Peer Networking in JavaAdapting Client-Server Architecture to Multiplayer GamesUnderstanding the Chat Room ServerFunctions of a Chat Room ServerChatServer ClassesImplementing the Chat Room ServerCreating the ChatServer ClassCreating the ChatServerThread ClassCreating the sClientGroup ClassThe Vector ClassThe sClientGroup.java Startup FileThe sendMessage( ) MethodsThe calcList( ) MethodThe StringBuffer ClassAutomatic Garbage Collection (Reclaiming Unused Memory)The cleanHouse( ) MethodCreating the sClientThread ClassWriting the Real sClientThread CodeThe parent VariableThe run( ) MethodThe finalize( ) MethodThe message( ) MethodThe Alias Handling MethodsThe Final Server CompileCreating the Chat Room ClientGeneral Design Considerationsfile:///D me%20Programming/ewtoc.html (8 von 20) [13.03.2002 13:17:36]

Black Art of Java Game Programming:Table of ContentsUser Interface ComponentsUser Interface Design ConsiderationsComponent Commands and MethodsCommon Component MethodsMethods Unique to ListPlanning Your Event-Handling StrategyBasic Events and Their PropertiesEvent ConstantsImplementing the Client Chat Room Applet CodeThe ChatClient.java Startup FileText OutputGUI SetupEvent HandlingThe run( ) MethodCommand ParsingServer InputThe stop( ) MethodSuggestion BoxSummaryChapter 10—Advanced TechniquesUsing PackagesImporting Packages and ClassesCreating PackagesNested Packages and Directory StructureUsing ThreadsA Quick Review of ThreadsCreating ThreadsCreating a Subclass of ThreadCreating a Class That Implements RunnableUnderstanding Thread SchedulingCreating a Simple Multithreaded AnimationStructuring Games with Multiple ThreadsIncorporating Multiple Threads into the Alien Landing GameUsing the synchronized KeywordConsidering the Pros and Cons of Using Multiple ThreadsImproving Performance with Image ProcessingWhy Be Concerned with Image Processing?Creating Image StripsFiltering the ImagesExtracting Images from an Image StripUsing the java.util Classesfile:///D me%20Programming/ewtoc.html (9 von 20) [13.03.2002 13:17:37]

Black Art of Java Game Programming:Table of ContentsThe Date ClassThe Vector ClassThe Stack ClassThe Hashtable ClassThe Random ClassWriting for Multiple PlatformsYield ThreadsAligning TextDetermining System PropertiesDetermining Screen ParametersObtaining System PropertiesAsk the PlayerAllowing CustomizationTesting Your Games on Multiple PlatformsSuggestion BoxSummaryChapter 11—Into the Third DimensionPerformance Issues with 3D in JavaImproving Performance Through Simple RenderingImproving Performance Through Optimizing the Overall ModelFuture Optimization of Java ItselfPolygon-Based ModelingThe PolyhedronVerticesUnderstanding the Structure of a PolyhedronImplementing an Array of 3D PointsPolygonsUnderstanding Polygon Orientation and Visible SurfaceDeterminationImplementing an Indexing Polygon (fIndexingPolygon)Why Is the Indexing Polygon an Abstract Class?The Static “Scratch-Pad” PolygonThe Abstract paint() and copyIndexedPoints() MethodsThe Static orientation() MethodImplementing a Filled PolygonThe paint() MethodThe fColor ClassImplementing the Polyhedron ClassThe Abstract paint() MethodReading and Writing Polyhedrons from/to StreamsA Two-Dimensional Point Arrayfile:///D me%20Programming/ewtoc.html (10 von 20) [13.03.2002 13:17:37]

Black Art of Java Game Programming:Table of ContentsThe Convex Polyhedron and Polygon SortingWhat Does Convex Mean?The Advantages of Using Convex PolyhedronsImplementing a Convex Polyhedron (fConvexPolyhedron)The Classes Used So FarConstructing a Simple 3D PipelineThe Four Coordinate SystemsThe Model Coordinate System (MCS)The World Coordinate System (WCS)The View Coordinate System (VCS)Projecting 3D Points on a PlaneThe Screen Coordinate System (SCS)The CameraImplementing a Generic Camera (fGenericCamera)The Static BuffersCalculating Screen Distance with Respect to the View AngleThe Private updateMatrix() MethodThe project() MethodImplementing the 3D Point Class (fPoint3d)Implementing the 3D Angle Class (fAngle3d)Implementing the 3D Matrix Class (fMatrix3d)The Complete Chain of TransformsThe Polyhedron Instance ClassImplementing the Polyhedron InstanceThe Array transformedVerticesUnderstanding the paint() MethodPutting It All TogetherImplementing the Rotating Cubes AppletInitiating the AppletThe run() MethodSuggestion BoxSummaryChapter 12—Building 3D Applets with App3DcoreWhat Is the App3Dcore?The Core’s Internal StructureUnderstanding the Virtual World in the CoreUnderstanding the 3D Engine in the CoreBuilding an Application on Top of the CoreA Small Example: The Bouncing BoxesThe BouncingBox ConstructorThe Overridden Updatefile:///D me%20Programming/ewtoc.html (11 von 20) [13.03.2002 13:17:37]

Black Art of Java Game Programming:Table of ContentsThe initiateClass() MethodThe BouncingBoxWorld ConstructorThe initiateClasses() MethodThe init() MethodThe run() MethodThe paint() MethodBuilding on the

entertainment using the Java programming language. Java heralds a revolutionary shift in gaming, away from the desktop and into the network. Using Java, you’ll create games that people can download through the Web and play. Using Java, you’ll enable players from around the world to compete against one another.

Related Documents:

java.io Input and output java.lang Language support java.math Arbitrary-precision numbers java.net Networking java.nio "New" (memory-mapped) I/O java.rmi Remote method invocations java.security Security support java.sql Database support java.text Internationalized formatting of text and numbers java.time Dates, time, duration, time zones, etc.

Java Version Java FAQs 2. Java Version 2.1 Used Java Version This is how you find your Java version: Start the Control Panel Java General About. 2.2 Checking Java Version Check Java version on https://www.java.com/de/download/installed.jsp. 2.3 Switching on Java Console Start Control Panel Java Advanced. The following window appears:

3. _ is a software that interprets Java bytecode. a. Java virtual machine b. Java compiler c. Java debugger d. Java API 4. Which of the following is true? a. Java uses only interpreter b. Java uses only compiler. c. Java uses both interpreter and compiler. d. None of the above. 5. A Java file with

With Black Art of Java Game Programming, you'll learn how to create your own dynamic online entertainment using the Java programming language. Java heralds a revolutionary shift in gaming, away from the desktop and into the network. Using Java, you'll create games that people can download through the Web and play.

Aug 24, 2016 · The logo is available as a color graphic, using Java Orange and Java Blue. The use of the logo in Java Orange and Java Blue on a white back The logo is also available in white for use on a Java Blue, Java Orange, or black background, and in black for use on a white backgr

Oct 22, 2014 · ART ART 111 Art Appreciation ART 1301 Fine Arts ART 113 Art Methods and Materials Elective Fine Arts . ART 116 Survey of American Art Elective Fine Arts ART 117 Non Western Art History Elective Fine Arts ART 118 Art by Women Elective Fine Arts ART 121 Two Dimensional Design ART 1321 Fine Arts ART

ART-116 3 Survey of American Art ART ELECTIVE Art/Aesthetics ART-117 3 Non-Western Art History ART ELECTIVE Art/Aesthetics OR Cultural Elective ART-121 3 Two-Dimensional Design ART ELECTIVE Art/Aesthetics ART-122 3 Three-Dimensional Design ART ELECTIVE Art/Aesthetics ART-130 2 Basic Drawing

besteht aus der Java-API (Java Application Programming Interface) und der Java-VM (Java Virtual Machine). Abbildung 1: Java-Plattform Die Java-API ist eine große Sammlung von Java-Programmen, die in sog. Pakete (packages) aufgeteilt sind. Pakete sind vergleichbar mit Bibliotheken in anderen Programmiersprachen und umfassen u.a.