Tricks of the Windows Game Programming Gurus

Tricks of the Windows Game Programming Gurus

by Andre LaMothe


View All Available Formats & Editions


Tricks of the Windows Game Programmin Gurus, 2E takes the reader through Win32 programming, covering all the major components of DirectX including DirectDraw, DirectSound, DirectInput (including Force Feedback), and DirectMusic. Andre teaches the reader 2D graphics and rasterization techniques. Finally, Andre provides the most intense coverage of game algorithms, multithreaded programming, artificial intelligence (including fuzzy logic, neural nets, and genetic algorithms), and physics modeling you have ever seen in a game book.

Product Details

ISBN-13: 9780672323690
Publisher: Sams
Publication date: 06/28/2002
Series: Other Programming Series
Edition description: SECOND BOOK & CD-ROM
Pages: 1063
Product dimensions: 7.36(w) x 9.20(h) x 2.28(d)

About the Author

Andrè LaMothe (a.k.a. Lord Necron) has been programming for over 24 years and holds degrees in mathematics, computer science, and electrical engineering. He has written numerous articles on the subjects of graphics, game programming, and artificial intelligence. He is the author of Tricks of the Game Programming Gurus, Sams Teach Yourself Game Programming in 21 Days, The Game Programming Starter Kit, The Black Art of 3D Game Programming, and Windows Game Programming for Dummies, all bestsellers. In addition, he coauthored Ciarcia's Circuit Cellar I and II. Mr. LaMothe has also taught at the University of Santa Cruz Extension Multimedia Department.

