Killer Game Programming in Java

book cover
Killer Game Programming in Java
By Andrew Davison
Publisher: O'Reilly
Pub Date: May 2005
ISBN: 0-596-00730-2
Pages: 1008

Table of Contents  | Index

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.

book cover
Killer Game Programming in Java
By Andrew Davison
Publisher: O'Reilly
Pub Date: May 2005
ISBN: 0-596-00730-2
Pages: 1008

Table of Contents  | Index

      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
      Conventions Used in This Book
      Using Code Examples
      Comments and Questions
      Safari Enabled
        Chapter 1.  Why Java for Games Programming?
      Java Is Too Slow for Games Programming
      Java Has Memory Leaks
      Java Is Too High-level
      Java Application Installation Is a Nightmare
      Java Isn't Supported on Games Consoles
      No One Uses Java to Write Real Games
      Sun Microsystems Isn't Interested in Supporting Java Gaming
        Chapter 2.  An Animation Framework
      Animation as a Threaded Canvas
      Converting to Active Rendering
      FPS and Sleeping for Varying Times
      Sleeping Better
      FPS and UPS
      Pausing and Resuming
      Other Animation Approaches
        Chapter 3.  Worms in Windows and Applets
      Preliminary Considerations
      Class Diagrams for the WormChase Application
      The Worm-Chasing Application
      The Game Panel
      Storing Worm Information
      Worm Obstacles
      Application Timing Results
      WormChase as an Applet
      Compilation in J2SE 5.0
        Chapter 4.  Full-Screen Worms
      An Almost Full-Screen (AFS) Worm
      An Undecorated Full-Screen (UFS) Worm
      A Full-Screen Exclusive Mode (FSEM) Worm
      Timings at 80 to 85 FPS
        Chapter 5.  An Introduction to Java Imaging
      Image Formats
      The AWT Imaging Model
      An Overview of Java 2D
      Buffering an Image
      Managed Images
      Java 2D Speed
      Portability and Java 2D
        Chapter 6.  Image Loading, Visual Effects, and Animation
      Loading Images
      Applying Image Effects
      Displaying Image Sequences
      Visual Effects for 'o' Images
      Packaging the Application as a JAR
        Chapter 7.  Introducing Java Sound
      Applet Playing
      The AudioClip Class
      The Sound Player
      The Java Sound API
      Sampled Audio
      Java Sound API Compared with JMF and JOAL
      Java Sound API Resources
      Audio Resources
        Chapter 8.  Loading and Playing Sounds
      Loader Design and Implementation Issues
      Testing the Loaders
      The Sounds Panel
      The Clips Loader
      Storing Clip Information
      The Midi Sequences Loader
      Storing Midi Information
      LoadersTests as a JAR File
        Chapter 9.  Audio Effects
      Audio Effects on Sampled Audio
      Audio Effects on MIDI Sequences
        Chapter 10.  Audio Synthesis
      Sampled Audio Synthesis
      MIDI Synthesis
      Audio Synthesis Libraries
        Chapter 11.  Sprites
      Bats, Balls, and Sprites
      Class Diagrams for BugRunner
      The Bug Starts Running
      The Animation Framework
      Defining a Sprite
      Coding a Sprite
      Specifying a Sprite with a Statechart
      The Ball Sprite
      Defining the Bat
        Chapter 12.  A Side-Scroller
      JumpingJack in Layers
      Class Diagrams for JumpingJack
      Start Jack Jumping
      The Animation Framework
      Managing the Ribbons
      Wraparound Ribbons
      Managing the Bricks
      Storing Brick Information
      The Fireball
      The Jumping Sprite
      Other Side-Scroller Examples
      Tiling Software
        Chapter 13.  An Isometric Tile Game
      Isometric Tiles
      Class Diagrams for AlienTiles
      The Animation Framework
      Managing the World
      Managing WorldItems
      The Tile Occupier
      A Sprite on a Tile
      The Player Sprite
      The Alien Sprite
      The Quadrant-Based Alien Sprite
      The A*-Based Alien Sprite
      Storing Tile Details
      Further Reading
        Chapter 14.  Introducing Java 3D
      Java 3D
      Java 3D Strengths
      Criticisms of Java 3D for Games Programming
      Alternatives to Java 3D
        Chapter 15.  A 3D Checkerboard: Checkers3D
      Class Diagrams for Checkers3D
      Integrating Java 3D and Swing
      Scene Graph Creation
      Floating Spheres
      The Floor
      Viewer Positioning
      Viewer Movement
      Viewing the Scene Graph
        Chapter 16.  Loading and Manipulating External Models
      An Overview of LoaderInfo3D
      Loaders in Java 3D
      Displaying a Model
      Examining a Model's Scene Graph
      Adjusting a Model's Shape Attributes
      An Overview of Loader3D
      Using Loader3D
      Creating the Scene
      Managing the Model
      Building the Model's Scene Graph
        Chapter 17.  Using a Lathe to Make Shapes
      Class Diagrams for Lathe3D
      Creating the Scene
      The Lathe Curve
      The Lathe Shape
      Subclassing the Lathe Shape
        Chapter 18.  3D Sprites
      Class Diagrams for Tour3D
      Creating the Scene
      The Basic 3D Sprite
      The User's Touring Sprite
      The Alien Sprite
      Behaviors in Java 3D
      Controlling the Touring Sprite
      Updating the Alien Sprite
        Chapter 19.  Animated 3D Sprites
      Class Diagrams for AnimTour3D
      Creating the Scene
      The Animated 3D Sprite
      Controlling the Sprite
      Animating the Sprite
      Full-Screen Exclusive Mode (FSEM)
      A Full-Screen Version of the Application
      Pros and Cons of Keyframe Animation
        Chapter 20.  An Articulated, Moveable Figure
      The Articulated Figure Application
      Forward and Inverse Kinematics
      Class Diagrams for Mover3D
      Creating the Scene
      Processing User Input
      The Commands Panel
      Making and Moving the Figure
      Modeling a Limb
      Moving a Limb
      Other Articulated Figures
      Articulation and Mesh Deformation
      Articulation and Skinning
      Articulation and Morphing
        Chapter 21.  Particle Systems
      Particle Systems in Java 3D
      Class Diagrams for Particles3D
      Creating the Scene
      A Fountain of Points
      A Fountain of Lines
      A Fountain of Quads
      Performance Results
      More Particle Systems
      Other Java 3D Approaches
      Non-Java 3D Approaches
        Chapter 22.  Flocking Boids
      A Flocking Application
      Scene Creation
      Adding Obstacles
      Types of Boids
      Grouping the Boids
      Flock Behavior
        Chapter 23.  Shooting a Gun
      Class Diagrams for Shooter3D
      Scene Creation
      The Sound of Shooting
      Picking Scene Objects
      Controlling the Gun
      Preparing the Laser Beam
      Causing an Explosion
      Picking with a Mouse Click
      Shooting Behavior
      Firing the Beam
      More on Picking
        Chapter 24.  A First-Person Shooter
      Class Diagrams for FPShooter3D
      Setting Up the Target
      Positioning and Moving the User's Viewpoint
      Initializing the User's Viewpoint
      Adding an Image to the Viewpoint
      Managing the Ammunition
      Managing a Laser Beam
      Moving the Viewpoint
        Chapter 25.  A 3D Maze
      Class Diagrams for Maze3D
      Making a Maze Plan
      The User Interface
      Managing the Maze
      Scenery Creation
      Tiling the Floor
      Viewpoint Creation
      The Back Facing Camera
      Moving the Viewpoint
      The Bird's-Eye View
      Related Approaches to Scene Generation
        Chapter 26.  Fractal Land
      Class Diagrams for the Fractal Land
      Building the Fractal Land
      Creating the Landscape
      Constructing the Ground
      Generating a Fractal Landscape
      Responding to Key Presses
      Terrain Following and Collision Avoidance
      Placing Objects in the Scene
      Other Fractal Landscapes
        Chapter 27.  Terrain Generation with Terragen
      Class Diagrams for Terra3D
      Scenery Creation
      Building the Landscape
      Making 3D Scenery
      Adding Landscape Walls
      Creating Ground Cover
      Moving over the Surface
      Finding the Surface Height
      Accelerating Terrain Following
      More on Terrain Generation
        Chapter 28.  Trees That Grow
      Class Diagrams for Trees3D
      Creating the Scene
      Building a Tree Limb
      Executing the Rules
      Displaying Leaves
      Comparison with L-Systems
        Chapter 29.  Networking Basics
      The Elements of Network Communication
      The Client/Server Model
      The Peer-to-Peer Model
      Client/Server Programming in Java
      P2P Programming in Java
      Other Kinds of Java Networking
        Chapter 30.  Network Chat
      Threaded TCP Clients and Server
      UDP Multicasting Clients and a Name Server
      Clients Using a Servlet as a Server
        Chapter 31.  A Networked Two-Person Game
      The Standalone Tic-Tac-Toe Game
      The Networked Tic-Tac-Toe Game
      Comparing NetFourByFour and FourByFour
        Chapter 32.  A Networked Virtual Environment
      Background on NVEs
      An Overview of NetTour3D
      Scene Creation on the Client
      Defining Sprites
      Local Sprites
      Watching the Server
      Server Activities
      Other Java NVEs
        Appendix A.  Installation Using install4j
      install4j Versus JWS
      The Java 3D Components
      The BugRunner Application
      The Checkers3D Application
        Appendix B.  Installation Using Java Web Start
      JWS Benefits
      JWS Downsides
      The JNLP Deployment File
      Steps in Developing a JWS Application
      A JWS Installer for BugRunner
      A JWS Installer for Checkers3D
      Another Way to Install Checkers3D
      The JWS Portal Page
      Third-Party Certificates
      More Information
      About the Author