Killer Game Programming in Java - Helion
ISBN: 978-05-965-5290-9
stron: 998, Format: ebook
Data wydania: 2005-05-20
Księgarnia: Helion
Cena książki: 126,65 zł (poprzednio: 147,27 zł)
Oszczędzasz: 14% (-20,62 zł)
Although the number of commercial Java games is still small compared to those written in C or C++, the market is expanding rapidly. Recent updates to Java make it faster and easier to create powerful gaming applications-particularly Java 3D-is fueling an explosive growth in Java games. Java games like Puzzle Pirates, Chrome, Star Wars Galaxies, Runescape, Alien Flux, Kingdom of Wars, Law and Order II, Roboforge, Tom Clancy's Politika, and scores of others have earned awards and become bestsellers.Java developers new to graphics and game programming, as well as game developers new to Java 3D, will find Killer Game Programming in Java invaluable. This new book is a practical introduction to the latest Java graphics and game programming technologies and techniques. It is the first book to thoroughly cover Java's 3D capabilities for all types of graphics and game development projects.Killer Game Programming in Java is a comprehensive guide to everything you need to know to program cool, testosterone-drenched Java games. It will give you reusable techniques to create everything from fast, full-screen action games to multiplayer 3D games. In addition to the most thorough coverage of Java 3D available, Killer Game Programming in Java also clearly details the older, better-known 2D APIs, 3D sprites, animated 3D sprites, first-person shooter programming, sound, fractals, and networked games. Killer Game Programming in Java is a must-have for anyone who wants to create adrenaline-fueled games in Java.
Osoby które kupowały "Killer Game Programming in Java", wybierały także:
- Metoda dziel i zwyci 89,00 zł, (26,70 zł -70%)
- Język C. Kurs video. Praktyczne wprowadzenie do programowania 99,00 zł, (29,70 zł -70%)
- Wprowadzenie do Javy. Programowanie i struktury danych. Wydanie XII 193,23 zł, (59,90 zł -69%)
- Spring i Spring Boot. Kurs video. Testowanie aplikacji i bezpiecze 125,42 zł, (45,15 zł -64%)
- Maven. Kurs video. Automatyzacja tworzenia aplikacji w Javie 98,98 zł, (39,59 zł -60%)
Spis treści
Killer Game Programming in Java eBook -- spis treści
- Killer Game Programming in Java
- SPECIAL OFFER: Upgrade this ebook with OReilly
- A Note Regarding Supplemental Files
- Preface
- Who Are You?
- What This Book Is About
- This Book (and More) Is Online
- What This Book Is Not About
- A Graphical View of This Book
- 2D Programming
- 3D Programming
- Network Programming
- The Appendixes
- Conventions Used in This Book
- Using Code Examples
- Comments and Questions
- Safari Enabled
- Acknowledgments
- 1. Why Java for Games Programming?
- 1.1. Java Is Too Slow for Games Programming
- 1.1.1. Swing Is Slow
- 1.1.2. My Program Is Slow Because of Java
- 1.2. Java Has Memory Leaks
- 1.3. Java Is Too High-level
- 1.4. Java Application Installation Is a Nightmare
- 1.5. Java Isnt Supported on Games Consoles
- 1.6. No One Uses Java to Write Real Games
- 1.6.1. Freeware/Shareware Games
- 1.7. Sun Microsystems Isn't Interested in Supporting Java Gaming
- 1.1. Java Is Too Slow for Games Programming
- 2. An Animation Framework
- 2.1. Animation as a Threaded Canvas
- 2.1.1. Synchronization Concerns
- 2.1.2. Application and Game Termination
- 2.1.3. Why Use Volatile?
- 2.1.4. Why Sleep?
- 2.1.5. Double Buffering Drawing
- 2.1.6. Adding User Interaction
- 2.3. Converting to Active Rendering
- 2.4. FPS and Sleeping for Varying Times
- 2.4.1. Timer Resolution
- 2.4.2. Am I Done Yet? (Nope)
- 2.4.3. Improved J2SE Timers
- 2.4.4. Using Non-J2SE Timers
- 2.4.5. Measuring Timer Resolution
- 2.4.6. Java 3D Timer Bug Alert
- 2.5. Sleeping Better
- 2.5.1. Handling Sleep Inaccuracies
- 2.6. FPS and UPS
- 2.6.1. Separating Updates from Rendering
- 2.7. Pausing and Resuming
- 2.8. Other Animation Approaches
- 2.8.1. Swing Timer Animation
- 2.8.2. The Utility Timer
- 2.1. Animation as a Threaded Canvas
- 3. Worms in Windows and Applets
- 3.1. Preliminary Considerations
- 3.1.1. The Choice of Timer
- 3.1.2. Class Reuse
- 3.1.3. Testing for Speed
- 3.2. Class Diagrams for the WormChase Application
- 3.3. The Worm-Chasing Application
- 3.4. The Game Panel
- 3.4.1. User Input
- 3.4.2. The Animation Loop
- 3.4.3. Statistics Gathering
- 3.4.4. Drawing the Canvas
- 3.5. Storing Worm Information
- 3.5.1. Growing a Worm
- 3.5.2. Calculating a New Head Point
- 3.5.3. Choosing a Bearing
- 3.5.4. Dealing with Obstacles
- 3.5.5. Moving the Worm
- 3.5.6. Drawing the Worm
- 3.5.7. Testing the Worm
- 3.6. Worm Obstacles
- 3.7. Application Timing Results
- 3.7.1. Timing Results Using currentTimeMillis()
- 3.8. WormChase as an Applet
- 3.8.1. The WormChaseApplet Class
- 3.8.2. The WormPanel Class
- 3.8.3. Timing Results
- 3.9. Compilation in J2SE 5.0
- 3.9.1. What Is a Type-Safe Collection?
- 3.9.2. Dealing with Raw Types in J2SE 5.0
- 3.1. Preliminary Considerations
- 4. Full-Screen Worms
- 4.1. An Almost Full-Screen (AFS) Worm
- 4.1.1. The AFS WormChase Class
- 4.1.2. Stopping Window Movement
- 4.1.3. Timings for AFS
- 4.2. An Undecorated Full-Screen (UFS) Worm
- 4.2.1. The UFS WormChase Class
- 4.2.2. The Game Panel
- 4.2.3. Button Behavior
- 4.2.4. Drawing the Game Canvas
- 4.2.5. Exiting the Game
- 4.2.6. Timings for UFS
- 4.3. A Full-Screen Exclusive Mode (FSEM) Worm
- 4.3.1. The FSEM WormChase Class
- 4.3.2. Setting Up Full-Screen Exclusive Mode
- 4.3.3. Double Buffering, Page Flipping, and More
- 4.3.4. Rendering the Game
- 4.3.5. Finishing Off
- 4.3.6. Displaying the Display Mode
- 4.3.7. Changing the Display Mode
- 4.3.8. Timings for FSEM
- 4.4. Timings at 80 to 85 FPS
- 4.1. An Almost Full-Screen (AFS) Worm
- 5. An Introduction to Java Imaging
- 5.1. Image Formats
- 5.2. The AWT Imaging Model
- 5.1.1. The MediaTracker Class
- 5.1.2. ImageIcon
- 5.1.3. The Rise of JARs
- 5.1.4. AWT Image Processing
- 5.3. An Overview of Java 2D
- 5.2.1. The Graphics2D Class
- 5.2.2. Java 2D and Active Rendering
- 5.4. Buffering an Image
- 5.4.1. From Image to BufferedImage
- 5.4.2. The Internals of BufferedImage
- 5.4.3. BufferedImageOp Operations
- 5.5. Managed Images
- 5.6. VolatileImage
- 5.7. Java 2D Speed
- 5.8. Portability and Java 2D
- 5.9. JAI
- 6. Image Loading, Visual Effects, and Animation
- 6.1.
- 6.1.1. Class Diagrams for the Application
- 6.2. Loading Images
- 6.2.1. Internal Data Structures
- 6.2.2. Getting an Image
- 6.2.3. Using ImagesLoader
- 6.2.4. Implementation Details
- 6.2.5. Image Loading
- 6.2.6. Loading Strip File Images
- 6.3. Applying Image Effects
- 6.3.1. Starting ImagesTests
- 6.3.2. Initializing Images
- 6.3.3. Updating the Images
- 6.3.4. Painting the Images
- 6.3.5. Information on Accelerated Memory
- 6.4. Displaying Image Sequences
- 6.4.1. Implementation Details
- 6.5. Visual Effects for 'o' Images
- 6.5.1. Precalculation Is Faster
- 6.5.2. drawImage()-Based Processing
- 6.5.3. Alpha Compositing
- 6.5.4. Affine Transforms
- 6.5.5. ConvolveOp Processing
- 6.5.6. LookupOp Processing
- 6.5.7. RescaleOp Processing
- 6.5.7.1. Brightening the image
- 6.5.7.2. Negating the image
- 6.5.8. BandCombineOp Processing
- 6.5.9. Pixel Effects
- 6.5.8.1. Teleporting an image
- 6.5.8.2. Zapping an image
- 6.6. Packaging the Application as a JAR
- 6.1.
- 7. Introducing Java Sound
- 7.1. Applet Playing
- 7.2. The AudioClip Class
- 7.3. The Sound Player
- 7.4. The Java Sound API
- 7.5. Sampled Audio
- 7.5.1. The Mixer
- 7.5.2. Playing a Clip
- 7.5.3. Short Sound Bug in J2SE 5.0
- 7.5.4. Playing a Buffered Sample
- 7.6. MIDI
- 7.6.1. A MIDI Sequence
- 7.6.2. Playing a MIDI Sequence
- 7.7. Java Sound API Compared with JMF and JOAL
- 7.8. Java Sound API Resources
- 7.9. Audio Resources
- 8. Loading and Playing Sounds
- 8.1. Loader Design and Implementation Issues
- 8.2. Testing the Loaders
- 8.2.1. Watching the Loaders
- 8.2.2. Termination
- 8.2.3. The Listener Methods
- 8.3. The Sounds Panel
- 8.4. The Clips Loader
- 8.4.1. Playing Clips
- 8.5. Storing Clip Information
- 8.5.1. Stopping Clips
- 8.5.2. Pausing and Resuming Clips
- 8.5.3. Handing Line Events
- 8.6. The Midi Sequences Loader
- 8.6.1. Playing Sequences
- 8.6.2. Pausing and Resuming Sequences
- 8.6.3. Stopping Sequences
- 8.6.4. Closing Sequences
- 8.7. Storing Midi Information
- 8.7.1. Stopping Sequences
- 8.7.2. Pausing and Resuming Sequences
- 8.8. LoadersTests as a JAR File
- 9. Audio Effects
- 9.1. Audio Effects on Sampled Audio
- 9.1.1. Precalculation
- 9.1.2. Byte Array Manipulation
- 9.1.2.1. Making a sound clip echo
- 9.1.2.2. Playing
- 9.1.3. Utilizing Mixer Controls
- 9.1.3.1. Adjusting a clip's volume and pan values
- 9.1.3.2. What controls are available?
- 9.1.3.3. Java audio controls
- 9.1.3.4. Setting the volume in PlaceClip
- 9.1.3.5. Panning between the speakers in PlaceClip
- 9.2. Audio Effects on MIDI Sequences
- 9.2.1. Precalculation
- 9.2.2. Sequence Manipulation
- 9.2.2.1. Doubling the sequence volume
- 9.2.3. MIDI Channel Controllers
- 9.2.3.1. Making a sequence fade away
- 9.2.3.2. Getting and setting the volume
- 9.2.3.3. Changing the volume
- 9.2.3.4. The MIDI volume bug
- 9.2.3.5. Panning the sequence
- 9.2.3.6. Changing the pan value
- 9.2.4. Sequencer Methods
- 9.1. Audio Effects on Sampled Audio
- 10. Audio Synthesis
- 10.1. Sampled Audio Synthesis
- 10.1.1. Note Names
- 10.1.2. Playing a Note
- 10.1.3. Synthesizing Notes
- 10.1.3.1. Creating samples
- 10.1.3.2. Extending NotesSynth
- 10.2. MIDI Synthesis
- 10.2.1. Sending Note-Playing Message to a MIDI Channel
- 10.2.2. Sending MIDI Messages to the Synthesizer's Receiver Port
- 10.2.2.1. Control change messages
- 10.2.3. Creating a Sequence
- 10.2.3.1. Instruments and soundbanks
- 10.2.3.2. Listing instruments
- 10.2.3.3. Making a sequence
- 10.2.3.4. Playing the sequence
- 10.2.3.5. The add() methods
- 10.2.3.6. Changing an instrument
- 10.2.3.7. Program and bank change
- 10.2.3.8. From note name to MIDI number
- 10.2.3.9. Extending SeqSynth
- 10.3. Audio Synthesis Libraries
- 10.1. Sampled Audio Synthesis
- 11. Sprites
- 11.1. Bats, Balls, and Sprites
- 11.2. Class Diagrams for BugRunner
- 11.3. The Bug Starts Running
- 11.4. The Animation Framework
- 11.4.1. User Interaction
- 11.4.2. The Animation Loop
- 11.4.3. Finishing the Game
- 11.5. Defining a Sprite
- 11.6. Coding a Sprite
- 11.6.1. The Sprite Constructor
- 11.6.2. A Sprite's Image
- 11.6.3. A Sprite's Bounding Box
- 11.6.4. Updating a Sprite
- 11.6.5. Drawing a Sprite
- 11.7. Specifying a Sprite with a Statechart
- 11.7.1. Translating a Statechart to Code
- 11.8. The Ball Sprite
- 11.8.1. Textual Specification
- 11.8.2. Statechart Specification
- 11.8.3. Translating the Statechart
- 11.8.3.1. Updating the sprite
- 11.8.3.2. Hitting a wall
- 11.8.3.3. Leaving the screen
- 11.8.3.4. Drawing the sprite
- 11.9. Defining the Bat
- 11.9.1. Textual Specification
- 11.9.2. Statechart Specification
- 11.9.3. Translating the Statechart
- 11.9.3.1. User-based reactions
- 11.9.3.2. Mouse responses
- 11.9.3.3. Time-based reactions
- 11.9.3.4. Concurrently shared data
- 12. A Side-Scroller
- 12.1. JumpingJack in Layers
- 12.2. Class Diagrams for JumpingJack
- 12.3. Start Jack Jumping
- 12.4. The Animation Framework
- 12.4.1. Dealing with Input
- 12.4.2. Multiple Key Presses/Actions
- 12.4.3. The Animation Loop
- 12.4.3.1. Rendering order
- 12.4.4. Handling an Explosion
- 12.5. Managing the Ribbons
- 12.6. Wraparound Ribbons
- 12.6.1. Drawing the Ribbon's Image
- 12.6.1.1. Case 1: Draw the image at JPanel (0,0)
- 12.6.1.2. Case 2: Image moving right, where xImHead is less than pWidth
- 12.6.1.3. Case 3: Image moving right, where xImHead is greater than or equal to pWidth
- 12.6.1.4. Case 4: Image moving left, where xImHead is greater than or equal to (pWidth-width)
- 12.6.1.5. Case 5. Image moving left, where xImHead is less than (pWidth-width)
- 12.6.1. Drawing the Ribbon's Image
- 12.7. Managing the Bricks
- 12.7.1. Loading Bricks Information
- 12.7.2. Initializing the Bricks Data Structures
- 12.7.3. Moving the Bricks Map
- 12.7.4. Drawing the Bricks
- 12.7.4.1. Case 1. Bricks map moving right and bCoord is less than pWidth
- 12.7.4.2. Case 2. Bricks map moving right and bCoord is greater than pWidth
- 12.7.4.3. Case 3. Bricks map moving left and bCoord is greater than (pWidth-width+imWidth)
- 12.7.4.4. Case 4. Bricks map moving left and bCoord is less than (pWidth-width+ imWidth)
- 12.7.4.5. The drawBricks() method
- 12.7.5. JumperSprite-Related Methods
- 12.7.5.1. Finding the floor
- 12.7.5.2. Testing for brick collision
- 12.7.5.3. Jumping and hitting your head
- 12.7.5.4. Falling and sinking into the ground
- 12.8. Storing Brick Information
- 12.9. The Fireball
- 12.9.1. Statechart Specification
- 12.10. The Jumping Sprite
- 12.10.1. Statechart Specification
- 12.10.2. Representing the States
- 12.10.3. Initialization
- 12.10.4. Key Event Processing
- 12.10.5. JackPanel Collision Testing
- 12.10.6. Updating the Sprite
- 12.10.6.1. Falling?
- 12.10.7. Vertical Movement
- 12.11. Other Side-Scroller Examples
- 12.12. Tiling Software
- 13. An Isometric Tile Game
- 13.1. Isometric Tiles
- 13.1.1. Movement
- 13.1.2. Placing a Sprite/Object
- 13.1.3. The Tile Map Surface
- 13.1.4. The Aliens
- 13.2. Class Diagrams for AlienTiles
- 13.3. The Animation Framework
- 13.3.1. Managing the Game World
- 13.3.2. Dealing with Input
- 13.3.3. The Animation Loop
- 13.3.4. Ending the Game
- 13.4. Managing the World
- 13.4.1. Loading Floor Information
- 13.4.1.1. Storing floor data
- 13.4.1.2. Creating obstacles
- 13.4.2. Loading World Entity Information
- 13.4.3. Pickup Methods
- 13.4.4. Player Methods
- 13.4.5. Drawing the World
- 13.4.1. Loading Floor Information
- 13.5. Managing WorldItems
- 13.5.1. Adding an Entity
- 13.5.2. Drawing Entities
- 13.5.3. Pickup Methods
- 13.6. The Tile Occupier
- 13.6.1. Additional Sprite Information
- 13.6.2. Drawing a Tile Occupier
- 13.7. A Sprite on a Tile
- 13.7.1. Moving to Another Tile
- 13.8. The Player Sprite
- 13.8.1. Moving (and Standing Still)
- 13.8.2. Drawing the Player
- 13.8.3. Being Hit by an Alien
- 13.8.4. Trying to Pick Up a Pickup
- 13.9. The Alien Sprite
- 13.9.1. Updating the AlienSprite
- 13.10. The Quadrant-Based Alien Sprite
- 13.10.1. Planning a Move
- 13.10.2. Moving the AlienQuadSprite
- 13.11. The A*-Based Alien Sprite
- 13.11.1. Planning a Move
- 13.11.2. The A* Algorithm
- 13.11.3. Moving the AlienAStarSprite
- 13.12. Storing Tile Details
- 13.12.1. Calculating the Cost to the Goal
- 13.13. Further Reading
- 13.13.1. A* Information
- 13.1. Isometric Tiles
- 14. Introducing Java 3D
- 14.1. Java 3D
- 14.1.1. DirectX or OpenGL?
- 14.1.2. The Scene Graph
- 14.1.2.1. Some Java 3D scene graph nodes
- 14.1.2.2. The HelloUniverse scene graph
- 14.2. Java 3D Strengths
- 14.2.1. The Scene Graph
- 14.2.2. Performance
- 14.2.3. Unique Features
- 14.2.4. Java Integration
- 14.2.5. Documentation and Examples
- 14.3. Criticisms of Java 3D for Games Programming
- 14.3.1. Java 3D Is Too Slow for Games
- 14.3.1.1. Java 3D is slow because Java is slow
- 14.3.2. Java 3D Is Too High-Level
- 14.3.3. Lack of Console Support
- 14.3.4. No Real Java 3D Games
- 14.3.4.1. Java 3D loaders for games
- 14.3.4.2. Add-ons for gaming
- 14.3.5. Sun Doesn't Support Java 3D
- 14.3.5.1. Roadmaps for the future
- 14.3.1. Java 3D Is Too Slow for Games
- 14.4. Alternatives to Java 3D
- 14.4.1. Java Bindings to OpenGL
- 14.4.1.1. GL4Java
- 14.4.1.2. Lightweight Java Game Library (LWJGL)
- 14.4.1.3. JOGL
- 14.4.2. Scene Graph APIs
- 14.4.2.1. Xith3D
- 14.4.2.2. OpenMind
- 14.4.2.3. jME graphics engine
- 14.4.2.4. Jist3D
- 14.4.2.5. JiD
- 14.4.2.6. Aviatrix3D
- 14.4.2.7. Kahlua
- 14.4.2.8. jFree-D2
- 14.4.3. Game Engine Bindings
- 14.4.3.1. Auriga3D
- 14.4.3.2. Jake2
- 14.4.3.3. Ogre4J
- 14.4.3.4. Jirr
- 14.4.3.5. Odejava
- 14.4.1. Java Bindings to OpenGL
- 14.1. Java 3D
- 15. A 3D Checkerboard: Checkers3D
- 15.1. Class Diagrams for Checkers3D
- 15.2. Integrating Java 3D and Swing
- 15.3. Scene Graph Creation
- 15.3.1. Lighting the Scene
- 15.3.2. The Scene's Background
- 15.4. Floating Spheres
- 15.4.1. Coloring the Spheres
- 15.4.2. Positioning the Spheres
- 15.5. The Floor
- 15.5.1. The Colored Tiles
- 15.5.2. The Floor's Axis Labels
- 15.6. Viewer Positioning
- 15.7. Viewer Movement
- 15.8. Viewing the Scene Graph
- 16. Loading and Manipulating External Models
- 16.1. An Overview of LoaderInfo3D
- 16.2. Loaders in Java 3D
- 16.2.1. Using NCSA Portfolio Loaders
- 16.3. Displaying a Model
- 16.3.1. Scaling the Model
- 16.4. Examining a Model's Scene Graph
- 16.4.1. Graph Traversal Output
- 16.5. Adjusting a Model's Shape Attributes
- 16.5.1. Turning the Shape Blue
- 16.5.2. Drawing a Shape in Outline
- 16.5.3. Making a Shape Almost Transparent
- 16.5.4. Adding a Texture to a Shape
- 16.5.4.1. Texture coordinates
- 16.5.4.2. A tendency to strip
- 16.5.4.3. Applying the texture to the shape
- 16.6. An Overview of Loader3D
- 16.7. Using Loader3D
- 16.8. Creating the Scene
- 16.9. Managing the Model
- 16.10. Building the Model's Scene Graph
- 16.10.1. Loading the Model
- 16.10.2. Loading and Applying the Coords Data
- 16.10.3. Handling Rotation
- 16.10.3.1. Applying the rotation
- 16.10.4. Making the Model Available
- 16.10.5. Modifying the Model's Configuration at Runtime
- 17. Using a Lathe to Make Shapes
- 17.1. Class Diagrams for Lathe3D
- 17.2. Creating the Scene
- 17.2.1. Shapes with Curves and Lines
- 17.2.2. Shapes with Colors
- 17.2.3. Different Curve Rotations
- 17.3. The Lathe Curve
- 17.3.1. Specifying Curve Segments
- 17.3.2. Implementation
- 17.3.3. Calculating the Tangents
- 17.3.4. Building the Entire Curve
- 17.4. The Lathe Shape
- 17.4.1. Creating the Geometry
- 17.4.2. You Say You Want a Revolution
- 17.4.3. Creating Texture Coordinates
- 17.4.4. A Thin Problem
- 17.4.5. Making an Appearance
- 17.5. Subclassing the Lathe Shape
- 17.5.1. An Elliptical Shape
- 17.5.2. A Rhodonea Shape
- 18. 3D Sprites
- 18.1. Class Diagrams for Tour3D
- 18.2. Creating the Scene
- 18.2.1. Adding a Background Image
- 18.2.2. Full-Screen Display
- 18.2.3. Adding Scenery and Obstacles
- 18.2.4. Obstacles
- 18.3. The Basic 3D Sprite
- 18.3.1. Visibility
- 18.3.2. Movement and Rotation
- 18.3.3. Obstacle and Boundary Detection
- 18.3.4. Updating the Sprite
- 18.4. The User's Touring Sprite
- 18.5. The Alien Sprite
- 18.6. Behaviors in Java 3D
- 18.7. Controlling the Touring Sprite
- 18.7.1. What's a Third-Person Camera?
- 18.7.2. Setting Up TouristControls
- 18.7.3. Keys Understood by TouristControls
- 18.7.4. Viewpoint Initialization
- 18.7.5. Moving the Camera
- 18.7.6. Zooming the Camera
- 18.7.7. Rotating the Camera
- 18.8. Updating the Alien Sprite
- 19. Animated 3D Sprites
- 19.1.
- 19.1.1. Keyframe Animation in This Chapter
- 19.2. Class Diagrams for AnimTour3D
- 19.3. Creating the Scene
- 19.4. The Animated 3D Sprite
- 19.4.1. Loading the Poses
- 19.4.2. Where Did These Models Come From?
- 19.4.3. Setting a Pose
- 19.4.4. Sprite Activity
- 19.4.5. Floor Boundary Detection
- 19.5. Controlling the Sprite
- 19.6. Animating the Sprite
- 19.6.1. Adding an Animation Sequence
- 19.6.2. Processing an Animation Operation
- 19.6.3. Updating the User's Viewpoint
- 19.7. Full-Screen Exclusive Mode (FSEM)
- 19.8. A Full-Screen Version of the Application
- 19.8.1. Creating the Full-Screen Scene
- 19.8.2. Changing the Display Mode
- 19.9. Pros and Cons of Keyframe Animation
- 19.1.
- 20. An Articulated, Moveable Figure
- 20.1. The Articulated Figure Application
- 20.1.1. Building the Figure
- 20.2. Forward and Inverse Kinematics
- 20.2.1. Forward Kinematics in Mover3D
- 20.3. Class Diagrams for Mover3D
- 20.4. Creating the Scene
- 20.5. Processing User Input
- 20.6. The Commands Panel
- 20.6.1. Processing a Command
- 20.7. Making and Moving the Figure
- 20.7.1. Building the Figure
- 20.7.2. Orientating Limbs
- 20.7.3. Creating the Scene Graph
- 20.7.4. Processing Limb-Related Operations
- 20.7.5. Figure Movement
- 20.8. Modeling a Limb
- 20.8.1. Growing a Limb
- 20.8.2. Updating and Resetting
- 20.9. Moving a Limb
- 20.9.1. Moving an Elliptical Limb
- 20.10. Other Articulated Figures
- 20.11. Articulation and Mesh Deformation
- 20.12. Articulation and Skinning
- 20.13. Articulation and Morphing
- 20.1. The Articulated Figure Application
- 21. Particle Systems
- 21.1. Particle Systems in Java 3D
- 21.1.1. Referring to Float Arrays
- 21.1.2. Synchronization Problems
- 21.1.3. The Inner Class Coding Style
- 21.2. Class Diagrams for Particles3D
- 21.3. Creating the Scene
- 21.4. A Fountain of Points
- 21.4.1. The Particle System's Geometry and Appearance
- 21.4.2. Updating the Points
- 21.4.3. Updating Particles
- 21.4.4. Triggering an Update
- 21.5. A Fountain of Lines
- 21.5.1. Initializing the Particles
- 21.5.2. Particle Appearance
- 21.5.3. Updating the Particle System
- 21.6. A Fountain of Quads
- 21.6.1. Specifying the Geometry
- 21.6.2. Initializing Particle Movement
- 21.6.3. Initializing Particle Texture Coordinates
- 21.6.4. Initializing Particle Normals
- 21.6.5. Particle Appearance
- 21.6.6. Updating the Particles
- 21.7. Performance Results
- 21.8. More Particle Systems
- 21.9. Other Java 3D Approaches
- 21.10. Non-Java 3D Approaches
- 21.1. Particle Systems in Java 3D
- 22. Flocking Boids
- 22.1. A Flocking Application
- 22.2. Scene Creation
- 22.3. Adding Obstacles
- 22.3.1. The boid shape
- 22.4. Types of Boids
- 22.4.1. Boid Movement
- 22.4.2. Animating the Boid
- 22.4.3. Velocity Rules
- 22.4.4. Obstacle Avoidance
- 22.4.5. Staying in Bounds
- 22.4.6. The Prey Boid
- 22.4.7. The Predator Boid
- 22.5. Grouping the Boids
- 22.6. Flock Behavior
- 22.6.1. Animate the Boids
- 22.6.2. Velocity Rules Again
- 22.6.3. The Prey's Behavior
- 22.6.4. Velocity Rules and Other Flocks
- 22.6.5. Goodbye Prey
- 22.6.6. The Predator's Behavior
- 22.6.7. Lunch Time
- 23. Shooting a Gun
- 23.1. Class Diagrams for Shooter3D
- 23.2. Scene Creation
- 23.3. The Sound of Shooting
- 23.4. Picking Scene Objects
- 23.4.1. What to Pick in Shooter3D?
- 23.5. Controlling the Gun
- 23.6. Preparing the Laser Beam
- 23.6.1. Shooting the Beam
- 23.7. Causing an Explosion
- 23.7.1. Rotating the Explosion
- 23.7.2. Displaying a Series of Images
- 23.8. Picking with a Mouse Click
- 23.8.1. From Mouse Click to Picked Object
- 23.8.2. Finding Intersections
- 23.9. Shooting Behavior
- 23.9.1. Debugging Picking
- 23.9.2. Rotating the Cone
- 23.9.3. Making the Explosion Face the Viewer
- 23.10. Firing the Beam
- 23.11. More on Picking
- 24. A First-Person Shooter
- 24.1. Class Diagrams for FPShooter3D
- 24.2. Setting Up the Target
- 24.3. Positioning and Moving the User's Viewpoint
- 24.3.1. Viewpoint Behaviors
- 24.4. Initializing the User's Viewpoint
- 24.5. Adding an Image to the Viewpoint
- 24.5.1. Why Use a GIF?
- 24.6. Managing the Ammunition
- 24.6.1. Shooting the Gun
- 24.7. Managing a Laser Beam
- 24.7.1. Firing a Beam
- 24.8. Moving the Viewpoint
- 25. A 3D Maze
- 25.1. Class Diagrams for Maze3D
- 25.2. Making a Maze Plan
- 25.2.1. Generating a Maze Using Software
- 25.3. The User Interface
- 25.4. Managing the Maze
- 25.4.1. Collision Detection
- 25.5. Scenery Creation
- 25.5.1. Making a Background
- 25.6. Tiling the Floor
- 25.6.1. The Textured Plane
- 25.7. Viewpoint Creation
- 25.7.1. The FOV
- 25.7.2. Clip Distances
- 25.7.3. Adding a Spotlight
- 25.7.4. Adding an Avatar
- 25.7.5. Positioning the Viewpoint
- 25.7.6. Keyboard Controls
- 25.8. The Back Facing Camera
- 25.8.1. Adding the Second View to the GUI
- 25.9. Moving the Viewpoint
- 25.10. The Bird's-Eye View
- 25.10.1. Moving the Arrow
- 25.10.2. Rotating the Arrow
- 25.10.3. Why Not Use a Bird's-Eye Camera?
- 25.11. Related Approaches to Scene Generation
- 26. Fractal Land
- 26.1. Class Diagrams for the Fractal Land
- 26.1.1. What Is Flatness?
- 26.2. Building the Fractal Land
- 26.2.1. Linear Fog
- 26.2.2. User Controls
- 26.3. Creating the Landscape
- 26.3.1. Creating Floors
- 26.3.2. Creating Walls
- 26.3.3. On the Floor
- 26.3.4. Picking a Height
- 26.3.5. Issues with Terrain Representation
- 26.4. Constructing the Ground
- 26.4.1. Stripification
- 26.4.2. Texture Minification
- 26.4.3. Multiple Textures
- 26.5. Generating a Fractal Landscape
- 26.5.1. Printing the Mesh
- 26.5.2. Fixing the Randomness
- 26.6. Responding to Key Presses
- 26.7. Terrain Following and Collision Avoidance
- 26.8. Placing Objects in the Scene
- 26.9. Other Fractal Landscapes
- 26.1. Class Diagrams for the Fractal Land
- 27. Terrain Generation with Terragen
- 27.1. Class Diagrams for Terra3D
- 27.2. Terragen
- 27.2.1. Using Terragen
- 27.2.2. Extracting a Terragen Texture
- 27.3. Scenery Creation
- 27.3.1. Setting Up the User's Controls
- 27.4. Building the Landscape
- 27.4.1. Loading the Mesh
- 27.4.2. Placing the Terrain in the World
- 27.4.3. Adding Texture to the Terrain
- 27.5. Making 3D Scenery
- 27.5.1. Placing the Models
- 27.6. Adding Landscape Walls
- 27.6.1. A Wall as a Textured Plane
- 27.7. Creating Ground Cover
- 27.7.1. The Ground Cover
- 27.7.2. The Ground Shape
- 27.8. Moving over the Surface
- 27.8.1. Where Am I?
- 27.8.2. Strolling Around the Terrain
- 27.9. Finding the Surface Height
- 27.9.1. Picking in HeightFinder
- 27.10. Accelerating Terrain Following
- 27.10.1. More Threads?
- 27.10.2. Mesh Decomposition
- 27.11. More on Terrain Generation
- 27.11.1. DEM and Terrain Generation
- 27.11.2. ROAM
- 27.11.3. The CLOD Algorithm
- 27.11.4. Other Java 3D Projects
- 28. Trees That Grow
- 28.1. Class Diagrams for Trees3D
- 28.2. Creating the Scene
- 28.2.1. Loading Leaves
- 28.2.2. Depth-Sorting for Transparency
- 28.2.3. Getting Ready for Growth
- 28.3. Building a Tree Limb
- 28.3.1. Storing Tree Limb Information
- 28.3.2. Subgraph Creation
- 28.3.3. Scaling
- 28.3.4. Changing the Limb's Color
- 28.3.5. Leaves on Trees
- 28.4. Executing the Rules
- 28.5. Displaying Leaves
- 28.6. Comparison with L-Systems
- 28.6.1. Java 3D and L-Systems
- 28.6.2. So Why Not Use L-Systems?
- 29. Networking Basics
- 29.1. The Elements of Network Communication
- 29.1.1. Topology
- 29.1.2. Bandwidth
- 29.1.3. Latency
- 29.1.4. Reliability
- 29.1.5. Protocol
- 29.2. The Client/Server Model
- 29.3. The Peer-to-Peer Model
- 29.4. Client/Server Programming in Java
- 29.4.1. TCP Client and Sequential Server
- 29.4.1.1. Class diagrams
- 29.4.1.2. The sequential score server
- 29.4.1.3. Processing a client
- 29.4.1.4. Maintaining the scores information
- 29.4.1.5. The scores client
- 29.4.1.6. A simple alternative client
- 29.4.2. TCP Client and Multithreaded Server
- 29.4.2.1. Maintaining scores information
- 29.4.3. TCP Client and Multiplexing Server
- 29.4.3.1. The multiplexing scores server
- 29.4.3.2. Having the server accept a new client
- 29.4.3.3. Having the server accept a request from an existing client
- 29.4.3.4. Storing client information
- 29.4.3.5. Reading a message
- 29.4.3.6. Sending a message
- 29.4.3.7. Waiting to send
- 29.4.3.8. The client
- 29.4.4. UDP Client and Server
- 29.4.4.1. The UDP-based scores server
- 29.4.4.2. The UDP-based scores client
- 29.4.1. TCP Client and Sequential Server
- 29.5. P2P Programming in Java
- 29.5.1.
- 29.5.1.1. The multicasting time server
- 29.5.1.2. The multicasting time client
- 29.5.1.
- 29.6. Firewalls
- 29.6.1. Retrieving a Web Page
- 29.6.2. Proxy Authorization
- 29.6.3. A Web-Based Client and Server
- 29.6.3.1. A servlet that serves up time
- 29.6.3.2. The time client
- 29.6.4. Applets as Clients
- 29.7. Other Kinds of Java Networking
- 29.1. The Elements of Network Communication
- 30. Network Chat
- 30.1. Threaded TCP Clients and Server
- 30.1.1. The Chat Client
- 30.1.2. Showing a Message and Threads
- 30.1.3. Waiting for Chat Messages
- 30.1.4. The Chat Server
- 30.1.5. The Threaded Chat Handler
- 30.1.6. Storing Chat Client Information
- 30.1.7. The Chatter Class
- 30.1.8. Discussion
- 30.2. UDP Multicasting Clients and a Name Server
- 30.2.1. The Name Server
- 30.2.2. Improving Client Login and Logout
- 30.2.3. Multicast Chatting
- 30.2.3.1. Having the client talk to the name server
- 30.2.3.2. Having the client talk to the multicast group
- 30.2.3.3. Hearing from the multicast group
- 30.2.4. How Invisible Are Invisible Messages?
- 30.2.5. Ways to Implement who
- 30.3. Clients Using a Servlet as a Server
- 30.3.1. The URL-Based Chat Client
- 30.3.1.1. Talking to the servlet
- 30.3.2. Polling for Chat Messages
- 30.3.3. The Chat Servlet
- 30.3.3.1. Dealing with a new client
- 30.3.3.2. Processing client messages
- 30.3.4. Storing Chat Group Information
- 30.3.4.1. Adding a new client to the group
- 30.3.4.2. Reading client messages
- 30.3.5. The Chatter Class
- 30.3.1. The URL-Based Chat Client
- 30.1. Threaded TCP Clients and Server
- 31. A Networked Two-Person Game
- 31.1. The Standalone Tic-Tac-Toe Game
- 31.1.1. The Origins of the Game
- 31.1.2. Building the Game Scene
- 31.1.3. Building the Game Markers
- 31.1.4. Picking and Dragging
- 31.1.4.1. Dragging the board
- 31.1.4.2. Picking a marker
- 31.1.4.3. Picking comparisons
- 31.1.5. The Game Representation
- 31.1.5.1. Processing a selected position
- 31.1.5.2. Storing the selected position
- 31.1.5.3. Reporting a winner
- 31.2. The Networked Tic-Tac-Toe Game
- 31.2.1. Two-Person Communication Protocols
- 31.2.1.1. Initialization
- 31.2.1.2. Termination
- 31.2.1.3. Game play
- 31.2.2. Playing the Game
- 31.2.3. The Top-Level Server
- 31.2.4. The Player Handlers
- 31.2.1. Two-Person Communication Protocols
- 31.3. Comparing NetFourByFour and FourByFour
- 31.3.1. Game Initialization in the Client
- 31.3.2. Game Termination in the Client
- 31.3.2.1. The player has won
- 31.3.2.2. The close box was clicked
- 31.3.2.3. Too few players, and the game is full
- 31.3.2.4. The handler or other player has died
- 31.3.3. Game Play in the Client
- 31.3.3.1. Player 1's client
- 31.3.3.2. Server-side processing
- 31.3.3.3. Player 2's client
- 31.3.4. Writing on the Canvas
- 31.3.4.1. Mixed mode rendering
- 31.3.4.2. Drawing on the overlay canvas
- 31.1. The Standalone Tic-Tac-Toe Game
- 32. A Networked Virtual Environment
- 32.1. Background on NVEs
- 32.1.1. The Elements of an NVE
- 32.1.1.1. Spaces
- 32.1.1.2. Users
- 32.1.1.3. Objects
- 32.1.1.4. Views
- 32.1.1.5. Consistency
- 32.1.1.6. Real-time
- 32.1.1.7. Dead reckoning
- 32.1.1.8. Security
- 32.1.1.9. Scalability
- 32.1.1. The Elements of an NVE
- 32.2. An Overview of NetTour3D
- 32.2.1. Class Diagrams for NetTour3D
- 32.2.2. NetTour3D as a Simple NVE
- 32.3. Scene Creation on the Client
- 32.4. Defining Sprites
- 32.5. Local Sprites
- 32.5.1. Creating a Local Sprite
- 32.5.2. Moving and Rotating a Local Sprite
- 32.5.3. The Departure of a Local Sprite
- 32.6. Watching the Server
- 32.6.1. Creating a Distributed Sprite
- 32.6.2. The Distributed Sprites Class
- 32.6.3. Moving and Rotating a Distributed Sprite
- 32.6.4. Responding to Sprite Detail Requests
- 32.6.5. Receiving Other Client's Sprite Details
- 32.7. Server Activities
- 32.7.1. Broadcasting
- 32.7.2. Client-to-Client Message Passing
- 32.8. Other Java NVEs
- 32.8.1. The Sun Game Server
- 32.1. Background on NVEs
- A. Installation Using install4j
- A.1. install4j Versus JWS
- A.2. The Java 3D Components
- A.2.1. Java 3D Components for BugRunner
- A.2.2. j3dutils.jar on a Diet
- A.3. The BugRunner Application
- A.3.1. Preparing the JARs
- A.3.2. Testing
- A.3.3. Creating the BugRunner Installer
- A.3.4. Uninstallation
- A.3.5. The BugRunner Installer
- A.4. The Checkers3D Application
- A.4.1. Preparing the JARs
- A.4.2. Changes to Checkers3D.java
- A.4.3. Creating the Checkers3D Installer
- A.4.4. The Checkers3D Installer
- B. Installation Using Java Web Start
- B.1. JWS Benefits
- B.2. JWS Downsides
- B.3. The JNLP Deployment File
- B.4. Steps in Developing a JWS Application
- B.5. A JWS Installer for BugRunner
- B.5.1. Write the Application
- B.5.2. Modify the Application for Deployment
- B.5.3. Create a Public/Private Keypair for Signing the Application
- B.5.4. Sign Everything with the Private Key
- B.5.5. Create a Deployment File
- B.5.5.1. Deployment testing
- B.5.6. Place Everything on a Server
- B.6. A JWS Installer for Checkers3D
- B.6.1. Write the Application
- B.6.2. Modify the Application for Deployment
- B.6.3. Create a Public/Private Keypair for Signing the Application
- B.6.4. Sign Everything with the Private Key
- B.6.5. Create a Deployment File
- B.6.6. Place Everything on a Server
- B.7. Another Way to Install Checkers3D
- B.8. The JWS Portal Page
- B.8.1. Setting javawsInstalled in JavaScript
- B.8.2. The JavaScript Functions
- B.8.3. The VBScript Code
- B.8.4. More Information on Portal Pages
- B.9. Third-Party Certificates
- B.9.1. Extract a CSR
- B.9.2. Request a Certificate
- B.9.3. Import the Certificate into the Keystore
- B.9.4. Sign JARs with the Keypair
- B.10. More Information
- B.10.1. JWS and Java 3D
- B.10.2. JWS and Other Libraries
- Index
- Colophon
- SPECIAL OFFER: Upgrade this ebook with OReilly