GAME
PROGRAMMING
GEMS 8
Edited by Adam Lake
Course Technology PTR
A part ofCengage Learning
o COURSE TECHNOLOGY
? CENGAGE Learning-
Australia, Brazil, Japan, Korea, Mexico, Singapore, Spain, United Kingdom, United States
Contents
Preface ix
Contributors xiv
Section 1 Graphics 1
Introduction 1
Jason Mitchell, Valve
1.1 Fast Font Rendering with Instancing 3
Aurelio Reis, id Software
1.2 Principles and Practice of Screen Space Ambient Occlusion 12
Dominic Filion, Blizzard Entertainment
1.3 Multi-Resolution Deferred Shading 32
Hyunwoo Ki, INNOACE Co., Ltd
1.4 View Frustum Culling of Catmull-Clark Patches in DirectX 11 39
Rahul P. Sathe, Intel Advanced Visual Computing (AVC)
1.5 Ambient Occlusion Using DirectX Compute Shader 50
Jason Zink
1.6 Eye-View Pixel Anti-Aliasing for Irregular Shadow Mapping 74
Nico Galoppo, Intel Advanced Visual Computing (AVC)
1.7 Overlapped Execution on Programmable Graphics Hardware . . . . . . . 90
Allen Hux, Intel Advanced Visual Computing (AVC)
1.8 Techniques for Effective Vertex and Fragment Shading on the SPUs. . 101
Steven Tovey, Bizarre Creations Ltd.
iii
iv Table of Contents
Section 2 Physics and Animation 119
Introduction 119
Jeff Lander, Darwin 3D, LLC
2.1 A Versatile and Interactive Anatomical Human Face Model 121
Marco Fratarcangeli
2.2 Curved Paths for Seamless Character Animation 132
Michael Lewin
2.3 Non-Iterative, Closed-Form, Inverse Kinematic Chain Solver (NCF IK) . 141
Philip Taylor
2.4 Particle Swarm Optimization for Game Programming 152
Dario L. Sancho-Pradel
2.5 Improved Numerical Integration with Analytical Techniques 168
Eric Brown
2.6 What a Drag: Modeling Realistic Three-Dimensional
Air and Fluid Resistance. . 183
B. Charles Rasco, Ph.D., President, Smarter Than You Software
2.7 Application of Quasi-Fluid Dynamics for Arbitrary Closed Meshes . . . 1 9 4
KrzysztofMieloszyk, Gdansk University of Technology
2.8 Approximate Convex Decomposition for
Real-Time Collision Detection 202
KhaledMamou
Section 3 AS 211
Introduction 211
Borut Pfeifer
3.1 Al Level of Detail for Really Large Worlds 213
Cyril Brom, Charles University in Prague
Tomds Poch, Ondrej Sery
3.2 A Pattern-Based Approach to Modular Al for Games 232
Kevin Dill, Boston University
Table of Contents v
3.3 Automated Navigation Mesh Generation Using
Advanced Growth-Based Techniques 244
D. Hunter Hale
3.4 A Practical Spatial Architecture for Animal and Agent Navigation . . . 256
Michael Ramsey—Blue Fang Games, LLC
3.5 Applying Control Theory to Game Al and Physics 264
Brian Pickrell
3.6 Adaptive Tactic Selection in First-Person Shooter (FPS) Games . . . . 279
Thomas Hartley, Institute of Gaming and Animation (IGA), University ofWolverhampton
Quasim Mehdi, Institute of Gaming and Animation (IGA), University ofWolverhampton
3.7 Embracing Chaos Theory: Generating Apparent
Unpredictability through Deterministic Systems 288
Dave Mark, Intrinsic Algorithm LLC
3.8 Needs-Based Al 302
Robert Zubek
3.9 A Framework for Emotional Digital Actors 312
Phil Carlisle
3.10 Scalable Dialog Authoring 323
Baylor Wetzel, Shikigami Games
3.11 Graph-Based Data Mining for Player Trace Analysis in MMORPGs. . . 335
Nikhil S. Ketkar and G. Michael Youngblood
Section 4 General Programming 353
Introduction 353
Doug Binks, Intel Semiconductors AG
4.1 Fast-lsA 355
Joshua Grass, PhD
4.2 Registered Variables 363
Peter Dalton, Smart Bomb Interactive
4.3 Efficient and Scalable Multi-Core Programming 373
Jean-Francois Dubi, Ubisoft Montreal
vi Table of Contents
4.4 Game Optimization through the Lens of Memory and Data Access . . 385
Steve Rabin, Nintendo of America Inc.
4.5 Stack Allocation 393
Michael Dailly
4.6 Design and Implementation of an In-Game Memory Profiler 402
Ricky Lung
4.7 A More Informative Error Log Generator 409
J.L. Raza and Peter Iliev Jr.
4.8 Code Coverage for QA 416
Matthew Jack
4.9 Domain-Specific Languages in Game Engines 428
Gabriel Ware
4.10 A Flexible User Interface Layout System for Divergent Environments . . 442
Gero Gerber, Electronic Arts (EA Phenomic)
4.11 Road Creation for Projectable Terrain Meshes 453
Igor Borovikov, Aleksey Kadukin
4.12 Developing for Digital Drawing Tablets 462
Neil Gower
4.13 Creating a Multi-Threaded Actor-Based
Architecture Using Intel® Threading Building Blocks 473
Robert Jay Gould, Square-Enix
Section 5 Networking and Multiplayer 485
Introduction 485
Craig Tiller and Adam Lake
5.1 Secure Channel Communication 487
Chris Lomont
5.2 Social Networks i n Games: Playing w i t h Your Facebook Friends . . . . 4 9 8
Claus Hofele, Team Bondi
Table of Contents vii
5.3 Asynchronous I/O for Scalable Game Servers 506
Neil Gower
5.4 Introduction to 3D Streaming Technology in
Massively Multiplayer Online Games 514
Kevin Kaichuan He
Section 6 Audio 539
Introduction 539
Brian Schmidt, Founder and Executive Director, GameSoundCon;
President, Brian Schmidt Studios
6.1 A Practical DSP Radio Effect 542
Ian Ni-Lewis
6.2 Empowering Your Audio Team with a Great Engine 553
Mat Noguchi, Bungie
6.3 Real-Time Sound Synthesis for Rigid Bodies 563
Zhimin Ren and Ming Lin
Section 7 General Purpose Computing on GPUs 573
Introduction 573
Adam Lake, Sr. Graphics Software Architect, Advanced Visual Computing, Intel
7.1 Using Heterogeneous Parallel Architectures with OpenCL 575
Udeepta Bordoloi, Benedict R. Gaster, and Marc Romankewicz, Advanced Micro Devices
7.2 PhysX GPU Rigid Bodies in Batman: Arkham Asylum 590
Richard Tonge, NVIDIA Corporation
Ben Wyatt and Ben Nicholson, Rocksteady Studios
7.3 Fast GPU Fluid Simulation in PhysX 602
Simon Schirm and Mark Harris, NVIDIA Corporation
Index 616