| Foreword | xiv |
| Introduction | xviii |
| Chapter 1 | The Unique World of Game Programming | 1 |
| The Good | 2 |
| The Bad | 9 |
| The Ugly | 13 |
| It's All Worth It, Right? | 17 |
| Chapter 2 | What's in a Game? | 19 |
| Game Architecture | 20 |
| Applying the Game Architecture | 22 |
| Application Layer | 24 |
| Game Logic | 29 |
| Game View for the Human Player | 34 |
| Game Views for AI Agents | 39 |
| Networked Game Architecture | 40 |
| Do I Have to Use DirectX? | 42 |
| Other Bits and Pieces | 47 |
| Chapter 3 | Coding Tidbits and Style That Saved My Butt | 49 |
| Smart Design Practices | 50 |
| Smart Pointers and Naked Pointers | 58 |
| Using Memory Correctly | 63 |
| Mike's Grab Bag of Useful Stuff | 76 |
| Developing the Style That's Right for You | 90 |
| Chapter 4 | Building Your Game | 91 |
| A Little Motivation | 91 |
| Creating a Project | 92 |
| Source Code Repositories and Version Control | 100 |
| Building the Game: A Black Art? | 108 |
| Creating Build Scripts | 111 |
| Multiple Projects and Shared Code | 115 |
| Chapter 5 | Game Initialization | 119 |
| Initialization 101 | 120 |
| Some C++ Initialization Pitfalls | 120 |
| The Game's Application Layer | 126 |
| Stick the Landing: A Nice Clean Exit | 148 |
| Getting In and Getting Out | 156 |
| Chapter 6 | Controlling the Main Loop | 159 |
| Inside the Main Loop | 159 |
| A Base Class for Game Logic | 181 |
| Can I Make a Game Yet? | 183 |
| Chapter 7 | Loading and Caching Game Data | 185 |
| Game Resources: Formats and Storage Requirements | 186 |
| Resource Files | 198 |
| The Resource Cache | 212 |
| World Design and Cache Prediction | 223 |
| I'm Out of Cache | 227 |
| Chapter 8 | Programming Input Devices | 229 |
| Getting the Device State | 229 |
| A Few Safety Tips | 235 |
| Working with the Mouse (and Joystick) | 238 |
| Working with a Game Controller | 244 |
| Working with the Keyboard | 251 |
| What, No Dance Pad? | 256 |
| Chapter 9 | User Interface Programming | 259 |
| The Human's Game View | 260 |
| More Control Properties | 286 |
| Some Final User Interface Tips | 287 |
| Chapter 10 | Programming Sprites and Fonts | 289 |
| The Art of 2D Drawing with DirectX | 289 |
| 2D Drawing Under DirectDraw | 296 |
| 2D Drawing in a 3D World with DirectX 9 | 312 |
| Graphics Files Formats | 337 |
| Conclusion | 338 |
| Chapter 11 | Game Events and Scripting Languages | 341 |
| Game Events | 342 |
| Game Scripting Languages | 372 |
| SendEvent("chapter_done") | 383 |
| Chapter 12 | Game Audio | 385 |
| How Sound Works | 385 |
| Game Sound System Architecture | 391 |
| Other Technical Hurdles | 424 |
| Some Random Notes | 429 |
| The Last Dance | 434 |
| 3D Graphics Pipeline | 435 |
| Chapter 13 | 3D Basics | 435 |
| 3D Math 101 | 436 |
| Enough Math-Please Stop | 458 |
| 3D Graphics-It's Just the Beginning | 476 |
| Chapter 14 | 3D Scenes | 477 |
| C++ Math Classes | 477 |
| Scene Graph Basics | 490 |
| What's Missing? | 533 |
| 3D Engines That the Games Industry Uses | 534 |
| Still Hungry? | 538 |
| Chapter 15 | Collision and Simple Physics | 539 |
| Mathematics for Physics Refresher | 540 |
| Choosing a Physics SDK | 547 |
| Object Properties | 549 |
| Collision Hulls | 550 |
| Using a Collision System | 556 |
| Integrating a Physics SDK | 558 |
| But Wait, There's So Much More | 581 |
| Chapter 16 | Network Programming for Multiplayer Games | 583 |
| How the Internet Works | 583 |
| Making a Multiplayer Game with Sockets | 603 |
| Gosh, If It's That Easy | 636 |
| Chapter 17 | Special Consideration for Developing Windows Games | 637 |
| What About Microsoft Foundation Classes (MFC)? | 639 |
| What About C#? | 642 |
| Windowed Mode and Full-Screen Mode | 643 |
| Operating System Specific Stuff | 657 |
| "Designed for Windows XP" Logo Program | 660 |
| Conclusion | 687 |
| Chapter 18 | Debugging Your Game | 689 |
| The Art of Handling Failure | 690 |
| Debugging Basics | 692 |
| Debugging Techniques | 707 |
| Different Kinds of Bugs | 723 |
| Parting Thoughts | 734 |
| Chapter 19 | A Game of Teapot Wars! | 735 |
| Game Actors | 737 |
| Game Events | 740 |
| The Game Logic | 745 |
| The Game View for a Human Player | 756 |
| The AI View and Listener | 770 |
| The Rest Is Up to You | 774 |
| Chapter 20 | The Art of Scheduling | 775 |
| Good Schedules, Bad Schedules | 776 |
| The Key to All Schedules: Milestones | 777 |
| Things to Know Before Scheduling Begins | 790 |
| Creating the Schedule | 796 |
| Getting It Right | 809 |
| Chapter 21 | Everything (You Hate) to Know About Testing | 811 |
| Why Are Games Buggy? | 811 |
| Test Plans | 814 |
| Scheduling Testing | 825 |
| Automated Testing | 826 |
| The Bug Database | 835 |
| Which Bugs Get Fixed? | 846 |
| Statistical Analysis of Your Bug Database | 851 |
| The Testing Team | 854 |
| The Public Beta | 855 |
| A Final Word | 857 |
| Chapter 22 | Driving to the Finish | 859 |
| Finishing Issues | 860 |
| Dealing with Big Trouble | 869 |
| The Light-It's Not a Train After All | 880 |
| Index | 885 |