Game Programming Algorithms and Techniques: A Platform-Agnostic Approach / Edition 1

Paperback (Print)
Buy New
Buy New from
Used and New from Other Sellers
Used and New from Other Sellers
from $34.48
Usually ships in 1-2 business days
(Save 42%)
Other sellers (Paperback)
  • All (8) from $34.48   
  • New (7) from $34.48   
  • Used (1) from $48.16   


Game Programming Algorithms and Techniques is a detailed overview of many of the important algorithms and techniques used in video game programming today. Designed for programmers who are familiar with object-oriented programming and basic data structures, this book focuses on practical concepts that see actual use in the game industry.

Sanjay Madhav takes a unique platform- and framework-agnostic approach that will help develop virtually any game, in any genre, with any language or framework. He presents the fundamental techniques for working with 2D and 3D graphics, physics, artificial intelligence, cameras, and much more.

Each concept is illuminated with pseudocode that will be intuitive to any C#, Java, or C++ programmer, and has been refined and proven in Madhav’s game programming courses at the University of Southern California. Review questions after each chapter help solidify the most important concepts before moving on.

Madhav concludes with a detailed analysis of two complete games: a 2D iOS side-scroller (written in Objective-Cusing cocos2d) and a 3D PC/Mac/Linux tower defense game (written in C# using XNA/ MonoGame). These games illustrate many of the algorithms and techniques covered in the earlier chapters, and the full source code is available at

Coverage includes

  • Game time management, speed control, and ensuring consistency on diverse hardware
  • Essential 2D graphics techniques for modern mobile gaming
  • Vectors, matrices, and linear algebra for 3D games
  • 3D graphics including coordinate spaces, lighting and shading, z-buffering, and quaternions
  • Handling today’s wide array of digital and analog inputs
  • Sound systems including sound events, 3D audio, and digital signal processing
  • Fundamentals of game physics, including collision detection and numeric integration
  • Cameras: first-person, follow, spline, and more
  • Artificial intelligence: pathfinding, state-based behaviors, and strategy/planning
  • User interfaces including menu systems and heads-up displays
  • Scripting and text-based data files: when, how, and where to use them
  • Basics of networked games including protocols and network topology
Read More Show Less

Product Details

  • ISBN-13: 9780321940155
  • Publisher: Addison-Wesley
  • Publication date: 1/2/2014
  • Edition description: New Edition
  • Edition number: 1
  • Pages: 352
  • Sales rank: 1,429,316
  • Product dimensions: 6.90 (w) x 8.90 (h) x 0.80 (d)

Meet the Author

Sanjay Madhav is a lecturer at the University of Southern California, where he teaches several courses about and related to video game programming. Prior to joining USC full time, he worked as a programmer at several video game developers, including Electronic Arts, Neversoft, and Pandemic Studios. Although he has experience programming a wide range of systems, his primary interest is in gameplay mechanics. Some of his credited games include Medal of Honor: Pacific Assault, Tony Hawk’s Project 8 , Lord of the Rings: Conquest , and The Saboteur .

In 2008, Sanjay began teaching part-time at USC while still working full time in the game industry. After Pandemic Studios was shuttered at the end of 2009, he decided to refocus his efforts on teaching up-and-coming game programmers. His flagship course is an undergraduate-level game programming course that he has taught for more than ten consecutive semesters.

Read More Show Less

Table of Contents

Preface xv

1 Game Programming Overview 1

Evolution of Video Game Programming 2

The Game Loop 5

Time and Games 9

Game Objects 13

Summary 15

Review Questions 16

Additional References 16

2 2D Graphics 19

2D Rendering Foundations 20

Sprites 22

Scrolling 30

Tile Maps 35

Summary 39

Review Questions 39

Additional References 39

3 Linear Algebra for Games 41

Vectors 42

Matrices 58

Summary 62

Review Questions 62

Additional References 63

4 3D Graphics 65

Basics 66

Coordinate Spaces 67

Lighting and Shading 76

Visibility 85

World Transform, Revisited 88

Summary 91

Review Questions 92

Additional References 92

5 Input 93

Input Devices 94

Event-Based Input Systems 99

Mobile Input 105

Summary 108

Review Questions 108

Additional References 109

6 Sound 111

Basic Sound 112

3D Sound 115

Digital Signal Processing 119

Other Sound Topics 122

Summary 124

Review Questions 125

Additional References 125

7 Physics 127

Planes, Rays, and Line Segments 128

Collision Geometry 130

Collision Detection 134

Physics-Based Movement 148

Physics Middleware 153

Summary 154

Review Questions 154

Additional References 155

8 Cameras 157

Types of Cameras 158

Perspective Projections 161

Camera Implementations 164

Camera Support Algorithms 175

Summary 178

Review Questions 178

Additional References 178

9 Artificial Intelligence 179

“Real” AI versus Game AI 180

Pathfinding 180

State-Based Behaviors 192

Strategy and Planning 198

Summary 200

Review Questions 200

Additional References 202

10 User Interfaces 203

Menu Systems 204

HUD Elements 207

Other UI Considerations 217

Summary 221

Review Questions 222

Additional References 222

11 Scripting Languages and Data Formats 223

Scripting Languages 224

Implementing a Scripting Language 229

Data Formats 235

Case Study: UI Mods in World of Warcraft 239

Summary 241

Review Questions 241

Additional References 242

12 Networked Games 243

Protocols 244

Network Topology 250

Cheating 255

Summary 257

Review Questions 257

Additional References 258

13 Sample Game: Side-Scroller for iOS 259

Overview 260

Code Analysis 262

Exercises 267

Summary 268

14 Sample Game: Tower Defense for PC/Mac 269

Overview 270

Code Analysis 273

Exercises 284

Summary 285

A Answers to Review Questions 287

Chapter 1: Game Programming Overview 288

Chapter 2: 2D Graphics 289

Chapter 3: Linear Algebra for Games 290

Chapter 4: 3D Graphics 291

Chapter 5: Input 292

Chapter 6: Sound 294

Chapter 7: Physics 295

Chapter 8: Cameras 295

Chapter 9: Artificial Intelligence 296

Chapter 10: User Interfaces 298

Chapter 11: Scripting Languages and Data Formats 299

Chapter 12: Networked Games 300

B Useful Tools for Programmers 303

Debugger 304

Source Control 309

Diff and Merging Tools 312

Issue Tracking 313

Index 315

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)