Jump to ratings and reviews
Rate this book

Game Programming Patterns

Rate this book
The biggest challenge facing many game programmers is completing their game. Most game projects fizzle out, overwhelmed by the complexity of their own code. Game Programming Patterns tackles that exact problem. Based on years of experience in shipped AAA titles, this book collects proven patterns to untangle and optimize your game, organized as independent recipes so you can pick just the patterns you need. You will learn how to write a robust game loop, how to organize your entities using components, and take advantage of the CPUs cache to improve your performance. You'll dive deep into how scripting engines encode behavior, how quadtrees and other spatial partitions optimize your engine, and how other classic design patterns can be used in games.

520 pages, Kindle Edition

First published January 1, 2011

785 people are currently reading
3217 people want to read

About the author

Robert Nystrom

3 books187 followers
Robert Nystrom has programmed professionally for twenty years, about half of which is in games. During his eight years at Electronic Arts, he worked on behemoths like Madden and smaller titles like Henry Hatsworth in the Puzzling Adventure. He's shipped games on the PC, GameCube, PS2, XBox, X360, and DS, but is most proud of the tools and shared libraries he created for others to build on. He loves seeing usable, beautiful code magnify the creative ability of others.

Robert lives with his wife, two daughters, and two dogs in Seattle. If you have the misfortune of meeting him in person, he will invariably cook something for you.

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
913 (59%)
4 stars
481 (31%)
3 stars
118 (7%)
2 stars
19 (1%)
1 star
5 (<1%)
Displaying 1 - 30 of 118 reviews
Profile Image for Katie Cunningham.
Author 15 books25 followers
March 15, 2025
Just finished this and I can't recommend it enough. Even if you know programming patterns, I feel like this is a good resource to dive into. It goes into when some patterns are bad (a topic that I've found most books skimp on), and how certain patterns apply specifically to game development.

Its most stunning accomplishment was being the first programming patterns book that made me really want to code rather than question my life choices.
Profile Image for Kyle.
78 reviews73 followers
May 14, 2022
I'm an almost-entirely self taught programmer. I'm also an electrician, so I can compare the experience of going through an apprenticeship and formal schooling with the objective of working a job to the experience of randomly reading books (before I had internet), blogs and watching videos to try and learn how to figure something out.

One thing that this book made me realize is that what separates haphazard self-directed study from real training is being taught what the techniques and ideas inherent to a trade actually mean and what the correct, professional way is to do something. The first game I ever made would only update the graphics when the player clicked something, because obviously thats the only time you need to change the game world. It took me years to realize that all actual video games use the loop pattern this book explains, with processor-independent delta timing, to decouple rendering from user decisions. In a work environment, that would have been day 0 (get it?). In this book the author answers a number of other questions I've had over the years, like how do undo/redo operations work, and how are game replay files so small (check out the 'command' pattern)?

Basically, this book is a shortcut to professional-level instruction in the field of game development. If you're an attempted hobbyist game developer, this will save you a lot of time. Or maybe I'm just uniquely stupid and this book doesn't offer any advantage. Either way, I would check it out if I were you.
Profile Image for Nick.
132 reviews228 followers
November 28, 2019
Detailed and insightful explanations of how, where and why to use specific patterns. Like the best books on OOO, it is written with a love for programming expressed with personality and charm. A joyful tech-read. Essential, in my opinion.
Profile Image for David.
Author 1 book120 followers
January 26, 2021
Like the big "Gang of Four" Design Patterns book it emulates, the value of this to you will vary widely depending on whether or not you do a lot of Object-Oriented Programming. In particular, this will be most valuable to C++ developers working on a traditional game engine. This is not failing on Nystrom's part and he is clearly aware of the niche he's addressing when he gives concrete examples.

I like reading books like this because they often give me ideas for my professional work as well as my hobby programming. Nystrom does a great job of explaining each pattern and his informal style does a lot to put the reader at ease. I have to admit that I didn't get nearly as much out of this as I'd expected, but Nystrom was a good companion. I'll keep this on the shelf mentally and physically for future reference. You never know.
5 reviews1 follower
March 10, 2024
Bar a few computer science modules at university, I've been a self taught game programmer. Currently got 2 years of industry experience under my belt.

This book had a few patterns I feel very comfortable with, and it still taught me new perspectives on them. Some patterns I'd been using without knowing - fantastic I was able to get some "formal training" on them. Other patterns I had never stumbled across, but could look back at games I'd previously developed and seen how I could've made my development experience much more pleasurable had I implemented said pattern. I appreciated every single chapter.

Very informative book with useful examples. I have little experience with C++ and had no issues understanding the examples (all in C++). Funny comments here and there were enjoyable.

Some sections I skipped over where I didn't feel inclined to go super into detail on a pattern - the book is structured such that it is easy to refer back to. If I hit a problem that reminds me of a use case for a pattern mentioned in this book, trust I will go back to remind myself.

