Contents
Foreword to the First Edition xiii
Foreword to the Second Edition xvii
Preface to the First Edition xxi
Preface to the Second Edition xxiii
Acknowledgements xxiv
I Foundations 1
1 Introduction 3
1.1 Structure of a Typical Game Team 5
1.2 What Is a Game? 8
1.3 What Is a Game Engine? 11
1.4 Engine Differences Across Genres 13
1.5 Game Engine Survey 26
vii
viii CONTENTS
1.6 Runtime Engine Architecture 32
1.7 Tools and the Asset Pipeline 54
2 Tools of the Trade 63
2.1 Version Control 63
2.2 Microsoft Visual Studio 73
2.3 Profiling Tools 91
2.4 Memory Leak and Corruption Detection 93
2.5 Other Tools 94
3 Fundamentals of Software Engineering for Games 97
3.1 C++ Review and Best Practices 97
3.2 Data, Code and Memory 112
3.3 Catching and Handling Errors 144
3.4 Pipelines, Caches and Optimization 152
4 3D Math for Games 165
4.1 Solving 3D Problems in 2D 165
4.2 Points and Vectors 166
4.3 Matrices 181
4.4 Quaternions 200
4.5 Comparison of Rotational Representations 209
4.6 Other Useful Mathematical Objects 213
4.7 Hardware-Accelerated SIMD Math 218
4.8 Random Number Generation 227
II Low-Level Engine Systems 229
5 Engine Support Systems 231
5.1 Subsystem Start-Up and Shut-Down 231
5.2 Memory Management 239
5.3 Containers 254
5.4 Strings 274
5.5 Engine Configuration 290
CONTENTS ix
6 Resources and the File System 297
6.1 File System 298
6.2 The Resource Manager 308
7 The Game Loop and Real-Time Simulation 339
7.1 The Rendering Loop 339
7.2 The Game Loop 340
7.3 Game Loop Architectural Styles 343
7.4 Abstract Timelines 346
7.5 Measuring and Dealing with Time 348
7.6 Multiprocessor Game Loops 361
7.7 Networked Multiplayer Game Loops 375
8 Human Interface Devices (HID) 381
8.1 Types of Human Interface Devices 381
8.2 Interfacing with a HID 383
8.3 Types of Inputs 385
8.4 Types of Outputs 391
8.5 Game Engine HID Systems 392
8.6 Human Interface Devices in Practice 409
9 Tools for Debugging and Development 411
9.1 Logging and Tracing 411
9.2 Debug Drawing Facilities 416
9.3 In-Game Menus 423
9.4 In-Game Console 426
9.5 Debug Cameras and Pausing the Game 427
9.6 Cheats 427
9.7 Screenshots and Movie Capture 428
9.8 In-Game Profiling 429
9.9 In-Game Memory Stats and Leak Detection 436
III Graphics, Motion and Sound 441
10 The Rendering Engine 443
x CONTENTS
10.1 Foundations of Depth-Buffered Triangle Rasterization 444
10.2 The Rendering Pipeline 489
10.3 Advanced Lighting and Global Illumination 519
10.4 Visual Effects and Overlays 532
10.5 Further Reading 541
11 Animation Systems 543
11.1 Types of Character Animation 543
11.2 Skeletons 548
11.3 Poses 551
11.4 Clips 556
11.5 Skinning and Matrix Palette Generation 570
11.6 Animation Blending 575
11.7 Post-Processing 594
11.8 Compression Techniques 597
11.9 Animation System Architecture 604
11.10 The Animation Pipeline 605
11.11 Action State Machines 621
11.12 Animation Controllers 646
12 Collision and Rigid Body Dynamics 647
12.1 Do You Want Physics in Your Game? 648
12.2 Collision/Physics Middleware 653
12.3 The Collision Detection System 655
12.4 Rigid Body Dynamics 684
12.5 Integrating a Physics Engine into Your Game 722
12.6 Advanced Physics Features 740
13 Audio 743
13.1 The Physics of Sound 744
13.2 The Mathematics of Sound 756
13.3 The Technology of Sound 774
13.4 Rendering Audio in 3D 786
13.5 Audio Engine Architecture 806
13.6 Game-Specific Audio Features 828
CONTENTS xi
IV Gameplay 845
14 Introduction to Gameplay Systems 847
14.1 Anatomy of a Game World 848
14.2 Implementing Dynamic Elements: Game Objects 853
14.3 Data-Driven Game Engines 856
14.4 The Game World Editor 857
15 Runtime Gameplay Foundation Systems 869
15.1 Components of the Gameplay Foundation System 869
15.2 Runtime Object Model Architectures 873
15.3 World Chunk Data Formats 892
15.4 Loading and Streaming Game Worlds 899
15.5 Object References and World Queries 909
15.6 Updating Game Objects in Real Time 916
15.7 Events and Message-Passing 933
15.8 Scripting 954
15.9 High-Level Game Flow 978
V Conclusion 979
16 You Mean There’s More? 981
16.1 Some Engine Systems We Didn’t Cover 981
16.2 Gameplay Systems 982
Bibliography 987
Index 991
· · · · · · (
收起)