O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Game Coding Complete, Third Edition

Book Description

Welcome to Game Coding Complete, Third Edition, the newest edition of the essential, hands-on guide to developing commercial-quality games. Written by a veteran game programmer, the book examines the entire game development process and all the unique challenges associated with creating a game. An excellent introduction to game architecture, you'll explore all the major subsystems of modern game engines and learn professional techniques used in actual games. This third edition features expanded content and coverage of the latest and most exciting new game programming techniques including AI, multiprogramming, working with scripting languages such as Lua, and writing C# tools like your level editor. All the code and examples presented have been tested and used in commercial video games, and the book is full of invaluable best practices, professional tips and tricks, and cautionary advice.

Table of Contents

  1. Copyright
  2. Kudos
  3. Foreword
  4. Acknowledgments
  5. Contributor Acknowledgments
  6. About the Author
  7. Introduction
  8. Game Programming Fundamentals
    1. What Is Game Programming Really Like?
      1. The Good
      2. The Bad
      3. The Ugly
      4. It’s All Worth It, Right?
    2. What’s in a Game?
      1. Game Architecture
      2. Applying the Game Architecture
      3. Application Layer
      4. Game Logic
      5. Game View for the Human Player
      6. Game Views for AI Agents
      7. Networked Game Architecture
      8. Do I Have to Use DirectX?
      9. Other Bits and Pieces
      10. Further Reading
    3. Coding Tidbits and Style That Will Save You
      1. Smart Design Practices
      2. Smart Pointers and Naked Pointers
      3. Using Memory Correctly
      4. Mike’s Grab Bag of Useful Stuff
      5. Developing the Style That’s Right for You
      6. Further Reading
    4. Building Your Game
      1. A Little Motivation
      2. Creating a Project
      3. Source Code Repositories and Version Control
      4. Building the Game: A Black Art?
      5. Creating Build Scripts
      6. Multiple Projects and Shared Code
      7. Some Parting Advice
  9. Get Your Game Running
    1. Game Initialization and Shutdown
      1. Initialization 101
      2. Some C++ Initialization Pitfalls
      3. The Game’s Application Layer
      4. Stick the Landing: A Nice Clean Exit
      5. Getting In and Getting Out
    2. Controlling the Main Loop
      1. Inside the Main Loop
      2. A Base Class for Game Actors and Game Logic
      3. Can I Make a Game Yet?
    3. Loading and Caching Game Data
      1. Game Resources: Formats and Storage Requirements
      2. Resource Files
      3. The Resource Cache
      4. I’m Out of Cache
    4. Programming Input Devices
      1. Getting the Device State
      2. Using DirectInput
      3. A Few Safety Tips
      4. Working with the Mouse (and Joystick)
      5. Working with a Game Controller
      6. Working with the Keyboard
      7. What, No Dance Pad?
    5. User Interface Programming
      1. The Human’s Game View
      2. A WASD Movement Controller
      3. Screen Elements
      4. A Custom MessageBox Dialog
      5. Modal Dialog Boxes
      6. Controls
      7. Control Identification
      8. Hit Testing and Focus Order
      9. Control State
      10. More Control Properties
      11. Some Final User Interface Tips
  10. Core Game Technologies
    1. Game Event Management
      1. Game Events
      2. What Game Events Are Important?
      3. Distinguishing Events from Processes
      4. Further Reading
    2. Scripting with Lua
      1. What is Scripting?
      2. Common Scripting Paradigms
      3. Introducing Lua
      4. Getting Started with a Lua Wrapper—LuaPlus
      5. Mind the Gap!
      6. Wanna Buy a Bridge?
      7. I’m Totally Wired
      8. Do You Hear What I Hear?
      9. Let’s Get OOP-Able!
      10. Debugging Script
      11. Famous Last Words: “An Exercise for the Reader”
      12. References
    3. Game Audio
      1. How Sound Works
      2. Game Sound System Architecture
      3. Other Technical Hurdles
      4. Some Random Notes
      5. The Last Dance
    4. 3D Basics
      1. 3D Graphics Pipeline
      2. 3D Math 101
      3. C++ Math Classes
      4. Enough Math—Please Stop
      5. 3D Graphics—It’s Just the Beginning
    5. 3D Scenes
      1. The Plane Class
      2. The Frustum Class
      3. Scene Graph Basics
      4. Special Scene Graph Nodes
      5. What About Shaders?
      6. What’s Missing?
      7. Still Hungry?
      8. Further Reading
    6. Collision and Simple Physics
      1. Mathematics for Physics Refresher
      2. Choosing a Physics SDK
      3. Object Properties
      4. Collision Hulls
      5. Using a Collision System
      6. Integrating a Physics SDK
      7. But Wait, There’s So Much More
    7. Network Programming Primer
      1. How the Internet Works
      2. Sockets API
      3. Making a Multiplayer Game with Sockets
      4. Core Client-Side Classes
      5. Core Server-Side Classes
      6. Wiring Sockets into the Event System
      7. Gosh, if It’s That Easy
  11. Advanced Topics and Bringing IT All Together
    1. An Introduction to Game AI
      1. Intro to AI concepts
      2. Movement
      3. Path Finding
      4. Simple Decision Making
      5. Advanced Decision Making
      6. Types of Game AI
      7. Further Reading
    2. Introduction to Multiprogramming
      1. What Multiprogramming Does
      2. Creating Threads
      3. Process Synchronization
      4. Interesting Threading Problems
      5. Thread Safety
      6. Multithreading Classes
      7. Background Decompression of a ZIP File
      8. Further Work
      9. About the Hardware
      10. About the Future
    3. A Game of Teapot Wars!
      1. Game Actors
      2. Game Events
      3. The Application Layer
      4. The Game Logic
      5. The Game View for a Human Player
      6. The AI View and Listener
      7. More Teapot Wars, if You Are Willing
    4. A Simple Game Editor in C#
      1. What Should a Level Editor Do?
      2. The Editor Architecture
      3. Creating the DLL
      4. The C# Editor Application
      5. Getting Information About Actors in the Level
      6. Creating, Changing, and Removing Actors
      7. Saving and Loading Levels
      8. Future Work
      9. Special Thanks
      10. Further Reading
    5. Debugging Your Game
      1. The Art of Handling Failure
      2. Debugging Basics
      3. Debugging Techniques
      4. Different Kinds of Bugs
      5. Parting Thoughts
      6. Further Reading
    6. Driving to the Finish
      1. Finishing Issues
      2. Dealing with Big Trouble
      3. The Light—It’s Not a Train After All
  12. INDEX