A must read for every game programmer of any skill level.
Author 42 books12 followers
July 1, 2022
Good book. Covered a lot of ground I knew, but refreshed a few topics for me and introduced a few more. I like that he covers not only the benefits of each pattern, but does a thorough review of all the potential snags you can run into, and gives some guidance on when you might want to use it and when you would want to avoid it.

I will say that the code examples are written for C++ and assume things like native contiguous memory arrays, data caching, gpu access, and other lower level concepts. If you are writing games in a higher level language, some of the info may not apply 100%, but is still good to consider.
Profile Image for Karol Gaida.
69 reviews4 followers
June 11, 2023
This is an interesting list of useful patterns presented in simple examples and told with humor.
1 review
January 25, 2019
Excellent!!

As a senior software developer (LOB) with limited game development experience, I found this book to be very well written, easy to follow and understand.

Code samples are well written and simplified or toned down to make the essence of each pattern easier to see and grasp. Most, if not all, of the code is written in C++; but kudos to the author for using a simple and more basic form of C++ without all the modern syntax and sugary stuff. I'm a C# developer and I had no problems following the sample code.

I loved the graphical diagrams used to help explain abstract concepts; they were the perfect compliment to the text that made reading a technical book, such as this, very enjoyable and made everything easier to follow.

The little notes on the right margin are also really interesting and made the book more enjoyable.

Is important to note that this is NOT a step by step game programming book!!!; you will not have a game coded by the end of the book, and code samples aren't meant to be copied and pasted into whatever IDE you're using either (they are not production ready; and they do not try to be). This book is about explaining you the common patterns used by game developers; this stuff is meant to be digested and understood in order to apply it in your own code.

In summary, this is really good book, well written, with good amount of text, code samples and diagrams and it is well structured too. All these characteristics make this book easy to follow and understand (and is enjoyable too).

I think it is a must read for any developer that is interested in game design and game patterns.
Profile Image for Matt.
Author 1 book25 followers
February 24, 2019
I loved the style of this book. Nystrom's prose is clear and he includes many fun tangents and quips along the way that keep this book of game programming patterns from feeling too dry.

The code examples are in C++ so it's more accessible to people who studied C++ previously, but I think the ideas still come across even if you don't understand the details of vtables, friend classes, and other C++ oddities.
Profile Image for Mohamad Ziad AlKabakibi.
14 reviews21 followers
December 19, 2019
This book is really good for a beginner in game development and programming. It gathers the main ideas from Design Patterns by the big four (which can be applied in game dev) and it shows how they work in these games.

Also, I enjoyed every second of reading this book because of its clear explanation and exciting approach.
Profile Image for Picasso.
60 reviews1 follower
April 2, 2019
This book is a gem. Engaging, clear, concise and full of technical goodness.
Profile Image for Michael.
24 reviews
April 25, 2025
I recently participated in my first game jam where I worked on a little detective game. It was a great experience, but quite challenging. I picked up this book in the midst of frustration with my buggy little game. I only read a few chapters before I submitted my game, but I kept reading it afterward. The book is better written and has more breadth than I initially thought. It's really a modern successor to "Design Patterns: Elements of Reusable Object-Oriented Software", which is great for me because I have not read "Design Patterns". The author writes, "... I could just as well have called this book More Design Patterns, but I think games make for more engaging examples."

I had heard of "Design Patterns", but by the time I was out of college, the style of programming it described was becoming less common. I had tried to program in that style but constantly kept shooting myself in the foot, which turned me off. This book explains the patterns covered in "Design Patterns" but also other important patterns (concepts), ranging from fundamental topics like creating your own bytecode for a scripting language or understanding the Memory Hierarchy and Data Locality, to patterns that feel like one-off tricks, such as the "Service Locator" pattern.

Overall, it was an excellent introduction to most of these patterns. It doesn’t go into excessive depth, which makes sense for a book like this. I think I will give the author’s book on writing interpreters a go.
Profile Image for Diogo Muller.
769 reviews8 followers
January 6, 2018
Very good book on Design Patterns for Games. If you are a game developer, you probably know and use a few, if not most of those patterns already. However, the author explains quite a few use cases, optimizations, and reasons why it's better to use one pattern instead of another, depending on what tradeoffs you can accept. Not only that, but the author favors showing things by example, step by step, with a lot of humor in-between, which works better in this case than just dumping a lot of theory at the reader and showing one example or two. Oh, while the focus is on game development, most of the designs in this book are also useful for other types of applications.

