Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Jump to ratings and reviews
Rate this book

Game Programming Patterns

Rate this book
Game Programming Patterns brings the benefits of reusable design patterns to the world of game programming. Commercial game development expert Robert Nystrom presents an array of general solutions to problems encountered in game development. For example, you'll learn how double-buffering enables a player to perceive smooth and realistic motion, and how the service locator pattern can help you provide access to services such as sound without coupling your code to any particular sound driver or sound hardware.
Games have much in common with other software, but also a number of unique constraints. Some of the patterns in this book are well-known in other domains of software development. Other of the patterns are unique to gaming. In either case, Robert Nystrom bridges from the ivory tower world of software architecture to the in-the-trenches reality of hardcore game programming. You'll learn the patterns and the general problems that they solve. You'll come away able to apply powerful and reusable architectural solutions that enable you to produce higher quality games with less effort than before.
Applies classic design patterns to game programming. Introduces new patterns specific to game programming. Brings abstract software architecture down to Earth with approachable writing and an emphasis on simple code that shows each pattern in practice. What you'll learn Overcome architectural challenges unique to game programming Apply lessons from the larger software world to games. Tie different parts of a game (graphics, sound, AI) into a cohesive whole. Create elegant and maintainable architecture. Achieve good, low-level performance. Gain insight into professional, game development. Who this book is for

Game Programming Patterns is aimed at professional game programmers who, while successful in shipping games, are frustrated at how hard it sometimes is to add and modify features when a game is under development. Game Programming Patterns shows how to apply modern software practices to the problem of game development while still maintaining the blazing-fast performance demanded by hard-core gamers.
Game Programming Patterns also appeals to those learning about game programming in their spare time. Hobbyists and aspiring professionals alike will find much to learn in this book about pathfinding, collision detection, and other game-programming problem domains.

300 pages, Paperback

First published January 1, 2011

Loading interface...
Loading interface...

About the author

Robert Nystrom

3 books160 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
850 (59%)
4 stars
445 (31%)
3 stars
112 (7%)
2 stars
16 (1%)
1 star
4 (<1%)
Displaying 1 - 30 of 114 reviews
Profile Image for Katie Cunningham.
Author 12 books23 followers
May 9, 2016
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.
77 reviews69 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.
125 reviews209 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 book107 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.
4 reviews
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.
Profile Image for Tijs.
25 reviews2 followers
December 29, 2018
Although not directly relevant to my day job I enjoyed this quite a bit. It’s basically a more readable version of the gang of four original. Fun read, nice examples. I do mostly UI & library dev these days where a lot of these patterns will look familiar.
Author 42 books11 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.
49 reviews3 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 book23 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 reviews24 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.
51 reviews
April 2, 2019
This book is a gem. Engaging, clear, concise and full of technical goodness.
Profile Image for Diogo Muller.
633 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.
40 reviews
September 26, 2023
I read the online version.

Honestly, the best part of the book for me was the introduction, specifically the idea that the goal of software architecture is to roughly minimize the amount of codebase-specific knowledge a programmer needs to make a change.

The actual patterns discussed can be divided into three categories:
1. Gang of Four patterns, which I have encountered elsewhere (except for Prototype). For the most part, I think discussion elsewhere was sufficient, though I did appreciate the chapter on Singleton and Prototype.
2. Game engine patterns, which I assume are in every game engine. I've used Unity before, so patterns like Update Loop and Component were nothing new to me, and if you are a game developer, I'd recommend learn these patterns by getting hands-on experience with an existing game engine rather than by reading a book.
3. Data structures and algorithms, such as Spatial Partition, are also covered elsewhere more comprehensively, though I guess if you wanted a brief introduction, this book suffices.

So overall, I'd say not a bad book overall, but it just so happened that I didn't get as much out of it as I hoped.
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 reviews41 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.
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.
64 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 Tyler.
78 reviews
April 2, 2024
One of the most pleasant technical books I've had the joy of reading. The content is great, and unlike most technical books I've read, this one immediately distinguishes itself by its authentic/down-to-Earth voice with a health dose of deadpan humor.

The chapters have a consistent structure which both assists in readability and makes this viable reference material. All the patterns are introduced in the context of how they could be used in a game, and the examples are straightforward to follow. What I found particularly valuable was the practical discussion around design decisions at the end of each chapter - there are some real gems in there.

Favorite chapters might be: command, bytecode, and spatial partition. These were the ones that surprised me the most with new ideas. But honestly, all of the chapters were fantastic.
Profile Image for Dana Larose.
400 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.
176 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.
244 reviews12 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.
Displaying 1 - 30 of 114 reviews

Can't find what you're looking for?

Get help and learn more about the design.