Synopses & Reviews
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.
About the Author
Andrew Davison received his Ph.D. from Imperial College in London in 1989. He was a lecturer at the University of Melbourne for six years before moving to Prince of Songkla University in Thailand in 1996. He has also taught in Bangkok, Khon Kaen, and Hanoi. His research interests include scripting languages, logic programming, visualization, and teaching methodologies. This latter topic led to an interest in teaching games programming in 1999. His O'Reilly book, "Killer Game Programming in Java", was published in 2005.
Table of Contents
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; Conventions Used in This Book; Using Code Examples; Comments and Questions; Safari Enabled; Acknowledgments; Chapter 1: Why Java for Games Programming?; 1.1 Java Is Too Slow for Games Programming; 1.2 Java Has Memory Leaks; 1.3 Java Is Too High-level; 1.4 Java Application Installation Is a Nightmare; 1.5 Java Isn't Supported on Games Consoles; 1.6 No One Uses Java to Write Real Games; 1.7 Sun Microsystems Isn't Interested in Supporting Java Gaming; Chapter 2: An Animation Framework; 2.1 Animation as a Threaded Canvas; 2.3 Converting to Active Rendering; 2.4 FPS and Sleeping for Varying Times; 2.5 Sleeping Better; 2.6 FPS and UPS; 2.7 Pausing and Resuming; 2.8 Other Animation Approaches; Chapter 3: Worms in Windows and Applets; 3.1 Preliminary Considerations; 3.2 Class Diagrams for the WormChase Application; 3.3 The Worm-Chasing Application; 3.4 The Game Panel; 3.5 Storing Worm Information; 3.6 Worm Obstacles; 3.7 Application Timing Results; 3.8 WormChase as an Applet; 3.9 Compilation in J2SE 5.0; Chapter 4: Full-Screen Worms; 4.1 An Almost Full-Screen (AFS) Worm; 4.2 An Undecorated Full-Screen (UFS) Worm; 4.3 A Full-Screen Exclusive Mode (FSEM) Worm; 4.4 Timings at 80 to 85 FPS; Chapter 5: An Introduction to Java Imaging; 5.1 Image Formats; 5.2 The AWT Imaging Model; 5.3 An Overview of Java 2D; 5.4 Buffering an Image; 5.5 Managed Images; 5.6 VolatileImage; 5.7 Java 2D Speed; 5.8 Portability and Java 2D; 5.9 JAI; Chapter 6: Image Loading, Visual Effects, and Animation; 6.1 ; 6.2 Loading Images; 6.3 Applying Image Effects; 6.4 Displaying Image Sequences; 6.5 Visual Effects for 'o' Images; 6.6 Packaging the Application as a JAR; Chapter 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.6 MIDI; 7.7 Java Sound API Compared with JMF and JOAL; 7.8 Java Sound API Resources; 7.9 Audio Resources; Chapter 8: Loading and Playing Sounds; 8.1 Loader Design and Implementation Issues; 8.2 Testing the Loaders; 8.3 The Sounds Panel; 8.4 The Clips Loader; 8.5 Storing Clip Information; 8.6 The Midi Sequences Loader; 8.7 Storing Midi Information; 8.8 LoadersTests as a JAR File; Chapter 9: Audio Effects; 9.1 Audio Effects on Sampled Audio; 9.2 Audio Effects on MIDI Sequences; Chapter 10: Audio Synthesis; 10.1 Sampled Audio Synthesis; 10.2 MIDI Synthesis; 10.3 Audio Synthesis Libraries; Chapter 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.5 Defining a Sprite; 11.6 Coding a Sprite; 11.7 Specifying a Sprite with a Statechart; 11.8 The Ball Sprite; 11.9 Defining the Bat; Chapter 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.5 Managing the Ribbons; 12.6 Wraparound Ribbons; 12.7 Managing the Bricks; 12.8 Storing Brick Information; 12.9 The Fireball; 12.10 The Jumping Sprite; 12.11 Other Side-Scroller Examples; 12.12 Tiling Software; Chapter 13: An Isometric Tile Game; 13.1 Isometric Tiles; 13.2 Class Diagrams for AlienTiles; 13.3 The Animation Framework; 13.4 Managing the World; 13.5 Managing WorldItems; 13.6 The Tile Occupier; 13.7 A Sprite on a Tile; 13.8 The Player Sprite; 13.9 The Alien Sprite; 13.10 The Quadrant-Based Alien Sprite; 13.11 The A*-Based Alien Sprite; 13.12 Storing Tile Details; 13.13 Further Reading; Chapter 14: Introducing Java 3D; 14.1 Java 3D; 14.2 Java 3D Strengths; 14.3 Criticisms of Java 3D for Games Programming; 14.4 Alternatives to Java 3D; Chapter 15: A 3D Checkerboard: Checkers3D; 15.1 Class Diagrams for Checkers3D; 15.2 Integrating Java 3D and Swing; 15.3 Scene Graph Creation; 15.4 Floating Spheres; 15.5 The Floor; 15.6 Viewer Positioning; 15.7 Viewer Movement; 15.8 Viewing the Scene Graph; Chapter 16: Loading and Manipulating External Models; 16.1 An Overview of LoaderInfo3D; 16.2 Loaders in Java 3D; 16.3 Displaying a Model; 16.4 Examining a Model's Scene Graph; 16.5 Adjusting a Model's Shape Attributes; 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; Chapter 17: Using a Lathe to Make Shapes; 17.1 Class Diagrams for Lathe3D; 17.2 Creating the Scene; 17.3 The Lathe Curve; 17.4 The Lathe Shape; 17.5 Subclassing the Lathe Shape; Chapter 18: 3D Sprites; 18.1 Class Diagrams for Tour3D; 18.2 Creating the Scene; 18.3 The Basic 3D 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.8 Updating the Alien Sprite; Chapter 19: Animated 3D Sprites; 19.1 ; 19.2 Class Diagrams for AnimTour3D; 19.3 Creating the Scene; 19.4 The Animated 3D Sprite; 19.5 Controlling the Sprite; 19.6 Animating the Sprite; 19.7 Full-Screen Exclusive Mode (FSEM); 19.8 A Full-Screen Version of the Application; 19.9 Pros and Cons of Keyframe Animation; Chapter 20: An Articulated, Moveable Figure; 20.1 The Articulated Figure Application; 20.2 Forward and Inverse Kinematics; 20.3 Class Diagrams for Mover3D; 20.4 Creating the Scene; 20.5 Processing User Input; 20.6 The Commands Panel; 20.7 Making and Moving the Figure; 20.8 Modeling a Limb; 20.9 Moving a Limb; 20.10 Other Articulated Figures; 20.11 Articulation and Mesh Deformation; 20.12 Articulation and Skinning; 20.13 Articulation and Morphing; Chapter 21: Particle Systems; 21.1 Particle Systems in Java 3D; 21.2 Class Diagrams for Particles3D; 21.3 Creating the Scene; 21.4 A Fountain of Points; 21.5 A Fountain of Lines; 21.6 A Fountain of Quads; 21.7 Performance Results; 21.8 More Particle Systems; 21.9 Other Java 3D Approaches; 21.10 Non-Java 3D Approaches; Chapter 22: Flocking Boids; 22.1 A Flocking Application; 22.2 Scene Creation; 22.3 Adding Obstacles; 22.4 Types of Boids; 22.5 Grouping the Boids; 22.6 Flock Behavior; Chapter 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.5 Controlling the Gun; 23.6 Preparing the Laser Beam; 23.7 Causing an Explosion; 23.8 Picking with a Mouse Click; 23.9 Shooting Behavior; 23.10 Firing the Beam; 23.11 More on Picking; Chapter 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.4 Initializing the User's Viewpoint; 24.5 Adding an Image to the Viewpoint; 24.6 Managing the Ammunition; 24.7 Managing a Laser Beam; 24.8 Moving the Viewpoint; Chapter 25: A 3D Maze; 25.1 Class Diagrams for Maze3D; 25.2 Making a Maze Plan; 25.3 The User Interface; 25.4 Managing the Maze; 25.5 Scenery Creation; 25.6 Tiling the Floor; 25.7 Viewpoint Creation; 25.8 The Back Facing Camera; 25.9 Moving the Viewpoint; 25.10 The Bird's-Eye View; 25.11 Related Approaches to Scene Generation; Chapter 26: Fractal Land; 26.1 Class Diagrams for the Fractal Land; 26.2 Building the Fractal Land; 26.3 Creating the Landscape; 26.4 Constructing the Ground; 26.5 Generating a Fractal Landscape; 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; Chapter 27: Terrain Generation with Terragen; 27.1 Class Diagrams for Terra3D; 27.2 Terragen; 27.3 Scenery Creation; 27.4 Building the Landscape; 27.5 Making 3D Scenery; 27.6 Adding Landscape Walls; 27.7 Creating Ground Cover; 27.8 Moving over the Surface; 27.9 Finding the Surface Height; 27.10 Accelerating Terrain Following; 27.11 More on Terrain Generation; Chapter 28: Trees That Grow; 28.1 Class Diagrams for Trees3D; 28.2 Creating the Scene; 28.3 Building a Tree Limb; 28.4 Executing the Rules; 28.5 Displaying Leaves; 28.6 Comparison with L-Systems; Chapter 29: Networking Basics; 29.1 The Elements of Network Communication; 29.2 The Client/Server Model; 29.3 The Peer-to-Peer Model; 29.4 Client/Server Programming in Java; 29.5 P2P Programming in Java; 29.6 Firewalls; 29.7 Other Kinds of Java Networking; Chapter 30: Network Chat; 30.1 Threaded TCP Clients and Server; 30.2 UDP Multicasting Clients and a Name Server; 30.3 Clients Using a Servlet as a Server; Chapter 31: A Networked Two-Person Game; 31.1 The Standalone Tic-Tac-Toe Game; 31.2 The Networked Tic-Tac-Toe Game; 31.3 Comparing NetFourByFour and FourByFour; Chapter 32: A Networked Virtual Environment; 32.1 Background on NVEs; 32.2 An Overview of NetTour3D; 32.3 Scene Creation on the Client; 32.4 Defining Sprites; 32.5 Local Sprites; 32.6 Watching the Server; 32.7 Server Activities; 32.8 Other Java NVEs; Appendix A: Installation Using install4j; A.1 install4j Versus JWS; A.2 The Java 3D Components; A.3 The BugRunner Application; A.4 The Checkers3D Application; Appendix 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.6 A JWS Installer for Checkers3D; B.7 Another Way to Install Checkers3D; B.8 The JWS Portal Page; B.9 Third-Party Certificates; B.10 More Information; Colophon;