Important Announcement
PubHTML5 Scheduled Server Maintenance on (GMT) Sunday, June 26th, 2:00 am - 8:00 am.
PubHTML5 site will be inoperative during the times indicated!

Home Explore Game Coding [ PART II ]

Game Coding [ PART II ]

Published by Willington Island, 2021-09-04 03:48:16

Description: [ PART II ]

Welcome to Game Coding Complete, Fourth Edition, the newest edition of the essential, hands-on guide to developing commercial-quality games. Written by two veteran game programmers, the book examines the entire game development process and all the unique challenges associated with creating a game. In this excellent introduction to game architecture, you'll explore all the major subsystems of modern game engines and learn professional techniques used in actual games, as well as Teapot Wars, a game created specifically for this book. This updated fourth edition uses the latest versions of DirectX and Visual Studio, and it includes expanded chapter coverage of game actors, AI, shader programming, LUA scripting, the C# editor, and other important updates to every chapter. 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.

GAME LOOP

Search

Read the Text Version

The Light—It’s Not a Train After All 877 phone will ring, and the lead tester will give you the good news. The final build has been accepted, and the game is going to be manufactured. Your game is done. There will likely be a free flow of appropriate beverages. I keep a bottle of nice tequila or maybe a good single-malt scotch in my office for just such an occasion. You have a few weeks to wait for the channel to push your game into every store and online site, so what do you do in the meantime? Test the Archive The first thing you do is take a snapshot of the build machine and the media files on your network. Your job is to rebuild the game from scratch, using all your build scripts, to make sure that if you ever need to, you can restore a backup of the game source and rebuild your game. Start with a completely clean machine and install the build machine backup. It should include all the build tools, such as your compiler and special tools that you used to create your game. Restore a backup of the network files to a clean spot on your network. This may take some doing, since your network might be pretty full. It’s a good idea to buy some extra hard drives to perform this task, since it is the only way you can be 100 percent sure your project backup will work. After you have a duplicate of your build machine and a second copy of the network files, build your game again and compare it to the image that is signed off. If they compare bit for bit, make some copies of the backups and store them in a cool dark place, safe for all eternity. If you are working for a game publisher, they will want a copy of the backup, too, so don’t forget to make enough for them. If the files don’t match, do your best to figure out why. It wouldn’t be completely unusual for a few bits to be mysteriously different on the first attempt. The existence of a completely automated build process usually makes the archive perfectly accurate, which is a great reason to have it in the first place. As a last resort, if your files don’t match, the best thing you can do is document the delta and have your testers run the rebuilt archive through the testing process once more. This will ensure that at least the game is still in a shippable state, even though some of the bits are different. Archive the Bug Database Don’t forget to back up the bug database in some readable format, such as an Excel spreadsheet or even a CSV file. Store it along with your project archive, and if you ever want to start a sequel, the first thing you’ll do is figure out which postponed bugs you’ll fix.

878 Chapter 24 n Driving to the Finish The Patch Build or the Product Demo It’s not crazy to start working on a patch build or downloadable demo immediately after the project signs off. The patch build is fairly common on almost every plat- form. If you know you need to build one, there’s no reason to wait. A downloadable demo or trial version of your game is always a good idea. I suggest you leave the patch build in your main line of development in your source code repository. The patch build should simply be the next minor version of your game and is exactly what you’ve been doing since your zero bug date. You can release the thumbscrews a little and consider some slightly more radical solutions to pro- blems that you wouldn’t have considered just a few days ago—it all depends on your schedule for the patch. It wouldn’t be uncommon to wait for initial customer feedback for finalizing the fea- tures and fixes that you’ll include in your patch. Your customer base will likely find something your testers missed, or you may discover that a known problem is a much bigger deal than anyone expected. The downloadable demo should exist in a separate branch in your source code repos- itory. This is especially true if you code the demo with #ifdef_DEMO blocks or some such mechanism to cut your game down to a tiny version of itself. It wouldn’t be crazy for some programmers to work on the demo and the patch simultaneously, and a separate code branch will help keep everything organized. The Postmortem A good postmortem should be held a few weeks after you sign off your game. There are tons of ways to handle it, but there are a few common goals. Every project is a chance to learn about game development, and the postmortem is a mechanism that formalizes those lessons, which will ultimately change the way you work. It isn’t a forum to complain about things that went wrong and leave it at that. Instead, your postmortem should identify opportunities to improve your craft. It is a forum to rec- ognize a job well done, whether on the part of individuals or as a group. In postmortems, it’s really easy to get off track because everyone on the team wants to say his piece about nearly everything. That’s good, but it can degenerate into a chaotic meeting. It’s also not a crazy idea to split the team into their areas of expertise and have them conduct mini-postmortems in detail. For example, the pro- grammers might get together to talk about aspects of the technology or their meth- odologies, surely stuff that will bore the artists to the point of chewing their own limbs off to escape the meeting. Each group—programmers, artists, designers,

The Light—It’s Not a Train After All 879 producers, and whoever—can submit their detailed report for any other similar group who wants to learn their lessons. The team postmortem should focus on the game design, the project schedule, lines of communication, and team process. If someone believes he has a good idea of how to improve things, he should speak up, and if the group thinks the idea has merit, then they should act on the idea. One thing that isn’t immediately obvious is the fact that you won’t learn everything in a public meeting. Some of the most important information might be better dis- cussed in private, in the hopes that someone’s feelings won’t be bruised. If you get the chance to run a postmortem, don’t forget to follow the public meeting with pri- vate interviews with the team. It will take a long time, but it’s a good idea. What to Do with Your Time When I reached the end of my longest project to date, Ultima VIII, my first act was to walk outside Origin’s offices, sit down at a picnic table, and enjoy the light, smells, and sounds of a springtime Texas afternoon. I had been in a dark office working overtime for two years, and I’d forgotten what daytime was like. I went home and found a person there. After introductions and reviewing surprising evidence in the form of a photo album, I realized that the person in my apartment was actually my wife for over three years. I asked her out on a date, and she accepted. Then I asked her to accompany me on a diving trip to Cozumel. She accepted that, too. I suggest you follow my lead. If you don’t have a spouse, go somewhere fun with a friend. See the world. Get away from your computer at all costs. It will do you some good and may give you some fun ideas. You won’t be able to stay away from work forever. The desire to make another great game will soon overwhelm you. You may embark on a sequel to the game you just shipped, or you might get to do something entirely new. Either way, you’ll be sur- prised at the energy level. People on the team who looked like the living dead just a few weeks ago will be ready to go around again. There’s nothing quite like starting a new project. You feel renewed and smarter, and if you’re really lucky, you’ll get to work with the same team. After what you’ve just been through, it’s likely you’ll have a good portion of mental telepathy worked out, and you won’t need quite so many meetings. One thing everyone will quietly do is make excuses to walk into computer game stores looking for the box. Eventually, you’ll see it for the first time. There’s nothing like it, holding a shrink-wrapped version of your game in your own hands. I sincerely

880 Chapter 24 n Driving to the Finish hope you get the chance to do that someday. Everybody deserves that kind of reward for such a mammoth effort. The game industry is a wacky place. The hours are long, and the money isn’t that great. I know because I’ve been in it up to my neck since games ran on floppy disks. Somehow I find the energy to keep doing it. Am I just a glutton for punishment? I guess there’s a lot to be said for a profession that has one goal—fun. I learned in scouting that you should always leave a campsite better than you found it. I guess that working on computer games is a way to do that for much more than a campsite. My work in the computer game industry has hopefully had an effect on the people who enjoyed the games with my name somewhere in the credits. My work, and that of my co-author and friend Rez, on this book has hopefully made working on the games themselves more fun and more enjoyable for you. Only time will tell, eh?

INDEX {} (Lua curly braces), 346 vectors, normalizing, 449–450 3D graphics vectors, scalars, 450 vectors, targets, 452–455 C++ math classes vectors, unit vectors, 449–453 clipping planes, 481 meshes, 494–497 matrices, 458–469 normals, 482–484 matrices, 4X4, 459 overview, 443, 497 matrices, moving objects, 462–469 pipeline, 444–445 matrices, multiplying, 463 processes, 444–445 matrices, rotation, 459–469 programmable, 445 matrices, unit circles, 459–461 resources, 444 overview, 456 scene graphs. See scene graphs quaternions, compression, 471 shaders. See shaders quaternions, Euler angles, 469 textures quaternions, frustums, 474–478 creating, 487–488 quaternions, overview, 469–473 loading, 491–494 quaternions, planes, 473–474 mip-mapping, 490–491 transformations, 478–481 resources, 202, 204–205 vectors, 456–458, 481–482 scintillation, 488–490 subsampling, 488–490 colors, 482–484 vertices, 487 fixed-function, 445 4X4 matrices (C++ math classes), 459 lighting, 482–484 materials, 484–487 A math A* (A-Star), 638–640 axes, 446–447 absolute values (variables), 625 coordinates, 446–449 abstractions floating-point numbers, 447–448 handedness, 449 hardware abstraction layer, 243–244 orientation, 446–447 Lua classes, 353–355 overview, 445–446 acceleration units of measurement, 448 gamepad controls, 261–262 vectors, 449–455 physics, 569–574 vectors, calculating angles, 450–453 accelerometers (Wii controls), 249 vectors, cross products, 453–455 vectors, dot products, 450–453 vectors, floating-point numbers, 450 881