Last, but not least, Andrè is the founder and CEO of Xtreme Games LLC ( and the Xtreme Games Developers Conference ( He can be reached at

Table of Contents

(NOTE: Each chapter concludes with a Summary.)



1. Journey into the Abyss.

A Little History. Designing Games. Types of Games. Brainstorming on Ideas. The Design Document and Storyboards. Making the Game Fun. The Components of a Game. General Game Programming Guidelines. Using Tools. Setting Up to Get Down—Using the Compiler. An Example: FreakOut.

2. The Windows Programming Model.

The Genesis of Windows. Multitasking and Multithreading. Programming the Microsoft Way: Hungarian Notation. The World's Simplest Windows Program. Real-World Windows Applications (Without Puck). The Windows Class. Registering the Windows Class. Creating the Window. The Event Handler. The Main Event Loop. Making a Real-Time Event Loop. Opening More Windows.

3. Advanced Windows Programming.

Using Resources. Working with Menus. Introduction to GDI (Graphics Device Interface). Handling Important Events. Sending Messages Yourself.

4. Windows GDI, Controls, and Last-Minute Gift Ideas.

Advanced GDI Graphics. Points, Lines, Polygons, and Circles. More on Text and Fonts. Timing Is Everything. Playing with Controls. Getting Information. The T3D Game Console.


5. DirectX Fundamentals and the Dreaded COM.

DirectX Primer. COM: Is It the Work of Microsoft…or Demons? Working with DirectX COM Objects. The Future of COM.

6. First Contact: DirectDraw.

The Interfaces of DirectDraw. Creating a DirectDraw Object. Cooperating with Windows. Getting into the Mode of Things. The Subtleties of Color. Building a Display Surface.

7. Advanced DirectDraw and Bitmapped Graphics.

Working with High-Color Modes. Double Buffering. Surface Dynamics. Page Flipping. Using the Blitter. Clipper Fundamentals. Working with Bitmaps. Offscreen Surfaces. Bitmap Rotation and Scaling. Discrete Sampling Theory. Color Effects. Manual Color Transforms and Lookup Tables. The New DirectX Color and Gamma Controls Interface. Mixing GDI and DirectX. Getting the Lowdown on DirectDraw. Using DirectDraw in Windowed Modes.

8. Vector Rasterization and 2D Transformations.

Drawing Lines. Basic 2D Clipping. Wireframe Polygons. Transformations in the 2D Plane. Introduction to Matrices. Translation. Scaling. Rotation. Solid Filled Polygons. Collision Detection with Polygons. More on Timing and Synchronization. Scrolling and Panning. Fake 3D Isometric Engines. The T3DLIB1 Library. The BOB (Blitter Object) Engine.

9. Uplinking with DirectInput and Force Feedback.

The Input Loop Revisited. DirectInput Overture. Going Deeper with Force Feedback. Writing a Generalized Input System: T3DLIB2.CPP.

10. Sounding Off with DirectSound and DirectMusic.

Sound Programming on the PC. And Then There Was Sound…. Digital Versus MIDI—Sounds Great, Less Filling. Sound Hardware. Digital Recording: Tools and Techniques. DirectSound on the Mic. Starting Up DirectSound. Primary and Secondary Sound Buffers. Rendering Sounds. Making DirectSound Talk Back. Reading Sounds from Disk. DirectMusic: The Great Experiment. DirectMusic Architecture. Starting Up DirectMusic. Loading a MIDI Segment. Manipulating MIDI Segments. The T3DLIB3 Sound and Music Library.


11. Algorithms, Data Structures, Memory Management, and Multithreading.

Data Structures. Algorithmic Analysis. Recursion. Trees. Optimization Theory. Making Demos. Strategies for Saving the Game. Implementing Multiple Players. Multithreaded Programming Techniques.

12. Making Silicon Think with Artificial Intelligence.

Artificial Intelligence Primer. Deterministic AI Algorithms. Patterns and Basic Control Scripting. Modeling Behavioral State Systems. Modeling Memory and Learning with Software. Planning and Decision Trees. Pathfinding. Advanced AI Scripting. Artificial Neural Networks. Genetic Algorithms. Fuzzy Logic. Building Real AI for Games.

13. Playing God: Basic Physics Modeling.

Fundamental Laws of Physics. The Physics of Linear Momentum: Conservation and Transfer. Modeling Gravity Effects. The Evil Head of Friction. Basic Ad Hoc Collision Response. Real 2D Object-to-Object Collision Response (Advanced). Resolving the n-t Coordinate System. Simple Kinematics. Particle Systems. Playing God: Constructing Physics Models for Games.

14. The Text Generation.

What Is a Text Game? How Do Text Games Work? Getting Input from the Outside World. Language Analysis and Parsing. Putting All the Pieces Together. Implementing Sight, Sound, and Smell. Making It Real-Time. Error Handling. Creeping Around with Shadow Land. The Language of Shadow Land. Building and Playing Shadow Land.

15. Putting It All Together: You Got Game!

The Initial Design of Outpost. The Tools Used to Write the Game. The Game Universe: Scrolling in Space. The Player's Ship: “The Wraith”. The Asteroid Field. The Enemies. The Power-Ups. The HUDS. The Particle System. Playing the Game. Compiling Outpost. Epilogue.


Appendix A. What's on the CD-ROMs.

Appendix B. Installing DirectX and Using the C/C++ Compiler.

Using the C/C++ Compiler.

Appendix C. Math and Trigonometry Review.

Trigonometry. Vectors.

Appendix D. C++ Primer.

What Is C++? The Minimum You Need to Know About C++. New Types, Keywords, and Conventions. Memory Management. Stream I/O. Classes. The Scope Resolution Operator. Function and Operator Overloading.

Appendix E. Game Programming Resources.

Game Programming Sites. Download Points. 2D/3D Engines. Game Programming Books. Microsoft DirectX Multimedia Exposition. Usenet Newsgroups. Keeping Up with the Industry: Blues News. Game Development Magazines. Game Web Site Developers. Xtreme Games LLC.

Appendix F. ASCII Tables . 1001


Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews

Tricks of the Windows Game Programming Gurus 4.5 out of 5 based on 0 ratings. 10 reviews.
Guest More than 1 year ago
This book rocks....period. Lets face it, game programming is a VERY difficult and time-consuming topic. I have dabbled with Basic and C for years as a kid, but was never able to look over anyone's shoulder to learn the secrets involved with getting started in game programming. I bought the first edition of this book and was amazed. I loved the book so much I bought the second edition as soon as it came out (it also helped to see the code converted to 16bit graphics ... hey, i'm not the smartest guy). The bottom line is, no book is going to teach you to program games overnight. But by sticking to this book over the past 6-8 months, I have begun to actually UNDERSTAND the material rather than just cut-n-paste code. That is the important part of reading any instructional text. Because of that understanding, I am finally placing myself in a position to begin developing computer games. Because I finally understand a lot of the basic topics involved, I am having little trouble converting the ideas into a 32bit color / high resolution game engine. And the coolest thing is, it is MY engine. I understand what makes it tick and can update it / change it as often as I wish to accompany any new game design ideas I come up with. My suggestion to wanna' be game programmers: if you have no programming experience, get a good C or C++ book (Sams teach yourself C++ in 21days) and tear it to shreads for 6 months to a year (or 1 month for you genius frieks out there :). Then get this book and (with patience) be prepared to be amazed. Thanks Andre'
Guest More than 1 year ago
If you are getting into game programming on the Windows platform this book is a must. Andre takes you from the early years of game programming to todays technology. He gives you math, AI, physics, all the stuff you need to program. I've been using the DEV-C++ editor for compiling and creating and you will need to adjust his code when using this editor. Some of the things it just won't resolve correctly. for example "if(FAILED(lpdd.yadda yadda) ..... in this case you would need to do the call first then check for failure. int x = lpdd.yadda yadda. if (x==0) error. other than that the examples work fine. I don't fault the author for this though. Just buy the book you need it if you are starting to program games in windows.
Guest More than 1 year ago
I reviewed "Tricks of the Windows Game Programming Gurus" 1st edition 2 years ago with 5 stars.... great book for the beginner. I would give this book 5 stars too BUT its the SAME EXACT BOOK. Oh there is a little here and there different but pg 337 in the 1st edition has the EXACT SAME contents as pg 334 in the 2nd edition (just for example). Now why fill us with hope on finishing the original by putting this one out? So, if you see "Tricks of the Windows Game Programming Gurus" 1st edition with a cool spaceship on the front for sale as used or marked down, GET IT. Dont spend $20 more for a 2nd edition... PAR
Guest More than 1 year ago
As for the error pointed out by the 13 year old 'programmer' - anyone with half a brain would have understood how to solve that problem. When the compiler flagged the error on the include, you should obviously check the file. Only a completely incompetent person would not do so. The moment someone would do that, if they weren't blind they would notice that the Direct Draw library spelling was jacked. The only errors in this book were minor ones anyone can solve. If you can't figure out how to fix the bugs in the code, maybe a demanding hobby/profession such as game programming isn't for you... This book rocks.
Guest More than 1 year ago
This book was published two years ago, and I bought it one year ago. If I am jst now writing a review for it, you know it has to be good. I will admit to you that the DirectDraw coverage is dated and you probably shouldn't even pay attention to it, but it has information that doesn't come together very often. Not only does he have detailed Win32 programming, he has AI, data structures, optimization, physics, particle engines, everything!!! I still find myself reading the chapters over and over to get as much info as I can from it. This is a definite nust!!!
Guest More than 1 year ago
This is the most excellent game programming book I've seen so far. It's easier on the newbie programmer than others I've read. However, when I got to compiling the source code for his first demo, I noticed that he must have rushed through writing it. I know he says 'If you're having compiling problems by now, RTFM'... However, no manual would have helped here! Heh, it was simply his source code that was bad. For some reason, it wouldn't work well with DirectX 7.0, so I installed DirectX 6.1. And guess what? That did NOT help at all. What I had to do to fix this problem that he kindly wrote was edit the defines for 'LPDIRECTDRAW4' and put 'LPDIRECTDRAW' instead. This seemed to cure the problem, and if I hadn't have been a good C/C++ programmer, I would have been very upset that his code did not work. Note: I've only gotten through to his source code for demo 1, so there may be other faulty code as well... I can only hope not! Other than the source code, I highly recommend you buy this book if you're into game programming. Although it's a tough subject for many, it's fun once you get good at it. Oh, and by the way, if you do buy this book and need some help with the source code, I would glad to help you. My email address is: Spammers, you didn't see that email address, OK? I hate spam email. The book covers some other interesting topics as well, such as AI. But like the author says, be careful, don't try to learn everything at once. I would have given the book five stars, however, it took away about 30 minutes of my life time making me have to fix the author's errors. Anyway, it's a great book. You should definately read it if you like game programming!
Guest More than 1 year ago
This book explains everything on how to make a game with directx. He has a great writing style and the first couple of chapters are the clearest that I have ever read on how to create win32 applications if you are new to windows programming. He doesn't just put code in for the heck of it and not tell you what it is. He tells you everything and its a book that I'll be using for a long time.
Guest More than 1 year ago
Some sort of problem here... Last 95 stars aren't showing up... If you happen to be a nubie not into Windows Programming yet, I'd reccomend you to go out and study the first ten chapters of Charles Petzold's 'Programming Windows', and then come back and consider this book. This way, most of the basics of the book will be really easy, not something to be completely frustrated by. Be warned: make sure you have Win 98+, because not all the programs compile in NT 4.0 / Win 95. Also, don't worry if you don't have a Win compiler yet, and you don't want to buy it without knowing whether you'll like Win Programming or not, because the book comes with an introduction edition of Visual C++ 6.0, which contains all the features of Professional, but you can't distribute the software you create with it. This way, if you like it, you can go out and buy it.
Guest More than 1 year ago
'Tricks of the Windows Game Programming Gurus' was an excellent book. Anyone who is interested in writing their own high-quality games should read it. You get an introduction to windows and DirectX programming, some basic game algorithms, and even a chapter on how to implement physics.
Guest More than 1 year ago
For all its faults, I can unabashedly recommend this book for the nubie to game programming. It is true that there are numerous typos in the but they are easily recognized and do not miss inform the reader. It is also true that this volume one of a multi volume work but the only problem there is that the reader is not informed of this on the cover. The book is quite large enough just covering the basics of game programming and 2D & 2.5D graphics. I was particularly taken with the chapters on AI and Physics they cover the basic of two very difficult subjects. For a good grounding in game programming, read this book.