Sunday, January 11, 2009

Game Physics Engine Development with CDROM or Pro Java 6 3D Game Development

Game Physics Engine Development with CDROM

Author: Ian Millington

Simulating physics helps cutting-edge games distinguish themselves by making virtual objects behave as we expect them to in the real world. Physics engines are the software programs that run these simulations. Building an engine is difficult, however. There are a large number of new developers (and hobbyists) coming into this market who need help through this complex process. Current introductory books are inadequate; they don't bring enough real-world programming experience to the task. There is a need for an introductory book on game physics with solid coding guidance but which limits the math content. Ian Millington brings his extensive professional programming experience to this problem. He has developed games since 1987, has studied AI and mathematics at the PhD level, and founded Mindlathe Ltd., a company that designed and built commercial physics engines. Physics Engine Development carefully describes each step in the creation of a robust, usable physics engine. It introduces the mathematical concepts in a clear and simple manner, keeping to high school level topics and building a physics code library as it goes. Each new concept is explained in diagrams and code to make sure that even the most novice of game programmers understands. The companion CD-ROM includes the source code for a complete physics engine of commercial quality. This book will serve as a introduction to more mathematically advanced books on game physics, such as Dave Eberly's Game Physics.

* Uses only high school algebra
* Shows how to build a complete system based on professional principles
* CD-ROM with C++ source code for a full commercial-quality physics engine



Interesting textbook: Community Nutrition in Action or Mapping the Social Landscape

Pro Java 6 3D Game Development: Java 3D, JOGL, JInput and JOAL

Author: Andrew Davison

Create strange lands filled with mysterious objects (cows frozen in blocks of ice, chirping penguins, golden globes with wavering eyes) and throw away your keyboard and mouse, to go exploring armed only with a gamepad, power glove, or just your bare hands...

Java gaming expert Andrew Davison will show you how to develop and program 3D games in Java(tm) technology on a PC, with an emphasis on the construction of 3D landscapes. It's assumed you have a reasonable knowledge of Java - the sort of thing picked up in a first Java course at school.

Topics are split into three sections: Java 3D(tm) API, non-standard input devices for game playing, and JOGL. Java 3D is a high-level 3D graphics API, and JOGL is a lower-level Java wrapper around the popular OpenGL graphics API.

You'll look at three non-standard input devices: the webcam, the game pad, and the P5 data glove.

Along the way, you'll utilize several other games-related libraries including: JInput, JOAL, JMF, and Odejava.

Learn all the latest Java SE 6 features relevant to gaming, including: splash screens, JavaScript(tm) scripting as well as the desktop and system tray interfaces.

Unique coverage of Java game development using both the Java 3D API and Java for OpenGL, as well as invaluable experience from a recognized Java gaming guru, will provide you with a distinct advantage after reading this book.