Even if you know a bit about Game Programming, I feel this is a good read - it's not a long book, and you may learn a few things. Some of the most useful lessons on this book are not when to use a pattern or when to do something, but when NOT to use a certain pattern or when it's not worth doing some optimization, heavy change or something like that. I feel most programmers could benefit from learning a bit about that too.
1 review
August 18, 2019
Part with GoF patterns is terrific, I believe author has wrong understanding of some of them. Singleton section is crazy, points opposite to each other were mentioned simultaneously, suggested sub-classing is going in conflict with common sense, suggestion to change Singleton with service locator was last shot (I believe Uncle Bob would have painfully murdered author, if he had seen this). Anyway I personally liked part with Interpreter and Bytecode, these were described good
The later part with more specific patterns is more or less ok, except ending with spacial data structures in book about patterns.
To sum up I would say that this book has got quite a lot of bad or at least arguable advices inside. I hope that this book would not be read by person not familiar yet with original GoF patterns itself
For me also distructing point was quite free style of writing, but that's like matter of taste
Profile Image for Norman.
58 reviews40 followers
April 4, 2020
Although I find this book to be OK in providing information on some of the game programming patterns, the material is actually VERY DRY if you read the first few pages.

First of all, I think part of the reason why is because the author literally changes the scenario that he is trying to describe after every 3 sentences of each paragraph. For example, in the first three sentences the author talks about wizards and then he changes the topic to something about the trees and mobs that all will need to be generated.

The biggie about what made me as a reader struggle with this book is how there are no real life step-by-step images that shows you the result that it produces, but there are only rough drawings about the outcome. I understand how the code is only written in pseudocode, however, how-to scenarios would really help the reader fully understand how the concept would really apply to game development.
Profile Image for Pavlo Hodysh.
9 reviews3 followers
September 9, 2018
First, I'd like to say that this book is well organized and as interesting as it is fun to read (all those side notes are fun). Design decisions are also neat!
As for the content of the book. I guess, you can call a lot of things "a pattern in programming" as a lot of code do actually happen to be repetitive. Most of the patterns described in this book are the ones that we know from "Gang of Four" design patterns. Some of them are actually interesting and new though.
Now, for the interesting part - it provides some good examples on those patterns when it comes to game development. Moreover, it keeps things simple, so that you understand the approach better.
I recommend this book to everyone who want to get more insight on what it means to be a game developer and what challenges you might have.
6 reviews
August 16, 2019
Design patterns have always been a boring thing whenever I studied them but the first time someone explained them in a way you can apply in the real-world game.

After reading this book, I got answers to a lot of questions like
- Why game engines are designed like that?
- What can go wrong if you don't design like that?
- Which is the best pattern in particular game problem ? and which is the worst?
- How to figure out which pattern will work better in use case and others will not?



Note
- To fully utilize this book, you need to have a basic understanding of the game engine and C++

What can be improved
- The author has a bias towards certain favourite topics going too deep in explanation like state machines, although it is good if those are your favourite topic too but not in general that important in games.
10 reviews
September 29, 2021
This was a fantastic book! With 16 years of experience as a programmer I considered the Gang of Four design patterns old hat and thought that I had found all of the ones that were useful to me long ago and mastered them.

The excellent game programming examples made me see many of these classic patterns in new light and realize there was still some valuable patterns that I had overlooked.

Ironically the part I enjoyed the least was sequencing patterns: the heart of a game engine. That's just because as a hobbyist game developer I've seen everything in there 10 times over in various game engines. Even so the highlighting of weird edge-cases to watch out for like missing object updates are valuable insights - it was still worth reading.

I really enjoyed the author's sense of humor and writing style! That turned a dry technical topic into a fun read.
Profile Image for Alexander.
68 reviews
January 1, 2022
Really great book, enjoyed practically every chapter! Explains things well, and includes some nice comic relief here and there.
I appreciated the time the author took to also include some general coverage of architecture vs. performance in games, as well as reviewing common GoF patterns that are particular standouts for game development.
The main "gamedev" patterns he then covers are also very interesting. My only wish is that the author went into *slightly* more difficult examples on some of the patterns. For example, his grid example in Spatial Partitioning was a little too simplistic in my opinion and I'd have been happy for him to explore a more complex example, but overall, this book is fantastic, and I'm very grateful that the author has generously made the book free on his website as well!
Profile Image for Dana Larose.
415 reviews15 followers
March 12, 2021
A book on the GoF patterns applied to game design, or alternatively, a book about programming patterns with example drawn from games. Most of the patterns are pretty generally applicable to computer programming and the GoF can make their example a word processor, why not a book of patterns with game code as examples?

I enjoy discussions of software design and Nystrom is a clear and engaging writer. I think my only quibbles with the book are that I would have liked more extensive "further reading" sections for the chapters, and maybe an afterwards or "where to go from here" section. The book just sort of stops abruptly after the last pattern.

Can definitely see myself referring to this both for my non-game industry day job and my hobby coding efforts.
2 reviews1 follower
May 20, 2021
Surprising and Delightful!