882 Index addresses (IP addresses), 646–648 advanced techniques. See techniques/tips accessing AI (artificial intelligence), 45 actors, 168–170 components, 168–170 decision trees, 622–626 memory, optimizing, 78–79 finite state machines, 616–622 fuzzy logic, 627–630 accuracy, targeting, 247–248 game views, 45–46 architecture (C# editor) goal-oriented action planning, actor functions, 756–763 635–636 application layer, 749 hard-coding, 612–614 DLL, 763–764 Lua, 617 framework functions, 753–756 overview, 611–612 game engines, 753–763 pathfinding logic class, 750–751 overview, 748–749 A* (A-Star), 638–640 views, 751–753 dynamic avoidance, 640–641 wrapping, 764 overview, 636–638 action mapping (controls), 245 randomization, 614–616 ActorComponentEditor class utility theory, 630–634 weighted randoms, 616 (C# editor), 784–792, Asimov, Isaac, 58 793, 794, 795 algorithms (quadratic equations), 87–88 actors. See also components; objects AlienBrain (source repositories), accessing, 168–170 audio, 432 114–115 building alignment (speed), 80–81 component architecture, 159–160 alpha pass multiple class inheritance, 155–159 C# editor finishing projects, 854 ActorComponentEditor class, 784–795 scene graphs, 542–544 actors list, 777–780 Alt keys, 267 editing components, 792–794 ambient audio, 436, 438–439 functions, 756–763 angles managing, 784–795 calculating vectors, 450–453 showing components, 789–792 Euler angles, 469 creating, 160–165 velocity (physics), 574–575 creator factory, 171 angular velocity (physics), 574–575 defined, 155 animation defining, 165–168, 170–171 controls, 304 events, destroying, 323–324 resources, 200–202 implementing, 170–171 animators, 5 managing APIs creating games, 739–741 Lua C API, 356 Lua, 387–389 sockets API scene graphs, 539, 542 sharing data connecting sockets, 658–659 events, 173–174 creating sockets, 655–659 overview, 171 DNS, 653–654 pointers, 172–174 initialization, 654–655 transforms, 171–172 overview, 650 storing, 168–170 ports, 658–659 actors list (C# editor interface), 777–780 reading sockets, 663 adding servers, 660–662 nodes (scene graphs), 565 shutdown, 654–655 team members (schedules), 868–869 utility functions, 651–653 writing sockets, 663

Index 883 application layer streaming, 399 C# editor, 749 streaming music, 400 creating games, 722–723 components, building actors, 159–160 DLLs, 34–35 hardware abstraction layer, 243–244 file system resource caches, 31–33 networks globalization/localization, 34 game logic layer, 47–48 initializing, 33–35 game views, 47 CPU speed, 140 multiplayer games, 48 creating game logic, 145 overview, 46–47 creating views, 145 overview, 25–28, 51–54 creating windows, 145 archives, testing, 877–878 DirectX, 145 artificial intelligence. See AI events, 144–145 artists, 43 GameCodeApp class, 135–136 aspect ratio, 290 hard drive storage space, 138–139 assembly, 331, 797–798, 820–822, 845–846 hardware quality, 141 asset tree (C# editor interface), 775–777 loading cache resources, 147 A-Star (A*), 638–640 loading text strings, 142–144 audio memory, 139–140 actors, 432 multiple instances, 137–138 ambient, 436, 438–439 overview, 133 architecture save game directories, 146–147 buffers, 408–414 script managers, 144–145 classes, 408–414 system resources, 136–137 controls, 408–414 WinMain, 133–135 defining classes, 399–400 initializing resource caches, 141–142 DirectSound, 414–426 input, reading, 31 handles, 398–408 main loop, 33–35 interfaces, 408–414 memory managers, 33 launching, 431–432 network communication, 34–35 loading OGG files, 403–408 shutdown, 33–35 loading WAV files, 401–403 strings, 34 multithreading, 396–397 system clock, 34 overview, 397–398 threads, 34–35 processes, 426–431 resources, 398–408 applying architecture, 28–31 streaming, 399 architecture streaming music, 400 audio engineers, 6 applying, 28–31 background, 436, 438–439 audio backups, 395 class hierarchy, 397–398 buffers, 408–414 controls, 304 classes, 408–414 data-driven, 437 controls, 408–414 decibels, 392–393 defining classes, 399–400 dialogue/speech, 434–435 DirectSound, 414–426 background, 436, 438–439 handles, 398–408 barks, 439–440 interfaces, 408–414 lip synching, 440–441 launching, 431–432 localization, 440 loading OGG files, 403–408 NPCs, 634–638 loading WAV files, 401–403 overview, 439 multithreading, 396–397 player objectives, 440 overview, 397–398 processes, 426–431 resources, 398–408

884 Index barks (dialogue/speech), 439–440 batching reads (resource caches), 235 audio (continued) benefits, scripting languages, 337–338 recording, 441 Berkeley sockets, 645–646 text supplement, 440 beta milestone, 854 binding Lua/C++, 356–357 DirectX, 50–51 bitmaps effects, 435–436 formats, 395–396 controls, 300–301, 305 game views, 43–44 resources, 202–205 hard-coding, 437 black objects, 485 kilohertz, 392 bouncing cameras, 597 mixing, 434–436 bounding spheres (scene graphs), 528 music BoundsChecker, 825 braces (code styles), 55–56 composers, 6 branching (source repositories), 115–118, 127–128 debugging techniques/tips, 827, 844 breakpoints (debugging), 802, 804 fading, 436 breaks recording, 438 debugging techniques/tips, 828 resources, 205–206 finishing projects, 879–880 streaming, 400 schedules, 866 objects, 432 buffer zones (resource caches), 234 overview, 391–393, 441–442 buffers (audio), 408–414 recording, 393–395 bug numbers, 860–861 music, 438 bugs. See debugging volume, 437 building. See also creating reproduction, 393–395 actors resources, 205–206 sound waves, 394–395 component architecture, 159–160 synchronizing, 432–434 multiple class inheritance, 155–159 synchronizing readers/writers, 396–397 error logging systems, 828–835 troubleshooting, 434 projects, 118–120 volume, 434–437 resource caches, 225–233 wave forms, 394–395 builds audio engineers, 6 automating, 120 auto keyword, 164–165 backups, 120–121 automation build scripts build scripts, 121–122 automating, 120–122 builds, 120 Close scripts, 126 projects, 98 milestone builds, 124–127 random number generators, 86–87 normal builds, 123–124 troubleshooting, 86–87 Open scripts, 126 Avid AlienBrain (source repositories), 114–115 updating, 124 axes computers, 120–121 3D graphics, 446–447 configurations, 99–100 axis-aligned bounding boxes (scene graphs), 528 debug builds loading, 68 B saving, 68 patch builds, 878 background process overview, 118–120 audio, 436, 438–439 promoting, 853 decompressing (ZIP files), 713–715 release builds, debugging, 843 dialogue/speech, 436, 438–439 time (events), 310 Visual Studio options, 104–108 backups audio files, 395 builds, 120–121

Index 885 Bullet Physics website, 589, 609 functions (LuaPlus calling), 363–366 buttons, state, 240 helper class C pixel shaders, 516–520 vertex shaders, 507–515 C API, 356 initializing, 130–133 C# editor Lua binding, 356–357 actors C API, 356 actor functions, 756–763 Event Managers, 380–387 ActorComponentEditor, 784–795 luabind, 357 actors list, 777–780 registering functions, classes, 357 editing components, 792–794 script inheritance, 379 managing, 784–795 tolua++ library, 357 showing components, 789–792 LuaPlus functions, 363–366 architecture global variables, 361–362 actor functions, 756–763 objects, 358–360 application layer, 749 overview, 357–358 DLL, 763–764 state, 358 framework functions, 753–756 tables, 360–361 game engine, 753–763 math classes logic class, 750–751 clipping planes, 481 overview, 748–749 matrices, 458–469 views, 751–753 matrices, 4X4, 459 wrapping, 764 matrices, moving objects, 462–469 matrices, multiplying, 463 classes matrices, rotation, 459–469 ActorComponentEditor, 784–795 matrices, unit circles, 459–461 data members, 786–787 overview, 456 EditorForm, 772–784 quaternions, compression, 471 initializing, 786–787 quaternions, Euler angles, 469 logic class, 750–751 quaternions, frustums, 474–478 MessageHandler, 769–772 quaternions, overview, 469–473 NativeMethods, 767–768 quaternions, planes, 473–474 Program, 768–769 transformations, 478–481 testing, 795 vectors, 456–458, 481–482 XPathUtility, 787–789 objects debugging techniques/tips, 819–820 creating, 748 serializing, 690 DLL, methods, 767–768 programming languages history, 331–333 interface shared_ptr (smart pointers), 71–75 caches actors list, 777–780 components, 167 asset tree, 775–777 CPU (memory), 78–79, 81 controls, 772–784 resources menu bar, 780–784 batching reads, 235 managed/unmanaged code comparison, 766–767 buffer zones, 234 messages, handling, 769–772 building, 225–233 overview, 747–766 DirectX, 233 synchronizing, 786 file systems, 31–33 windows, 766 initializing, 141–142, 147 Windows Forms, 772 interfaces, 222 C++ auto keyword, 164–165 classes (Lua script inheritance), 379 design practices, 59–60

886 Index C++ clipping planes, 481 caches (continued) Lua script inheritance, 379 loading, 147, 224–225 matrices, 458–469 managing, 233–237 matrices, 4X4, 459 multiple, 220 matrices, moving objects, 462–469 overview, 218–222 matrices, multiplying, 463 tracking loaded resources, 222–224 matrices, rotation, 459–469 world design, 233–237 matrices, unit circles, 459–461 overview, 456 calculating angles (vectors), 450–453 pixel shaders, 516–520 callbacks quaternions, compression, 471 quaternions, Euler angles, 469 controls (state), 240 quaternions, frustums, 474–478 DirectX, 191–193 quaternions, overview, 469–473 message queue, 212 quaternions, planes, 473–474 camera nodes (scene graphs), 548–551 transformations, 478–481 cameras vectors, 456–458, 481–482 bouncing (debugging), 597 vertex shaders, 507–515 scene graphs, 538 game views, creating, 271–281 camera nodes, 548–551 GameCodeApp, 135–136 debugging, 550 hierarchies capturing (mouse), 249–252 caveman debugging, 826–827 audio, 397–398 center of mass (physics), 574 design practices, 60–61 changing screens, 299 game editors, 765 inheritance last-minute content changes, 862–864 building actors, 155–159 schedules, 869–870 design practices, 63 characters interfaces collisions, 583–586 controls, 241–243 controls, 248 design practices, 64–65 death, 309 Lua NPC speech, 634, 638 abstractions, 353–355 walking/running, 248 registering, 357 check routines, 822–823 main loops choosing DelayProcess, 186–187 physics SDKs, 576–578, 609 Process, 178–188 scripting languages, 338 ProcessManager, 183–185 cinematics, 206–209 ScriptProcess, 370–379, 619 classes namespaces (static functions), 830 audio real-time processes, 705–708 architecture, 408–414 scene graphs defining, 399–400 axis-aligned bounding boxes, 528 hierarchy, 397–398 bounding spheres, 528 C# editor camera node class, 548–551 ActorComponentEditor, 784–795 interface class, 524–526 data members, 786–787 light manager class, 552–554 EditorForm, 772–784 light node class, 551–554 initializing, 786–787 meshes, 560–564 logic class, 750–751 properties, 526–529 MessageHandler, 769–772 rendering, 526–529 NativeMethods, 767–768 root node class, rendering, 545–548 Program, 768–769 testing, 795 XPathUtility, 787–789

Index 887 scene class, 536–544 branching, 115–118, 127–128 scene class, actors, 539, 542 Microsoft Visual Source Safe, scene class, alpha pass, 542–544 scene class, cameras, 538 111–112, 114 scene class, implementing, 539 overview, 110–111 scene class, lighting, 539 Perforce, 113–114 scene class, matrices, 538–539, 541–542 sandboxes, 116–118 scene class, rendering, 539–541 SneakerNet, 110–111 scene class, restoring, 539–541 Subversion, 112–113 scene class, root nodes, 538, 545 TortoiseSVN, 112–113 scene class, updating, 539–541 static code analysis, 828 scene node class, 529–536 styles sky node class, 554–560 braces, 55–56 clients, sockets, 666–669, 673–675 consistency, 56–58 clipping planes (C++ math classes), 481 developing, 95 Close scripts, 126 overview, 54 closing version control Close scripts, 126 Avid AlienBrain, 114–115 modal dialog boxes on shutdown, 150–151 branching, 115–118, 127–128 code. See also scripts/scripting languages Microsoft Visual SourceSafe, 111–112, 114 assembly code, 820–822 overview, 110–111 code analyzers, 824–825 Perforce, 113–114 comments, 859–862 sandboxes, 116–118 debugging. See debugging SneakerNet, 110–111 design practices Subversion, 112–113 C++, 59–60 TortoiseSVN, 112–113 class hierarchies, 60–61 code analyzers, 824–825 class inheritance, 63 Code Project website, 313 debug builds, 68 collision systems, 586–588 destructors, 59–60 collisions encapsulation, 66–67 bitmap collisions (controls), 300–301, 305 factories, 65–66 objects hidden code, 59–60 characters, 583–586 initializing objects, 67–68 collision systems, 586–588 interface classes, 64–65 doors, 585–586 non-trivial operations, 59–60 game logic layer, 37–38 object composition, 61 geometry, 582–583 object inheritance, 61 hulls, 580–586 overview, 58–59 meshes, 580–586 streams, 67 properties, 578–580 template method design pattern, 63 raycasting, 577, 586–588 virtual functions, 61–64 shapecasting, 586, 588 finishing projects, 857–862 stairs, 585–586 hard-coding testing, 583 AI, 612–614 time, 585 audio, 437 trees, 585–586 innovation, 14–15 physics. See physics managed/unmanaged comparison, 766–767 SDKs. See SDKs optimizing, 847–849 colors sharing (multiple projects), 127–128 3D graphics, 482–484 source repositories resources, 202–205 Avid AlienBrain, 114–115 command interpreters (game logic layer), 40–41

888 Index controls. See also input animation, 304 comments audio, 304, 408–414 code, 859–862 bitmap collisions, 300–301, 305 Lua, 340 C# editor interface, 772–784 characters (walking/running), 248 communication context-sensitive help, 304 Lua/C++, 380–387 cursors (player feedback), 246–247, 302 networks, 34–35 dance pads, 267–268 player feedback (cursors), 246–247, 302 DirectInput, 243–245 dragging, 304 competitor releases, 874–875 events. See events compilers, debugging, 845 fidelity, 247–248 compiling shaders focus order, 300 gamepads speed, 500 acceleration, 261–262 vertex shaders, 505–507 dead zones, 256–259 completing. See finishing normalizing input, 259–261 complexity (debugging techniques/tips), 817–818 one-stick design, 261 components. See also actors; objects overview, 255–256 accessing, 168–170 twitch-looks, 257 architecture, 159–160 two-stick design, 261 building actors, 159–160 hit testing, 300–301, 305 caches, 167 input fidelity, 241 creating, 160–165 interfaces creator factory, 171 defining, 298–300 defining, 165–171 overview, 297–298 editing, 792–794 keyboards implementing, 170–171 Alt keys, 267 Lua scripts, 387–389 events, 262–267 physics SDKs, 593–594 Function keys, 265 sharing data hot keys, 303 WASD conrols, 281–283, 736 events, 173–174 mapping overview, 171 action mapping, 245 pointers, 172–174 objects, 243–245 transforms, 171–172 overloading, 246 showing, 789–792 overview, 239–240 storing, 168–170 players composers, 6 discoverability, 247 composition (design practices), 61 testing, 247 compression screen elements, 283–286 data state, 301–302 performance, 212 buttons, 240 Zlib open source, 213–218 callbacks, 240 lossy compression, 204 event handlers, 241–243 quaternions, 471 interface classes, 241–243 resources, 204, 208–209 managing, 240–243 conferences, 13 one-axis controls, 240 configuration, 99–100 polling, 240 connecting (sockets) three-axis controls, 241 clients, 666–669, 673–675 two-axis controls, 241 servers, 668–670, 684–686 sockets API, 658–659 consistency (code styles), 56–58 consoles (shutdown), 152–153 content, last-minute changes, 862–864 context-sensitive help, 304

Index 889 targeting accuracy, 247–248 threads, 696–698 tooltips, 303 vector objects (Lua), 349–350 two-axis controls views, 145 windows, 145 state, 241 creator factory, 171 cursors (player feedback), 246–247, 302 critical section (Windows threads), 700–702 mouse capturing, 249–252 cross products, 453–455 mouse dragging, 252–255 curly braces ({}), 346 state, 241 cursors (player feedback), 246–247, 302 Wii accelerometers, 249 cut and paste bugs, 842 XInput, 243–245 convex meshes, 601–602 D cooperative multitasking, 178–188 coordinates dance pads, 267–268 3D graphics, 446–449 data. See also files; resources debugging techniques/tips, 824 copying, sharing files comparison, 809 compression core dumps (debugging), 810 performance, 212 counting (reference counting), 69–70 Zlib open source, 213–218 coworkers. See teams CPU corruption (debugging memory), 839–840 caches, 78–79, 81 data members (C# editor classes), 786–787 multithreading, 693–696 data structures speed, initializing, 140 crashing (error handling), 799 debugging techniques/tips, 822–823 creating. See also building game logic layer, 36–37 actors, 160–165 data-driven audio, 437 C# editor, 748 data-driven processes (main loops), 187 components, 160–165 events, 309–312 creator factory, 171 packets (sockets), 665–666, 670–673 dialog boxes sharing message boxes, 286–292 events, 173–174 modal dialog boxes, 292–297 overview, 171 game logic, 145 pointers, 172–174 game views, 271–281, 733–736 transforms, 171–172 games storing (threads), 697 application layer, 722–723 data corruption (debugging memory), 839–840 events, 737, 741–745 data members (C# editor classes), 786–787 game logic layer, 723–733 data structures game views, 733–736 debugging techniques/tips, 822–823 loading levels, 737–739 game logic layer, 36–37 managing actors, 739–741 data-driven audio, 437 overview, 719–722 data-driven processes (main loops), 187 memory managers, 82–84, 232 dead zones (controls), 256–259 physics SDKs deadlock (threads), 703–704 convex meshes, 601–602 death (managing events), 309 objects, 599–601 debug builds, 68 triggers, 602–603 debugging. See also optimizing; techniques/tips; scripting languages, 337 sockets testing; troubleshooting sockets API, 655–659 assembly languages, 797–798, 845–846 writing, 663 breakpoints, 802, 804 textures, 487–488 bug numbers, 860–861 cameras bouncing, 597 scene graphs, 550

890 Index smoke testing, 853 System Debug Symbols, 806 debugging. See also optimizing; techniques/tips; techniques/tips testing; troubleshooting (continued) assembly code, 820–822 compilers, 845 BoundsChecker, 825 core dumps, 810 breaks, 828 cut and paste bugs, 842 C++ object scope, 819–820 debug builds, 68 caveman debugging, 826–827 DirectX check routines, 822–823 code analyzers, 824–825 graphics, 812–813 coordinates, 824 missing resources, 808 coworkers, 827–828 PIX, 812–813 data structures, 822–823 pixels, 808, 812–813 disappearing bugs, 825 shaders, 812–813 drawing, 823–824 surfaces, 808 experiment-driven process, 813–817 drivers, 844–845 frame rates, 824 errors instruction pointers, 818–820 error handling, 798–800 Lint, 824–825 error logging systems, 828–835 logging, 826 error message strings, 840 login servers, 826–827 finding, 803 memory, 822–824 finishing projects, 852–857, 860–861 music, 827, 844 full-screen games, 807–808 next statements, 818–820 hard drive space, 842–843 overview, 813 hardware, 845 reducing complexity, 817–818 heap, 835–839 reproducing bugs, 817 instruction pointer, 804–805 runtime analyzers, 825 MAP files, 800–802 scientific methodology, 813–817 measuring bugs, 853–854 static code analysis, 828 memory, 842–843 targets, 824 data corruption, 839–840 test objects, 824 memory leaks, 835–839 values, 825–826 stack corruption, 840–842 wireframes, 824 Task Manager, 839 testers, 15–16 Microsoft Debugging Tools, 806–807 troubleshooting schedules, 871–872 minidumps, 810–812 UNIX, 810 multithreading, 843–844 utilities networks, copying/sharing files, 809 DUMPBIN.EXE, 806 operating systems, 845 MSVSMON.EXE, 809–810 overview, 797–798 SYMCHK, 806–807 PDB files, 801–802 video cards, 845 physics SDKs, 604–606 Visual Studio, 806, 808–810 profiling windowed mode, 808 optimizing code, 847–849 windows, 803–804 overview, 846 Windows performance, 846–847 functions, 800 release builds, 843 symbol files, 805–807 remote, 808–810 WinDBG, 810 reporting bugs, 846 decibels, 392–393 resources, 842–843 decision trees (AI), 622–626 scene graphs, 550 decompressing ZIP files, 713–715 scripts (Lua), 389 single/multiple monitor comparison, 807–808

Index 891 defining dialogue/speech, 434–435 actors, 165–168, 170–171 background, 436, 438–439 classes, audio, 399–400 barks, 439–440 components, 165–168, 170–171 lip synching, 440–441 controls, 298–300 localization, 440 events, 309–312 NPCs, 634, 638 functions (Lua), 350 overview, 439 player objectives, 440 DelayProcess class, 186–187 recording, 441 delegates (event handlers), 313–314 text supplement, 440 demos, 878 design dining philosophers’ problem, 703–704 code C++, 59–60 Direct3D (DirectX), 50 class hierarchies, 60–61 DirectInput (DirectX), 51, 243–245 class inheritance, 63 directories debug builds, 68 destructors, 59–60 files, 100–103 encapsulation, 66–67 game engines, 103–104 factories, 65–66 save game directories, 146–147 hidden code, 59–60 tools, 103–104 initializing objects, 67–68 DirectSound, 50–51, 414–426 interface classes, 64–65 DirectX non-trivial operations, 59–60 audio, 50–51 object composition, 61 debugging object inheritance, 61 overview, 58–59 graphics, 812–813 streams, 67 missing resources, 808 template method design pattern, 63 PIX, 812–813 virtual functions, 61–64 pixels, 808, 812–813 shaders, 812–813 scripting languages, 335 surfaces, 808 designers, 5–6 Dialog Resource Manager, 270–271 destroying actors, 323–324 Direct3D, 50 destructors (design practices), 59–60 DirectInput, 51, 243–245 developing DirectSound, 50–51, 414–426 initializing, 145 code styles, 95 input, 51 games main loops callback functions, 191–193 operating systems, 21–22 overview, 189 planning, 18 rendering displays, 190–191 schedules, 19–21 updating, 191 tools, 17 OpenGL, 50 interfaces, efficiency, 766 overview, 49–50 scripts (Lua), 389 resource caches, 233 dialog boxes Text Helper, 270–271 controls disappearing bugs, 825 defining, 298–300 disasters (troubleshooting), overview, 297–298 DirectX Dialog Resource Manager, 270–271 875–876 message boxes, creating, 286–292 discoverability (controls) modal dialog boxes closing on shutdown, 150–151 dragging, 304 creating, 292–297 players, 247 Dialog Resource Manager (DirectX), 270–271 displays. See screens distance (physics), 569–576

892 Index events. See also controls actors, destroying, 323–324 DLLs build times, 310 application layer, 34–35 creating games, 737, 741–745 C# editor data, 309–312 architecture, 763–764 defining, 309–312 methods, 767–768 dragging, 304 event handlers DNS (Domain Name System), 648–649, 653–654 controls, 241–243 documentation, 98 delegates, 313–314 Domain Name System (DNS), 648–649, 653–654 keyboards, 262–267 doors (collisions), 585–586 mouse, 249–255 dot products (vectors), 450–453 game logic layer, 38–39 dragging GUIDs, 310–312 initializing, 144–145 controls, 304 managing mouse, 252–255 death, 309 drawing (debugging techniques/tips), 823–824 Event Managers, 314–324, 380–387 drivers (debugging), 844–845 Lua/C++ communication, 380–387 DUMPBIN.EXE utility, 806 overview, 307–309 dumps (debugging), 810–812 multiplayer games (sockets), 686–692 dynamic avoidance (AI), 640–641 physics SDKs, 606–608 processes comparison, 326 E receiving, 711–713 sending, 708–711 editing (C# editor) sharing data, 173–174 components, 792–794 streams, 311 EditorForm class, 772–784 types of, 324–326 EditorForm class (C# editor), 772–784 exhaustion, 872–873 editors exiting. See shutdown experiment-driven process, 813–817 C# editor. See C# editor exporting scripts (Lua), 368–370 changing, 765 testing, 765 F effects (audio), 435–436 efficiency (developing interfaces), 766 factories (objects), 65–66 employees. See teams fading music, 436 encapsulation, 66–67 features, removing, 871–872 ending. See finishing feedback (players), 246–247, 302 equations (quadratic equations), 87–88 fidelity (controls), 241, 247–248 error logging systems, 828–835 file systems (resource caches), 31–33 errors files. See also data; resources crashing, 799 error logging systems, 828–835 audio error messages, 840 backups, 395 finding, 803 formats, 395–396 handling, 798–800 loading, 401–408 Windows functions, 800 Euler angles, 469 copying/sharing debugging event handlers comparison, 809 controls, 241–243 delegates, 313–314 debugging keyboards, 262–267 MAP files, 800–802 PDB files, 801–802 Alt keys, 267 Windows symbol files, 805–807 Function keys, 265 mouse, 249–255 event managers, 314–324, 380–387

Index 893 directories 3D object meshes, 197–200 files, 100–103 animation, 200–202 game engines, 103–104 audio, 205–206 save game directories, 146–147 bitmaps, 202–205 tools, 103–104 cinematics, 206–209 colors, 202–205 file systems (resource caches), 31–33 compression, 208–209 Internet, 649–650 levels, 202 loading lossy compression, 204 maps, 202 audio, 401–408 music, 205–206 progress bars, 408 overview, 197 time, 564 textures, 202, 204–205 managing, 15 video, 206–209 resources frame rates, 824 callback functions, 212 framework functions (C# editor), 753–756 data compression, 212–218 frequencies (process values), 744 overview, 209–211 frustums (quaternions), 474–478 packaging, 211 full-screen games (debugging), 807–808 performance, 212 Function keys, 265 storing (relative paths), 784 functions Zip (background decompressing), 713–715 C# editor filler speech. See barks actors, 756–763 finding errors, 803 framework, 753–756 finishing projects C++, 363–366 alpha milestone, 854 callback functions beta milestone, 854 DirectX, 191–193 breaks, 879–880 message queue, 212 code, 857–862 InitInstance, 136–137 comments, 859–862 Lua, 342–343 debugging, 852–857, 860–861 defining, 350 last-minute content changes, 862–864 exporting, 368–370 overview, 851–852, 876–877 registering, 357 patch builds, 878 LuaPlus, 363–366 performance, 854–855 namespaces, 830 postmortems, 878–879 speed, 167 product demos, 878 static functions, 830 smoke testing, 853 virtual functions, 61–64 testing archives, 877–878 Windows (error handling), 800 finite state machines (AI), 616–622 future, multithreading, 718 first-to-market releases, 874–875 fuzzy logic (AI), 627–630 fixed-function 3D graphics, 445 floating-point numbers (3D graphics), 447–448, 450 G flow control (Lua), 346–348 focus game editors design (scripting languages), 335 C# editor. See C# editor order (controls), 300 changing, 765 folders. See directories testing, 765 fonts (DirectX), 270–271 for statements (Lua), 346–348 game engines force (physics), 571–574, 603–604 C# editor, 753–763 formats directory structures, 103–104 audio, 395–396 artist limitations, 43 resources game logic, initializing, 145

894 Index geometry (collisions), 582–583 global memory (RAM), 75 game logic layer global variables collisions, 37–38 command interpreters, 40–41 Lua variables, 356 creating games, 723–733 LuaPlus, 361–362 data structures, 36–37 globalization events, 38–39 application layer, 34 networks, 47–48 interfaces, 305 overview, 35–36 GOAP (goal-oriented action planning), 635–636 physics, 37–38 graphical user interfaces. See interfaces process managers, 39 graphics state, 36–37 3D graphics. See 3D graphics debugging, 812–813 game views. See interfaces; views; windows displays (game views), 41–43 GameCodeApp class, 135–136 gravity (physics), 571–572 gamepads GUIDs (events), 310–312 GUIs. See interfaces acceleration, 261–262 dead zones, 256–259 H normalizing input, 259–261 one-stick design, 261 HAL (hardware abstraction layer), 243–244 overview, 255–256 handedness (3D graphics), 449 twitch-looks, 257 handlers. See event handlers two-stick design, 261 handles (audio), 398–408 games. See also projects handling architecture. See architecture controls. See controls errors, 798–800 creating events. See event handlers messages (C# editor), 769–772 application layer, 722–723 hard drives events, 737, 741–745 debugging space, 842–843 game logic layer, 723–733 initializing (storage space), 138–139 game views, 733–736 ticking (troubleshooting), 212 loading levels, 737–739 hard-coding managing actors, 739–741 AI, 612–614 overview, 719–722 audio, 437 developing hardware operating systems, 21–22 debugging, 845 planning, 18 hardware abstraction layer, 243–244 schedules, 19–21 input. See input tools, 17 overview, 8 game engines quality, initializing, 141 C# editor, 753–763 threads, 717 directory structures, 103–104 understanding, 210–211 artist limitations, 43 hardware abstraction layer (HAL), 243–244 initializing. See initialization heap input. See input debugging, 835–839 multiplayer games. See multiplayer games RAM, 76 shutdown help context-sensitive), 304 application layer, 33–35 hidden code, 59–60 closing modal dialog boxes, 150–151 hierarchies (classes) consoles, 152–153 audio, 397–398 managing, 148–153 design practices, 60–61 overview, 129, 147–148 screens, 299 physics SDKs, 595–596 sockets API, 654–655

Index 895 history, programming languages physics SDKs, 594–595 assembly languages, 331 sockets API, 654–655 C++, 331–333 InitInstance function, 136–137 overview, 330 innovation code, 14–15 hit testing, 300–301, 305 interfaces, risks, 246 hobbyists, 4 input. See also controls hot keys (controls), 303 controls hulls (collisions), 580–586 fidelity, 241 I normalizing, 259–261 DirectX, 51 if statements (Lua), 346–347 keyboards images. See graphics Alt keys, 267 Impact Software website, 302 events, 262–267 implementing Function keys, 265 hot keys, 303 actors, 170–171 WASD conrols, 281–283, 736 components, 170–171 reading, 31 scene graphs, 539 screen elements, 283–286 Indie Games Festival website, 246 instances (multiple, initializing), 137–138 inertia (physics), 574 instruction pointers (debugging), 804–805, 818–820 inheritance integrating (physics SDKs) classes components, 593–594 creating convex meshes, 601–602 building actors, 155–159 creating objects, 599–601 design practices, 63 creating triggers, 602–603 Lua/C++, 379 debugging, 604–606 objects (design practices), 61 events, 606–608 initializing force, 603–604 application layer, 33–35 initializing, 594–595 CPU speed, 140 overview, 588–593 creating game logic, 145 shutdown, 595–596 creating views, 145 torque, 603–604 creating windows, 145 udating, 596–599 DirectX, 145 interface class (scene graphs), 524–526 events, 144–145 interfaces. See also views; windows GameCodeApp class, 135–136 audio (architecture), 408–414 hard drive storage space, 138–139 C# editor hardware quality, 141 actors list, 777–780 loading cache resources, 141–142, 147 asset tree, 775–777 loading text strings, 142–144 controls, 772–784 memory, 139–140 menu bar, 780–784 multiple instances, 137–138 classes overview, 133 controls, 241–243 resource caches, 141–142, 147 design practices, 64–65 save game directories, 146–147 interface class (scene graphs), 524–526 script managers, 144–145 controls. See controls system resources, 136–137 developing (efficiency), 766 WinMain, 133–135 dialog boxes. See dialog boxes C# editor clases, 786–787 globalization, 305 C++, 130–133 innovation, risks, 246 InitInstance function, 136–137 keyboards objects, 67–68 overview, 129–130

896 Index L interfaces. See also views; windows (continued) languages hot keys, 303 assembly, 331, 797–798, 820–822, 845–846 WASD conrols, 281–283, 736 programming languages. See programming languages localization, 305 scripting languages. See scripts/scripting open source, 305 languages overview, 269 players launching audio, 431–432 layers testing, 247 understanding, 306 application layer. See application layer resource caches, 222 game logic layer screens aspect ratio, 290 collisions, 37–38 class hierarchies, 299 command interpreters, 40–41 debugging, 807–808 creating games, 723–733 elements, 283–286 data structures, 36–37 full-screen games, 807–808 events, 38–39 managing transitions, 284 networks, 47–48 rendering displays, 190–191 overview, 35–36 techniques/tips, 304–306 physics, 37–38 text (DirectX Text Helper), 270–271 process managers, 39 internationalization (globalization) state, 36–37 application layer, 34 hardware abstraction layer, 243–244 interfaces, 305 leadership (schedules), 867 Internet leaks (memory), 148, 835–839 DNS, 648–649 legal matters (non-disclosure agreements), 2 files, 649–650 Level of Detail for 3D Graphics website, 237 IP addresses, 646–648 levels overview, 643 loading, 737–739 programs, 649–650 resources, 202 protocols, 644–645 libraries sockets. See sockets DLLs TLDs, 648–649 application layer, 34–35 IP addresses, 646–648 C# editor architecture, 763–764 C# editor methods, 767–768 J tolua++, 357 light manager class, 552–554 jobs light node class, 551–554 non-disclosure agreements, 2 light nodes, 551–554 overview, 1–3 lighting stability, 22–23 3D graphics, 482–484 scene graphs, 539 joysticks. See two-axis controls light nodes, 551–554 managing, 552–554 K limitations artists, 43 keyboards (controls) scripting languages, 336–337 Alt keys, 267 Lint, 824–825 events, 262–267 lip synching, 440–441 Function keys, 265 listener registries (Event Managers), hot keys, 303 WASD conrols, 281–283, 736 314–324, 380–387 listening (sockets), 673–675 keyword, auto, 164–165 kilohertz, 392

Index 897 loading comments, 340 debug builds, 68 curly braces ({}), 346 files flow control, 346–348 audio, 401–408 for statements, 346–348 progress bars, 408 functions, 342–343 time, 564 levels, 737–739 C++ functions, 363–366 resources, 224–225 defining, 350 initializing, 141–142, 147 if statements, 346–347 tracking, 222–224 loops, 346–348 text strings, 142–144 LuaPlus textures, 491–494 functions, 363–366 threads, priorities, 706 global variables, 361–362 objects, 358–360 localization overview, 357–358 application layer, 34 state, 358 dialogue/speech, 440 tables, 360–361 interfaces, 305 memory, managing, 356 object-oriented programming logging class abstractions, 353–355 debugging techniques/tips, 826 metatables, 351–353 error logging systems, 828–835 overview, 349–350 vector objects, 349–350 logic operators, 348–349 fuzzy logic (AI), 627–630 overview, 339–340 game logic, initializing, 145 scripts game logic layer C++ class inheritance, 379 collisions, 37–38 components, 387–389 command interpreters, 40–41 debugging, 389 creating games, 723–733 developing, 389 data structures, 36–37 exporting, 368–370 events, 38–39 managing actors, 387–389 networks, 47–48 managing process, 370–379, 619 overview, 35–36 state, managing, 367–368 physics, 37–38 tables, 343–346 process managers, 39 variables, 340–341 state, 36–37 global variables, 356 logic class (C# editor), 750–751 naming, 341, 355 nil value, 341 logic class (C# editor), 750–751 private variables, 355 login servers, 826–827 public variables, 355 loops scope, 341 website, 390 Lua, 346–348 while statements, 346–347 main loops. See main loops luabind, 357 lossy compression, 204 Lua LuaPlus AI, 617 functions, 363–366 C++ global variables, 361–362 objects, 358–360 binding, 356–357 overview, 357–358 C API, 356 state, 358 class inheritance, 379 tables, 360–361 Event Managers, 380–387 functions, 363–366 luabind, 357 registering functions, classes, 357 tolua++ library, 357

898 Index MAP files (debugging), 800–802 mapping controls, 243–245 M maps (resources), 202 mass (physics), 571–574 main loops materials (3D graphics), 484–487 application layer, 33–35 math cooperative multitasking, 178–188 data-driven processes, 187 3D graphics DelayProcess class, 186–187 axes, 446–447 DirectX coordinates, 446–449 callback functions, 191–193 floating-point numbers, 447–448 overview, 189 handedness, 449 rendering displays, 190–191 orientation, 446–447 updating, 191 overview, 445–446 multithreading, 176–178 units of measurement, 448 operating systems, 188–189 vectors, 449–455 overview, 175–176 vectors, calculating angles, 450–453 Process class, 178–183, 187–188 vectors, cross products, 453–455 ProcessManager class, 183–185 vectors, dot products, 450–453 ScriptProcess class, 370–379, 619 vectors, floating-point numbers, 450 updating, 176 vectors, normalizing, 449–450 vectors, scalars, 450 managed/unmanaged code comparison, vectors, targets, 452–455 766–767 vectors, unit vectors, 449–453 managers C++ classes memory managers clipping planes, 481 application layer, 33 matrices, 458–469 creating, 82–84, 232 matrices, 4X4, 459 socket managers, 675–684 matrices, moving objects, 462–469 matrices, multiplying, 463 managing matrices, rotation, 459–469 actors matrices, unit circles, 459–461 C# editor, 784–795 overview, 456 creating games, 739–741 quaternions, compression, 471 Lua scripts, 387–389 quaternions, Euler angles, 469 code, 766–767 quaternions, frustums, 474–478 events quaternions, overview, 469–473 death, 309 quaternions, planes, 473–474 Event Managers, 314–324 transformations, 478–481 Lua/C++ communication, 380–387 vectors, 456–458, 481–482 overview, 307–309 files, 15 physics. See physics Lua scripts process, 370–379, 619 matrices memory application layer, 33 3D graphics (C++ math classes), creating, 82–84, 232 458–469 Lua, 356 processes (audio), 426–431 4X4, 459 resource caches, 233–237 moving objects, 462–469 scene graphs (light manager), 552–554 multiplying, 463 screen transitions, 284 rotation, 459–469 shutdown, 148–153 unit circles, 459–461 sockets, 675–684 scene graphs, 538–539, 541–542 state measuring bugs, 853–854 controls, 240–243 meetings (postmortems), 878–879 Lua, 367–368

Index 899 memory minidumps (debugging), 810–812 accessing, 78–79 mip-mapping (textures), 490–491 alignment (speed), 80–81 missing resources (debugging), 808 CPU caches, 78–79, 81 mixing audio, 434–436 debugging, 842–843 modal dialog boxes data corruption, 839–840 memory leaks, 835–839 closing on shutdown, 150–151 stack corruption, 840–842 creating, 292–297 Task Manager, 839 monitors, single/multiple debugging debugging techniques/tips, 822–824 initializing, 139–140 comparison, 807–808 leaks, 148, 835–839 morale, 867, 873–874 managing (Lua), 356 mouse. See also two-axis controls memory managers application layer, 33 capturing, 249–252 creating, 82–84, 232 cursors (player feedback), 246–247, 302 memory pools, 88–95 dragging, 252–255 optimizing, 78–79 event handlers, 249–255 RAM moving objects (C++ math classes), 462–469 global memory, 75 MSVSMON.EXE debugging utility, 810 heap, 76 MSVSMON.EXE utility, 809 overview, 75–77 multiplatform projects, 108–110 stack, 75–76 multiplayer games VRAM (video RAM), 78 game views, 45 scripting languages, 336 networks, 48 threads (smart pointers), 73 sockets types, 75 virtual memory, 33, 81–82 client connections, 666–669, 673–675 data packets, 665–666, 670–673 memory pools, 88–95 events, 686–692 menu bar (C# editor interface), 780–784 listening, 673–675 Mersenne Twister pseudo random number overview, 663–665 server connections, 668–670, 684–686 generator, 85–87 socket managers, 675–684 meshes multiple instances, initializing, 137–138 multiple projects, sharing code, 127–128 3D graphics, 494–497 multiple resource caches, 220 3D object meshes, 197–200 multiple/single monitor debugging convex meshes (physics SDKs), 601–602 object collisions, 580–586 comparison, 807–808 scene graphs, 560–564 multiplying matrices (C++ math classes), 463 message boxes, creating, 286–292 multiprogramming. See multithreading message queue (callback functions), 212 multitasking (cooperative multitasking), MessageHandler class (C# editor), 769–772 messages 178–188 errors (debugging), 840 multithreading. See also threads handling (C# editor), 769–772 message boxes, creating, 286–292 audio, 396–397 message queue (callback functions), 212 CPU, 693–696 MessageHandler class (C# editor), 769–772 debugging, 843–844 metatables (Lua), 351–353 main loops, 176–178 methods (C# editor), 767–768 overview, 693 Microsoft Debugging Tools, 806–807 real-time processes milestone builds, 124–127 classes, 705–708 loading priorities, 706 overview, 704–705 receiving events, 711–713 sending events, 708–711

900 Index lighting, 539 matrices, 538–539, 541–542 multithreading. See also threads (continued) meshes, 560–564 threads root nodes, 538, 545–548 background decompressing Zip files, 713–715 scene node class, 529–536 creating, 696–698 sky nodes, 554–560 deadlock, 703–704 non-disclosure agreements, 2 dining philosophers’ problem, 703–704 non-trivial operations, 59–60 future, 718 normal builds, 123–124 hardware, 717 normalizing mutexes, 699–700 input (controls), 259–261 racing, 702 vectors (3D graphics), 449–450 safety, 704 normals (3D graphics), 482–484 semaphores, 699–700 NPCs, dialogue/speech, 634, 638 setting, 699–700 numbers stacks, 697 algorithms, 87–88 starvation, 703–704 bug numbers, 860–861 storing data, 697 floating-point numbers, 447–448, 450 synchronizing processes, 698–702 quadratic equations, 87–88 techniques/tips, 715–716 random number generators, 85–87 testing, 699–700 windows (C# editor), 766 Windows critical section, 700–702 Nu-Mega BoundsChecker, 825 music O composers, 6 debugging techniques/tips, 827, 844 objectives (character dialogue/speech), 440 fading, 436 object-oriented programming (Lua) recording, 438 resources, 205–206 class abstractions, 353–355 streaming, 400 metatables, 351–353 overview, 349–350 mutexes (threads), 699–700 vector objects, 349–350 objects. See also actors; components N 3D object meshes, 197–200 audio, 432 naked pointers, 68–69 black, 485 namespaces (static functions), 830 C++ naming Lua variables, 341, 355 NativeMethods class (C# editor), 767–768 compression, 471 networks debugging, 819–820 Euler angles, 469 architectures frustums, 474–478 game logic layer, 47–48 moving, 462–469 game views, 47 overview, 469–473 multiplayer games, 48 planes, 473–474 overview, 46–47 rotating, 459–469 serializing, 690 communication (application layer), 34–35 collisions debugging (copying/sharing files), 809 characters, 583–586 outages (SneakerNet), 110–111 collision systems, 586–588 next statements (debugging), 818–820 doors, 585–586 nil value (Lua variables), 341 game logic layer, 37–38 nodes (scene graphs) geometry, 582–583 actors, 539, 542 hulls, 580–586 additional, 565 meshes, 580–586 alpha pass, 542–544 camera nodes, 548–551 cameras, 538 light nodes, 551–554

Index 901 physics. See physics overview, 349–350 properties, 578–580 vector objects, 349–350 raycasting, 577, 586–588 Open scripts, 126 SDKs. See SDKs open source shapecasting, 586, 588 data compression (Zlib), 213–218 stairs, 585–586 interfaces, 305 testing, 583 OpenGL, 50 time, 585 operating systems trees, 585–586 debugging, 845 data structures, 36–37 developing games, 21–22 debugging main loops, 188–189 C++, 819–820 operators (Lua), 348–349 surfaces, 808 optimizing. See also debugging; techniques/tips; test objects, 824 design practices testing; troubleshooting composition, 61 code, 847–849 factories, 65–66 memory access, 78–79 inheritance, 61 options initializing, 67–68 builds (Visual Studio), 104–108 events. See events game views, 45 game logic layer, 36–37 orientation LuaPlus, 358–360 3D graphics, 446–447 mapping controls, 243, 245 objects (C++ math classes) object-oriented programming (Lua) class abstractions, 353–355 compression, 471 metatables, 351–353 Euler angles, 469 overview, 349–350 frustums, 474–478 vector objects, 349–350 overview, 469–473 physics planes, 473–474 acceleration, 569–574 OSs (operating systems) angular velocity, 574–575 debugging, 845 center of mass, 574 developing games, 21–22 collisions, 575–576 main loops, 188–189 distance, 569–571, 575–576 outages (networks), 110–111 force, 571–574 overloading controls, 246 game logic layer, 37–38 overtime (schedules), 865–868 gravity, 571–572 inertia, 574 P mass, 571–574 rotation, 574 packaging (resources), 211 time, 574 packets (sockets), 665–666, 670–673 torque, 574–575 parentheses. See braces units of measure, 569 paste bugs, 842 velocity, 569–571, 574–575 patch builds, 878 state, 36–37 pathfinding (AI) vector objects (Lua), 349–350 OGG files, 403–408 A* (A-Star), 638–640 one-axis controls (state), 240 dynamic avoidance, 640–641 one-stick design (gamepads), 261 overview, 636–638 OOP (Lua) PDB files (debugging), 801–802 class abstractions, 353–355 percentages (variables), 625 metatables, 351–353 Perforce (source repositories), 113–114 performance finishing projects, 854–855 profiling (debugging), 846–847 resources, 212

902 Index players controls. See controls personnel. See teams feedback (cursors), 246–247, 302 physics game views. See interfaces; views; windows input. See input objects interacting with, 3–4 acceleration, 569–574 multiplayer games. See multiplayer games angular velocity, 574–575 objectives (character dialogue/speech), 440 center of mass, 574 testing, 247 collisions, 567–568, 575–576 understanding, 306 distance, 569–571, 575–576 force, 571–574 pointers game logic layer, 37–38 C++ objects, 690 gravity, 571–572 instruction pointers, 818–820 inertia, 574 naked pointers, 68–69 mass, 571–574 sharing data, 172–174 rotation, 574 smart pointers time, 574 C++ shared_ptr, 71–75 torque, 574–575 memory (threads), 73 units of measure, 569 overview, 68–69 velocity, 569–571, 574–575 reference counting, 69–70 troubleshooting, 73–75 SDKs choosing, 576–578, 609 polling (state), 240 components, 593–594 ports (sockets), 658–659 creating convex meshes, 601–602 postmortems, 878–879 creating objects, 599–601 preloading. See loading creating triggers, 602–603 prime numbers (quadratic equations), 87–88 debugging, 604–606 printing error messages (debugging), 840 events, 606–608 priorities, loading threads, 706 force, 603–604 private variables (Lua), 355 initializing, 594–595 Process class, 178–183, 187–188 integration overview, 588–593 process managers shutdown, 595–596 torque, 603–604 game logic layer, 39 udating, 596–599 game views, 44 processes pipeline (3D graphics), 444–445 3D graphics, 444–445 PIX (debugging), 812–813 audio, 426–431 pixel shaders builds, 118–120 data-driven processes (main loops), 187 C++ helper class, 516–520 events comparison, 326 overview, 515–516 frequency values, 744 rendering, 520–521 Lua scripts, 370–379, 619 pixels process managers debugging, 808, 812–813 pixel shaders game logic layer, 39 game views, 44 C++ helper class, 516–520 real-time processes overview, 515–516 classes, 705–708 rendering, 520–521 loading priorities, 706 PKZIP utility, 196 overview, 704–705 planes receiving events, 711–713 clipping planes, 481 sending events, 708–711 quaternions, 473–474 synchronizing (threads), 698–702 planning (developing games), 18 ProcessManager class, 183–185 platforms overview, 8–13 multiplatform projects, 108–110

Index 903 producers (teams), 6 object collisions, 578–580 product demos, 878 scene graphs, 526–529 profession. See jobs protocols professionalism, 874 Internet, 644–645 profiling TCP, 644–645 UDP, 644–645 optimizing code, 847–849 prototyping (scripting languages), 334–335 overview, 846 psycho-history, 58 performance, 846–847 public variables (Lua), 355 Program class (C# editor), 768–769 Python, 338–339 programmable 3D graphics, 445 programmers, 4–5 Q programming languages defined, 334 quadratic equations, 87–88 history quality, 141 quaternions (C++ math classes) assembly languages, 331 C++, 331–333 compression, 471 overview, 330 Euler angles, 469 overview, 329 frustums, 474–478 scripting languages comparison, 334, 336–337 overview, 469–473 programs (Internet), 649–650 planes, 473–474 progress bars, loading files, 408 queues (callback functions), 212 project managers, 6 projects. See also games R automating, 98 building overview, 118–120 racing (threads), 702 builds. See builds RAD Game Tools website, 50 directories RAM. See also memory files, 100–103 game engines, 103–104 global memory, 75 tools, 103–104 heap, 76 documentation, 98 overview, 75–77 finishing stack, 75–76 alpha milestone, 854 VRAM (video RAM), 78 beta milestone, 854 random number generators, 85–87 breaks, 879–880 random set traversal, 87–88 code, 857–862 randomization (AI), 614–616 comments, 859–862 rapid prototyping (scripting languages), 334–335 debugging, 852–857, 860–861 raycasting (collisions), 577, 586–588 last-minute content changes, 862–864 readers (audio), 396–397 overview, 851–852, 876–877 reading patch builds, 878 batching (resource caches), 235 performance, 854–855 input, 31 postmortems, 878–879 readers (audio), 396–397 product demos, 878 sockets, 663 smoke testing, 853 real-time processes testing archives, 877–878 classes, 705–708 multiplatform, 108–110 loading priorities, 706 multiple, sharing code, 127–128 overview, 704–705 restarting, 875–876 receiving events, 711–713 starting overview, 97–99 sending events, 708–711 promoting builds, 853 Real-Time Rendering website, 575 properties receiving events, 711–713

904 Index callback functions, 212 data compression, 212–218 recording audio, 393–395 overview, 209–211 dialogue/speech, 441 packaging, 211 music, 438 performance, 212 volume, 437 formats 3D object meshes, 197–200 reducing complexity (debugging), 817–818 animation, 200–202 reference counting (smart pointers), 69–70 audio, 205–206 registering Lua functions, classes, 357 bitmaps, 202–205 relative paths (storing files), 784 cinematics, 206–209 release builds (debugging), 843 colors, 202–205 releases, first to market, 874–875 compression, 208–209 remote debugging, 808–810 levels, 202 removing features (schedules), 871–872 lossy compression, 204 rendering maps, 202 music, 205–206 displays, 190–191 overview, 197 scene graphs, 526–529 textures, 202, 204–205 video, 206–209 root nodes, 545–548 loading, 141–142, 147 scene class, 539–541 overview, 195–197 sky nodes, 554–560 storage, 197 shaders, 520–521 restarting projects, 875–876 reporting bugs, 846 restoring scene graphs, 539–541 repositories (source code) reticles. See cursors Avid AlienBrain, 114–115 risks, innovation, 246 branching, 115–118, 127–128 RNG (random number generators), 85–87 Microsoft Visual SourceSafe, 111–112, 114 root nodes (scene graphs), 538, 545–548 overview, 110–111 rotation Perforce, 113–114 C++ math classes, 459–469 sandboxes, 116–118 physics, 574 SneakerNet, 110–111 running controls, 248 Subversion, 112–113 runtime analyzers, 825 TortoiseSVN, 112–113 reproduction S audio, 393–395 bugs, 817 safety (threads), 704 resources. See also data; files sandboxes (source repositories), 116–118 3D graphics, 444 saving audio, 398–408 caches debug builds, 68 batching reads, 235 save game directories, 146–147 buffer zones, 234 scalars (vectors), 450 building, 225–233 scene class (scene graphs), 536–544 DirectX, 233 actors, 539, 542 file systems, 31–33 alpha pass, 542–544 initializing, 141–142, 147 cameras, 538 interfaces, 222 implementing, 539 loading, 224–225 lighting, 539 managing, 233–237 matrices, 538–539, 541–542 multiple, 220 rendering, 539–541 overview, 218–222 restoring, 539–541 tracking loaded resources, 222–224 world design, 233–237 debugging, 808, 842–843 files

Index 905 root nodes, 538, 545 elements, 283–286 updating, 539–541 full-screen games, 807–808 scene graphs managing transitions, 284 axis-aligned bounding boxes, 528 rendering displays, 190–191 bounding spheres, 528 Script Creation Utility for Maniac Mansion camera node class, 548–551 debugging, 550 (SCUMM), 334 interface class, 524–526 script managers, initializing, 144–145 light manager class, 552–554 ScriptProcess class (main loops), 370–379, 619 light node class, 551–554 scripts/scripting languages. See also code meshes, 560–564 nodes, additional, 565 benefits, 337–338 overview, 523–524 build scripts properties, 526–529 rendering, 526–529 automating, 121–122 Close scripts, 126 root node class, 545–548 milestone builds, 124–127 scene class, 539–541 normal builds, 123–124 root node class, 545–548 Open scripts, 126 scene class, 536–544 updating, 124 actors, 539–542 choosing, 338 alpha pass, 542–544 creating, 337 cameras, 538 defined, 334 implementing, 539 design-focused, 335 lighting, 539 limitations, 336–337 matrices, 538–539, 541–542 Lua. See Lua rendering, 539–541 memory, 336 restoring, 539–541 overview, 329 root nodes, 538, 545 programming languages comparison, 334, 336–337 updating, 539–541 Python, 338–339 scene node class, 529–536 rapid prototyping, 334–335 sky node class, 554–560 Script Creation Utility for Maniac Mansion scene node class (scene graphs), 529–536 scenes. See scene graphs (SCUMM), 334 schedules script managers, initializing, 144–145 developing games, 19–21 ScriptProcess class (main loops), 370–379, 619 finishing projects, 862–864 SCUMM, 334 troubleshooting speed, 336 adding team members, 868–869 SCUMM (Script Creation Utility for Maniac breaks, 866 changing, 869–870 Mansion), 334 debugging, 871–872 SDKs (software development kits), 7 leadership, 867 overtime, 865–868 choosing, 576–578, 609 removing features, 871–872 components, 593–594 scientific methodology (debugging techniques/tips), creating convex meshes, 601–602 creating objects, 599–601 813–817 creating triggers, 602–603 scintillation (textures), 488–490 debugging, 604–606 scope (Lua variables), 341 events, 606–608 screens. See also interfaces force, 603–604 initializing, 594–595 aspect ratio, 290 integration overview, 588–593 class hierarchies, 299 shutdown, 595–596 debugging, 807–808 torque, 603–604 udating, 596–599 seeds, 85 semaphores (threads), 699–700

906 Index socket managers, 675–684 sockets sending events, 708–711 serializing (C++ objects), 690 Berkeley, 645–646 servers Internet, 645–646 multiplayer games login servers (debugging), 826–827 sockets client connections, 666–669, 673–675 data packets, 665–666, 670–673 connecting, 668–670, 684–686 events, 686–692 sockets API, 660–662 listening, 673–675 sets, random traversal, 87–88 overview, 663–665 setting threads, 699–700 server connections, 668–670, 684–686 shaders socket managers, 675–684 compiling (speed), 500 socket managers, 675–684 debugging, 812–813 sockets API overview, 499–501, 521 connecting sockets, 658–659 pixel shaders creating sockets, 655–659 C++ helper class, 516–520 DNS, 653–654 overview, 515–516 initialization, 654–655 vertex shaders overview, 650 C++ helper class, 507–515 ports, 658–659 compiling, 505–507 reading sockets, 663 overview, 501–505 servers, 660–662 rendering, 520–521 shutdown, 654–655 shapecasting (object collisions), 586, 588 utility functions, 651–653 shared_ptr (C++ smart pointers), 71–75 writing sockets, 663 sharing Winsock, 645–646 code (multiple projects), 127–128 sockets API copying files comparison, 809 connecting sockets, 658–659 data creating sockets, 655–659 events, 173–174 DNS, 653–654 overview, 171 initialization, 654–655 pointers, 172–174 overview, 650 transforms, 171–172 ports, 658–659 shared_ptr (C++ smart pointers), 71–75 reading sockets, 663 showing components, 789–792 servers, 660–662 shutdown shutdown, 654–655 application layer, 33–35 utility functions, 651–653 closing modal dialog boxes, 150–151 writing sockets, 663 consoles, 152–153 software development kits. See SDKs managing, 148–153 sound. See audio overview, 129, 147–148 sound waves, 394–395 physics SDKs, 595–596 source code repositories sockets API, 654–655 Avid AlienBrain, 114–115 single/multiple monitor debugging comparison, branching, 115–118, 127–128 Microsoft Visual SourceSafe, 111–112, 114 807–808 overview, 110–111 sky nodes (scene graphs), 554–560 Perforce, 113–114 smart pointers sandboxes, 116–118 SneakerNet, 110–111 C++ shared_ptr, 71–75 Subversion, 112–113 memory (threads), 73 TortoiseSVN, 112–113 overview, 68–69 speech. See dialogue/speech reference counting, 69–70 troubleshooting, 73–75 smoke testing, 853 SneakerNet, 110–111

Index 907 speed. See also time data (threads), 697 acceleration files (relative paths), 784 gamepad controls, 261–262 hard drives, initializing, 138–139 physics, 569–574 resources, 197 CPU, initializing, 140 streams functions, 167 audio, 399 memory, alignment, 80–81 code design practices, 67 profiling events, 311 optimizing code, 847–849 music, 400 overview, 846 strings performance, 846–847 application layer, 34 scripting languages, 336 initializing, 142–144 shaders, compiling, 500 styles (code) velocity (physics), 569–571, 574–575 braces, 55–56 consistency, 56–58 stability (jobs), 22–23 developing, 95 stack overview, 54 subsampling (textures), 488–490 corruption (debugging memory), 840–842 Subversion, 112–113 RAM, 75–76 surfaces (debugging), 808 threads, 697 symbol files (debugging), 805–807 stairs (collisions), 585–586 SYMCHK utility, 806–807 starting projects overview, 97–99 synchronizing. See also time starvation (threads), 703–704 audio, 432–434 state audio readers/writers, 396–397 AI C# editor, 786 lip synching, 440–441 finite state machines, 617–622 processes (threads), 698–702 utility theory, 630–634 system clock, 34 controls, 301–302 system clock, 34 buttons, 240 System Debug symbols (Visual Studio), 806 callbacks, 240 system RAM. See RAM event handlers, 241–243 system resources, initializing, 136–137 interface classes, 241–243 managing, 240–243 T one-axis controls, 240 polling, 240 tables (Lua), 343–346 three-axis controls, 241 LuaPlus, 360–361 two-axis controls, 241 metatables, 351–353 game logic layer, 36–37 Lua targets LuaPlus, 358 controls, accuracy, 247–248 managing, 367–368 debugging techniques/tips, 824 objects, 36–37 vectors (3D graphics), 452–455 statements Lua Task Manager (debugging memory), 839 for statements, 346–348 TCP protocol, 644–645 if statements, 346–347 teams while statements, 346–347 next statements (debugging), 818–820 animators, 5 static code analysis (debugging), 828 audio engineers, 6 static functions, 830 composers, 6 storage/storing designers, 5–6 actors, 168–170 exhaustion, 872–873 components, 168–170 morale, 867, 873–874

908 Index testing. See also debugging; optimizing; techniques/tips; troubleshooting teams (continued) postmortems, 878–879 archives, 877–878 producers, 6 C# editor, 795 professionalism, 874 controls, 247 programmers, 4–5 game editors, 765 project managers, 6 object collisions, 583 team members smoke testing, 853 adding, 868–869 threads, 699–700 debugging techniques/tips, 827–828 text testers, 6 dialogue/speech supplement, 440 DirectX Text Helper, 270–271 techniques/tips. See also debugging; strings, initializing, 142–144 optimizing; testing; Text Helper (DirectX), 270–271 troubleshooting textures creating, 487–488 debugging loading, 491–494 assembly code, 820–822 mip-mapping, 490–491 BoundsChecker, 825 resources, 202, 204–205 breaks, 828 scintillation, 488–490 C++ object scope, 819–820 subsampling, 488–490 caveman debugging, 826–827 vertices, 487 check routines, 822–823 threads. See also multithreading code analyzers, 824–825 application layer, 34–35 coordinates, 824 background decompressing ZIP coworkers, 827–828 data structures, 822–823 files, 713–715 disappearing bugs, 825 creating, 696–698 drawing, 823–824 deadlock, 703–704 experiment-driven process, 813–817 dining philosophers’ problem, 703–704 frame rates, 824 future, 718 instruction pointers, 818–820 hardware, 717 Lint, 824–825 memory (smart pointers), 73 logging, 826 mutexes, 699–700 memory, 822–824 racing, 702 music, 827, 844 real-time processes next statements, 818–820 overview, 813 classes, 705–708 reducing complexity, 817–818 loading priorities, 706 reproducing bugs, 817 overview, 704–705 runtime analyzers, 825 receiving events, 711–713 scientific methodology, 813–817 sending events, 708–711 static code analysis, 828 safety, 704 targets, 824 semaphores, 699–700 test objects, 824 setting, 699–700 UNIX, 826–827 stacks, 697 values, 825–826 starvation, 703–704 wireframes, 824 storing data, 697 synchronizing processes, 698–702 interfaces, 304–306 techniques/tips, 715–716 threads, 715–716 testing, 699–700 template method design pattern, 63 Windows critical section, 700–702 test objects (debugging), 824 three-axis controls, 241 testers ticking hard drives, 212 bugs, 15–16 teams, 6

Index 909 time. See also speed changing, 869–870 builds (events), 310 debugging, 871–872 loading files, 564 leadership, 867 object collisions, 585 overtime, 865–868 physics, 574 removing features, 871–872 real-time processes smart pointers, 73–75 classes, 705–708 twitch-looks, 257 loading priorities, 706 two-axis controls overview, 704–705 mouse receiving events, 711–713 capturing, 249–252 sending events, 708–711 cursors (player feedback), 246–247, 302 synchronizing dragging, 252–255 audio, 432–434 event handlers, 249–255 audio readers/writers, 396–397 state, 241 C# editor, 786 two-stick design (gamepads), 261 lip synching, 440–441 types of processes (threads), 698–702 events, 324–326 system clock, 34 memory, 75 tips. See techniques/tips U TLDs (top-level domains), 648–649 tolua++ library, 357 Udating (physics SDKs), 596–599 tools UDP protocol, 644–645 Umbra Software website, 43 developing games, 17 understanding directory structures, 103–104 tooltips, 303 hardware, 210–211 top-level domains (TLDs), 648–649 players, 306 torque unit circles (C++ math classes), 459–461 physics, 574–575 unit vectors (3D graphics), 449–453 physics SDKs, 603–604 units of measurement TortoiseSVN, 112–113 3D graphics, 448 touchscreens. See two-axis controls physics, 569 tracking loaded resources, 222–224 UNIX (debugging), 810 tradeshows, 13 unmanaged/managed code comparison, transforms, sharing data, 171–172 transitions (screens), 284 766–767 transformations (C++ math classes), 478–481 updating traversing sets randomly, 87–88 trees (collisions), 585–586 build scripts, 124 triggers (collisions), 602–603 main loops, 176, 191 troubleshooting. See also debugging; optimizing; scene graphs, 539–541 user interfaces. See interfaces techniques/tips; testing users. See players audio, 434 utilities automation, 86–87 debugging bugs, testers, 15–16 disasters, 875–876 DUMPBIN.EXE, 806 hard drives, ticking, 212 MSVSMON.EXE, 809–810 objects, black, 485 SYMCHK, 806–807 random number generators, 86–87 PKZIP, 196 schedules utility functions (sockets API), adding team members, 868–869 651–653 breaks, 866 utility theory (AI), 630–634

910 Index video debugging, 845 V resources, 206–209 VRAM (video RAM), 78. See also memory values absolute values, 625 video RAM, 78. See also memory debugging techniques/tips, 825–826 views. See also interfaces; windows nil (Lua variables), 341 percentages, 625 AI, 45–46 process frequency, 744 audio, 43–44 C# editor, 751–753 variables creating, 145, 271–281 absolute values, 625 creating games, 733–736 global variables (LuaPlus), 361–362 graphics displays, 41–43 Lua, 340–341 interfaces, 44 global variables, 356 multiplayer games, 45 naming, 341, 355 networks, 47 nil value, 341 options, 45 private variables, 355 overview, 41 public variables, 355 process managers, 44 scope, 341 virtual functions, 61–64 percentages, 625 virtual memory, 33, 81–82 Visual SourceSafe, 111–112, 114 vector objects (Lua), 349–350 Visual Studio vectors (3D graphics), 449–455 builds, 104–108 debugging C++ math classes, 456–458, 481–482 calculating angles, 450–453 minidumps, 811 cross products, 453–455 remote debugging, 808–810 dot products, 450–453 System Debug Symbols, 806 floating-point numbers, 450 volume, 434–437 normalizing, 449–450 VRAM (video RAM), 78. See also memory scalars, 450 targets, 452–455 W unit vectors, 449–453 velocity (physics), 569–571, 574–575 walking (controls), 248 version control WASD controls, 281–283, 736 Avid AlienBrain, 114–115 WAV files, loading, 401–403 branching, 115–118, 127–128 wave forms (audio), 394–395 Microsoft Visual SourceSafe, 111–112, 114 websites overview, 110–111 Perforce, 113–114 Bullet Physics, 589, 609 sandboxes, 116–118 Code Project, 313 SneakerNet, 110–111 Impact Software, 302 Subversion, 112–113 Indie Games Festival, 246 TortoiseSVN, 112–113 Level of Detail for 3D Graphics, 237 vertex shaders Lua, 390 C++ helper class, 507–515 RAD Game Tools, 50 compiling, 505–507 Real-Time Rendering, 575 overview, 501–505 Umbra Software, 43 rendering, 520–521 Xiph, 408 vertices Zlib, 213 textures, 487 weighted randoms (AI), 616 vertex shaders while statements (Lua), 346–347 Wii accelerometers, 249 C++ helper class, 507–515 WinDBG, 810 compiling, 505–507 overview, 501–505 rendering, 520–521

Index 911 windowed mode (debugging), 808 Windows Forms (C# editor), 772 windows. See also interfaces; views WinMain, 133–135 Winsock sockets, 645–646 creating, 145 wireframes (debugging techniques/tips), 824 debugging, 803–804 world design (resource caches), 233–237 number (C# editor), 766 wrapping (C# editor), 764 Windows writers (audio), 396–397 critical section (threads), 700–702 writing. See creating debugging X-Z symbol files, 805–807 WinDBG, 810 XInput (Microsoft), 243–245 functions (error handling), 800 keyboards Xiph website, 408 Alt keys, 267 XPathUtility class (C# editor), 787–789 Function keys, 265 Zip files, 713–715 input, 262–267 Zlib open source data compression, 213–218 WinMain (initializing), 133–135

This page intentionally left blank