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, Fourth Edition

Book Description

GAME CODING COMPLETE is the essential hands-on guide to developing commercial-quality games. Drawing on his in-depth industry experience, the authors take programmers through the complete process of developing a professional-quality game using hundreds of insider tricks and techniques developed and perfected in their nearly two decades in game development. The book takes a unique approach to understanding overall architecture--explaining how the different components of a game engine work together. Complete source code is included and every line is explained. Covering a range of topics that will appeal to the most discriminating programmers, GAME CODING COMPLETE also covers key issues that could trip up even veteran programmers. This updated fourth edition uses the latest versions of DirectX and Visual Studio, and it includes expanded chapter coverage of the C# editor, resource caching, network code, and other important updates to every chapter.

Table of Contents

  1. Title Page
  2. Copyright Page
  3. Dedication
  4. Dedication
  5. Foreword
  6. Foreword
  7. Acknowledgments
  8. About the Authors
  9. Contents
  10. Introduction
  11. Chapter 1 What Is Game Programming Really Like?
    1. The Good
    2. The Hard Work
    3. The Dark Side
    4. It’s All Worth It, Right?
  12. Chapter 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
  13. Chapter 3 Coding Tidbits and Style That Saved Me
    1. General Coding Styles
    2. Smart Code Design Practices
    3. Smart Pointers and Naked Pointers
    4. Using Memory Correctly
    5. Grab Bag of Useful Stuff
    6. Developing the Style That’s Right for You
    7. Further Reading
  14. Chapter 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
  15. Chapter 5 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
  16. Chapter 6 Game Actors and Component Architecture
    1. A First Attempt at Building Game Actors
    2. Component Architecture
    3. Creating Actors and Components
    4. Defining Actors and Components
    5. Storing and Accessing Actors
    6. Putting It All Together
    7. Data Sharing
  17. Chapter 7 Controlling the Main Loop
    1. Organizing the Main Loop
    2. Playing Nicely with the OS
    3. Using the DirectX 11 Framework
    4. Can I Make a Game Yet?
  18. Chapter 8 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
  19. Chapter 9 Programming Input Devices
    1. Getting the Device State
    2. Using XInput or DirectInput
    3. A Few Safety Tips
    4. Working with Two-Axis Controls
    5. Working with a Game Controller
    6. Working with the Keyboard
    7. What, No Dance Pad?
  20. Chapter 10 User Interface Programming
    1. DirectX’s Text Helper and Dialog Resource Manager
    2. The Human’s Game View
    3. A WASD Movement Controller
    4. Screen Elements
    5. A Custom MessageBox Dialog
    6. Modal Dialog Boxes
    7. Controls
    8. Control Identification
    9. Hit Testing and Focus Order
    10. Control State
    11. More Control Properties
    12. Some Final User Interface Tips
  21. Chapter 11 Game Event Management
    1. Game Events
    2. What Game Events Are Important?
    3. Distinguishing Events from Processes
    4. Further Reading
  22. Chapter 12 Scripting with Lua
    1. A Brief History of Game Programming Languages
    2. Using a Scripting Language
    3. Scripting Language Integration Strategies
    4. A Crash Course in Lua
    5. Object-Oriented Programming in Lua
    6. Memory Management
    7. Binding Lua to C++
    8. A Crash Course in LuaPlus
    9. Bringing It All Together
    10. Lua Development and Debugging
    11. Final Thoughts
    12. Further Reading
  23. Chapter 13 Game Audio
    1. How Sound Works
    2. Game Sound System Architecture
    3. Other Technical Hurdles
    4. Some Random Notes
    5. The Last Dance
  24. Chapter 14 3D Graphics Basics
    1. 3D Graphics Pipeline
    2. 3D Math 101
    3. C++ Math Classes
    4. Still with Me?
  25. Chapter 15 3D Vertex and Pixel Shaders
    1. The Vertex Shader and Shader Syntax
    2. Compiling the Vertex Shader
    3. C++ Helper Class for the Vertex Shader
    4. The Pixel Shader
    5. C++ Helper Class for the Pixel Shader
    6. Rendering with the Shader Helper Classes
    7. Shaders—It’s Just the Beginning
    8. Further Reading
  26. Chapter 16 3D Scenes
    1. Scene Graph Basics
    2. Special Scene Graph Nodes
    3. What’s Missing?
    4. Still Hungry?
    5. Further Reading
  27. Chapter 17 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
  28. Chapter 18 An Introduction to Game AI
    1. AI Techniques
    2. Finite State Machines
    3. Decision Trees
    4. Fuzzy Logic
    5. Utility Theory
    6. Goal-Oriented Action Planning
    7. PathFinding
    8. Further Reading
  29. Chapter 19 Network Programming for Multiplayer Games
    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
  30. Chapter 20 Introduction to Multiprogramming
    1. What Multiprogramming Does
    2. Creating Threads
    3. Process Synchronization
    4. Interesting Threading Problems
    5. Thread Safety
    6. Multithreading Classes in GameCode4
    7. Background Decompression of a Zip File
    8. Further Work
    9. About the Hardware
    10. About the Future
    11. Further Reading
  31. Chapter 21 A Game of Teapot Wars!
    1. Making a Game
    2. Creating the Core Classes
    3. Game Events
    4. Gameplay
    5. An Exercise Left to the Reader
  32. Chapter 22 A Simple Game Editor in C#
    1. Why C#?
    2. How the Editor Is Put Together
    3. The Editor Architecture
    4. The C# Editor Application
    5. The C# Editor User Interface
    6. Future Work
    7. Further Reading
  33. Chapter 23 Debugging and Profiling Your Game
    1. The Art of Handling Failure
    2. Debugging Basics
    3. Graphics and Shader Debugging
    4. Debugging Techniques
    5. Building an Error Logging System
    6. Different Kinds of Bugs
    7. Profiling
    8. Parting Thoughts
    9. Further Reading
  34. Chapter 24 Driving to the Finish
    1. Finishing Issues
    2. Dealing with Big Trouble
    3. The Light—It’s Not a Train After All
  35. Index