Table of Contents:
About the Author     xix
About the Technical Reviewers     xxi
Acknowledgments     xxiii
Introduction     xxv
Java 3D
Introducing Java 3D     3
Overview of Java 3D     3
Overview of the Scene Graph     4
Some Java 3D Scene Graph Nodes     5
The HelloUniverse Scene Graph     5
Java 3D Strengths     7
The Scene Graph     7
Performance     7
Unique Features     8
Java Integration     8
Documentation and Examples     8
Criticisms of Java 3D for Games Programming     9
Java 3D's Level of Abstraction     9
Java 3D Games     10
Java 3D Support     12
Alternatives to Java 3D     13
Summary     14
Get a Life (in 3D)     15
The Game of Life     15
Running Life3D     16
Configuring Life3D     16
A Life3D Screensaver     17
An Overview of the Life3D Classes     18
Deciding How to Start     19
Displaying the 3D Game     20
Integrating Java 3D and Swing     20
WindowSizing     21
Processing Key Presses     21
Scene Graph Creation     22
Lighting the Scene     24
The Scene's Background     24
Building the Cells Grid and Making It Behave     25
Viewer Positioning     25
Viewer Movement     27
Behaviors in Java 3D     27
A Time-Based Behavior     29
Managing the Grid     29
Accessing Properties     30
Creating the Grid Scene Graph     31
Updating the Cells States     33
Will the Cell Live or Die?     34
Rotating the Grid     36
The Cell     37
Building the Cell's Scene Graph     39
Coloring the Cells     41
Setting the Cell's Visibility     42
Changing a Cell's Life State     43
Visual Changes to a Cell     44
Time for Screensavers     45
Changing Life3D into a Screensaver     46
Problems with Screensavers     47
The SaverBeans SDK     47
More Life Required?     47
Summary     48
Get a Life (the Java 6 Way)     49
Life3D Basics     49
An Overview of the Life3D Classes     50
Making a Splash     52
Animating a Clock     53
Drawing onto a Splash     54
Drawing the Clocks     54
JAR Packaging     55
Adding ClockAnimation to Life3D     55
The Desktop API     56
Using the Desktop Browser     56
What Other Browser Capabilities Are There?     57
The System Tray     57
Creating Life3D's Popup Menu     58
The Menu Contents     58
Creating the Traylcon     59
Building the Popup Menu     60
Listening for Actions     62
Using a Text Editor     64
Launching an E-mail Client     65
Listening for the Check Boxes     66
Scripting in Java SE 6     67
Executing a Script     68
Communicating with a Script     69
Speeding Things Up     72
Calling Script Functions     73
Letting a Script Use Java     74
More Scripting Information     74
Scripting in Life3D     74
Initializing the Grid     75
Changing the Grid's State     76
Executing the Script Rules      78
The Rules Script     80
Summary     81
The Colliding Grabbers     83
Building Articulated Arms     83
Class Diagrams for Arms3D     84
Creating the Application Window     85
Drawing the 3D Scene     86
Processing the Keys     88
Monitoring Grabber Joints     89
Managing the Grabbers     90
Adding the Grabbers to the Scene Graph     90
Processing Keyboard Commands     93
Translating the Grabbers     94
Rotating a Grabber Joint     95
Collecting the Collision Joints     96
Collision Detection and Recovery     97
Why Bother with JointsBehavior?     97
Touching the Floor     98
The Grabber     98
Making the Grabber's Appearance     98
The Grabber Shape     100
Local and Global Coordinate Systems     105
Making the Fingers     106
Handling Rotation Commands     108
Collision Detection     110
Implementing Collision Detection     111
Initializing the Bounding Spheres     114
Positioning the Bounding Spheres      114
Touching the Ground     115
The Floor     116
The Colored Tiles     118
The Floor's Axes Labels     119
Summary     120
When Worlds Collide     121
Odejava and ODE     121
Installing Odejava     123
Documentation, Examples, and Online Help     123
Bouncing a Ball     124
Three-Stage Simulation     125
Initializing the Engines     126
Initializing Static Objects     126
Initializing Dynamic Objects     127
Executing the Simulation     127
Performing a Simulation Step     128
Examining the Contact Points     129
Cleaning Up     129
Visualizing Balls in a Box     129
Creating the Scene     131
The Box     133
Managing the Spheres     137
A Sphere     139
I'm Steppin' Out     142
A Note of Application Development     143
Summary     144
A Multitextured Landscape     145
Surveying the Landscape     145
Building the Scene     147
Creating the Floor     149
Start the Balls Moving     150
Moving Around the Scene     150
The Multitextured Floor     150
Heights Map Generation     153
The Floor's Geometry     155
The Floor's Appearance     158
The Splash Shape     162
The Splash Shape's Geometry     163
The Splash Shape's Appearance     166
Moving Balls     170
Positioning the Ball     173
Moving About     174
Driving the Balls     176
More Multitexturing     176
Bump Mapping     176
Shaders     177
Summary     177
Walking Around the Models     179
Populating a Scene     179
Class Diagrams for ObjView3D     180
A Spherical Background     181
A Skybox Background     182
A Skybox Built with Quads     183
Terragen and NConvert     184
From Images to Textures     185
Making the Skybox     186
Texturing a Plane     187
The Size of the Skybox     188
Loading Models     189
Loading OBJ Models     189
The OBJ Model Loader      190
Positioning a Model     193
Ground Cover     195
Manipulating the User's Viewpoint     197
Positioning the User's Viewpoint     198
Moving the Viewpoint at Runtime     198
Setting Up the Key Behavior     199
Processing a Key     199
Summary     201
More Backgrounds and Overlays     203
Retained, Immediate, and Mixed Modes     203
The Earth, Moon, and Mars     204
Building the Scene     206
The Background     209
Some Variations on a Theme     209
Spinning the Background     212
Building the Scene and Terminating     213
Rotating the Image     214
Manipulating the Image     215
Rotation and Clipping     215
Avoiding Gaps in the Rotated Image     216
Terminating the Thread     218
Drawing the Background Image     218
The Model Viewer with a Shifting Background and Overlays     219
Setting Up the Canvas     221
Modifying the Key Behavior     222
A Canvas with a Background and Overlays     223
Drawing the Background     225
The Deep Blue Sea      227
Adding Overlays     228
Summary     229
Nonstandard Input Devices
Webcam Snaps     233
Webcam Snaps with TWAIN     233
Displaying Pictures Using TWAIN     234
Snapping a Picture Again and Again and...     235
The TWAIN Capture Device     237
TWAIN Timing Tests     240
Webcam Snaps with JMF     241
Again Taking Pictures Again and Again     242
The Capture Device with JMF     243
Comparing TWAIN and JMF Capture     247
QTJ     247
Other Uses for Webcam Snaps     248
Summary     249
Navigating a 3D Scene by Waving Your Arm     251
Using the Wrist Strap     251
Image Processing     253
Image Processing Issues     254
Dealing with the Issues     254
Finding the Bands     255
FindBands Class Diagrams     256
Image Processing Overview     257
The Bands Analyzer     257
The Band Manager     263
Representing a Blob     265
Arm Navigation     266
Creating the 3D Scene     267
Moving the User's Viewpoint     268
From Analysis to Action     269
Other Approaches     270
JAI     270
ImageJ     271
Image Processing Books     271
Summary     271
Building a Gamepad Controller with JInput     273
JInput     273
The Gamepad and Windows     274
Installing and Testing JInput     276
Examining the Input Devices     277
The Other JInput Test Applications     279
Three JInput Applications     280
Listing the Controllers     281
Viewing Controller Details     281
Testing a Controller     286
A Gamepad Controller     287
Initializing the Controller     289
Checking the Components     290
Finding the Rumblers     292
Polling the Device     292
Reading the Stick Axes     293
Reading the POV Hat     294
Reading the Buttons     295
Using the Rumbler     296
Other Approaches     296
Swing and JInput     297
Constructing the Application     298
Polling the Gamepad     299
Alternatives to JInput     300
Summary     301
Gamepad Grabbers     303
Example Overview     303
Playing Sounds     305
Background Music with SoundsPlayer     307
Obstacle Noises with SoundsPlayer     307
Managing Obstacles     308
Making an Obstacle     309
Making the Boxes     310
Collision Detection     311
Sending Input to the Grabbers     312
Processing Keyboard Input     313
Building a Grabber Operation for a Key Press     314
Processing Gamepad Input     316
Building a Grabber Operation for the Gamepad     318
The Grabbers     319
Connecting the Grabbers to the Camera     319
Constructing the Grabbers     320
Processing an Operation     321
The Grabber Arms     326
Summary     326
3D Sound with JOAL     327
Why JOAL and Java 3D?     327
Background on OpenAL and JOAL     328
What About JOAL?     328
Installing JOAL     329
Managing JOAL Sounds     330
Initializing JOAL     330
Initializing the Listener      331
JOAL Clean Up     333
Loading a Sound     333
Positioning a Source     336
Playing, Stopping, and Pausing a Source     337
Moving the Listener     337
Turning the Listener     338
Using JOALSoundMan     340
Moving a Source     340
Moving the Listener     341
Moving the Listener Between Sources     342
Turning the Listener     343
JOAL and Swing     344
Other Source Types     346
Ambient Sounds     346
Cone Sounds     346
Summary     347
The P5 Glove     349
Introducing the P5 Glove     349
Using Kenner's Java API     351
Examining the Glove's Data     352
What ShowGlove Displays     353
ShowGlove Overview     355
Initializing and Terminating the Glove     356
Polling the Glove     356
The Glove     357
Updating and Accessing the Glove     358
Closing Down     359
A Specialized Glove Class     359
Initializing the Glove     360
Updating and Closing      360
Getting the Position     360
On a Roll     361
Clenching My Fist     362
Pressing the A Button     362
A Test Rig for FPSGlove     363
Visiting the Musical Cow     365
The Glove Behavior     366
Adding a Musical Cow     370
Initializing the Viewpoint     371
Cleaning Up     371
The P5 Glove and JInput     372
Summary     373
JOGL
Two JOGL Programming Frameworks     377
What Is JOGL?     377
Installing JOGL     378
The Callback Framework     379
Using GLCanvas     379
Using GLJPanel     380
Rotating a GLCanvas Cube with Callbacks     381
Building the Top-Level Window     382
Connecting the Canvas     383
Building the Listener     383
Measuring FPS Accuracy     388
Rotating a GLJPanel Cube with Callbacks     389
Building the Panels     391
The Background Panel     391
Making the 3D Background Transparent     392
Timing the GLJPanel     393
More Visual Effects with GLJPanel      393
Callback Summary     393
The Active Rendering Framework     393
Rotating a Cube with Active Rendering     395
Building the Application     396
Dealing with Window Events     397
Preparing the Canvas     397
Thread Rendering     398
The Game Life Cycle Methods     404
Statistics Reporting     405
Java 3D and JOGL     405
More Information on JOGL and OpenGL     406
Summary     407
Touring the World     409
Application Details     409
Constructing the Canvas     411
The Camera Position     412
Responding to Key Presses     413
Let the Rendering Commence     416
Rendering Initialization     417
Loading Textures     418
Lighting the Scene     419
Creating the Ground Shapes     420
The Rendering Loop     421
Updating the Game     421
Rendering the Scene     423
Drawing the Tree Billboard     423
Drawing the Ground Shapes     426
The Planet Earth     428
The Skybox     430
Adding a 2D Overlay      433
Drawing the Floor     435
Drawing the Tiles     435
Drawing the Axes     437
Summary     438
Loading Models     439
Overviews of the Examples     439
The OBJ File Format     442
Shape Statements     442
Grouping Statements     443
Material Use Statements     443
The MTL File Format     443
The OBJ File Loader     444
Reading in the OBJ File     446
Reading a Face     447
Reading in an MTL File     449
Recording Material Use     450
Centering and Resizing a Model     451
Creating a Display List for the Model     452
Finding a Material     452
Rendering with a Material     453
Rendering a Face     455
Drawing a Model     457
When to Create the Display List     457
Viewing a Model     457
Loading the Model     458
Drawing the Model     459
Other JOGL Model Loaders     459
The TourModelsGL Appiication     460
Adding Models     461
Let's Be Picky      463
Gleem: A Different Way of Picking     469
A Singing Penguin     470
The Fog Descends     471
Summary     473
Index     475

No comments:

Post a Comment