This is not a game programming book - it won’t walk you through writing a game... BUT it cleverly goes through the programming techniques with the thought processes that a game programmer would have, and using game situations as examples.

As a result, I understood a lot more about why and how game engines work (previously they were a bit of a black box for me) *and* saw how some of these high performance techniques applied in non-game situations.

Special praise for the even handedness of the approach. For every technique the author gives multiple variations, and full lists of pros and cons. Recommended for all programmers interested in performance.
Profile Image for Paweł Rusin.
208 reviews5 followers
June 29, 2022
I always thought that game programming happens in its own bubble with its own programming techniques and patterns, as such those are not useful for "mainstream" programming. But "Game Programming Patterns" proved me wrong. It is a very well written book that covers both game-specific patterns as well as general-purpose patterns. It takes into consideration various layers of abstraction: hardware and performance, readability, expressiveness and also decouples the patterns from their implementations showing that various patterns can be written (better or worse) with different techniques. I was surprised to see it goes into more abstract topics such as bytecode or prototype-based programming, which I enjoyed a lot!
1 review
March 3, 2024
It has been more than 13 years since this book was released, so many examples of these patterns are quite obsolete, especially from the first half of the book. It was really hard to look at the examples in patterns like Command, Observer, Prototype, State, etc, were used a lot of dynamic allocation, indirections, and virtual method calls. Now C++ is more advanced with lambdas and other function objects capabilities. So a lot of patterns could be implemented with functors and templates.
But despite this, the book provides a solid base, that can be really helpful when designing your game or game engine.
For me, the most useful part was decoupling and optimization patterns. As obsessed with the efficiency of code, it gave me valuable insights into how effective code can look.
Profile Image for Hots Hartley.
310 reviews13 followers
January 10, 2019
The book started out promising with a real-life epiphany on working alongside fantastic programmers and walking over great programming gems. However, I found most of the examples that followed to be non-applicable to the vast majority of games I enjoy playing and creating. An inordinate proportion of the examples come from real-time action games, and very few from 2D RPGs and turn-based battles like Dragon Quest, Final Fantasy VI/V/VI, Chrono Trigger, Fire Emblem, Pocket Monsters, Suikoden, Breath of Fire, Mother 3, etc. The tone was also sarcastic and not particularly endearing to me, which led to me feeling talked down to quite often.
3 reviews
April 30, 2020
This was such a good book. I'm not a professional game developer, but the hobby has had me interested in knowing more for years now. I've come across many good sources of information, but this is a really nice and digestible source of patterns that anybody can gain from, yes even the people working on enterprise software like me.

My absolute favourite chapter that blew my mind was the one on using bytecode to build something that can provide a little higher level of expressiveness than whatever code the game is being used to write in. Definitely going to be one of the books I'll recommend to most going forward.
Profile Image for Alex.
9 reviews
July 25, 2021
Kind of a must read for anyone using game programming. Including game-engine engineers.

I enjoyed the authors writing style. While keeping a familiar format he still managed to use simple explanatory problems.

I like many people use a game engine to do non-game related stuff. This book gave me so many ahh-haa moments regarding how the engine works and why we do some things a certain way. Also warning are giving on patter overuse. I do not consider myself a programmer by profession but this book was approachable, neccesary, and definately benificial.

All in all this is a "good read", the author makes the content of this book accessible in a practical and fun way.
Profile Image for Matt Hertel.
37 reviews
January 11, 2018
Game Programming Patterns was a well-written, comprehensive book that was easy to understand, but still expressed complex concepts that are useful to a broad range of programming skill levels. I will continue to use the book as a reference, as the concepts and examples are easy to apply to any situation where a program needs order or optimization. I would recommend this book to anyone who is interested in learning the basic programming patterns that operate the games we play, and applying them to their own projects.
1 review
November 28, 2018
Very detailed and simple explanation about some of the Design Patterns found in the GoF book.
Each Chapter contains a clear and critical explanation on the pitfalls and benefits when using an specific Design Pattern.

I find particularly interesting, the Chapters on Optimization and Sequencing Patterns.
Make no mistake, when developing a game, it is very likely you will have to work with those ones.

I strongly recommend this book to any video game developer, either beginner or advanced.
Profile Image for k-rice.
43 reviews1 follower
November 28, 2021
Easily one of the best technical books I've ever had the pleasure of reading. Rob has a great eye for balancing abstract concepts & design philosophies with concrete examples. Concepts that I was new to were explained in a way that didn't put me to sleep, while areas that I was familiar with were engaging, and illuminating. This was such a pleasant companion piece to the work I've been doing, and I often had moments where he explained technical approaches I use that felt as though the curtain was pulled back on exactly how and why those approaches work.
Displaying 1 - 30 of 118 reviews

Can't find what you're looking for?

Get help and learn more about the design.