This content is not yet available over encrypted connections.

Tuesday, November 11, 2014

A Short Book Review - "Game Programming Patterns" by Robert Nystrom (or "I Saw The Sign, And The Sign Said Buy This Book")

I am seriously the worst person to review a book like this.  But I read it, and being a fan of Bob and his works (check out his work with Magpie or Finch and prepare for dazzle), so I thought I'd have a crack at a short review.  Incidentally, Bob has done some incredible work on Google's Dart project.  I have greatly understated the previous sentence.

First a little context about me, the reader.  I'm not a software engineer.  If software engineers were like structural engineers who design buildings and bridges, I would be the guy who builds really (really) nice models of those same buildings and bridges in his basement.  You'd like my model bridge, but you wouldn't want me building the actual bridge across the river in your town.  That said,  I've been writing code for a long time.  I'm talking the 8086/8 8-bit assembly days (if you have any idea what an 8086 is, high-five!).  I love writing code.  It's my singular non family related passion.

The recent publishing of Game Programming Patterns is timely for me, because I happen to be coding a game right now.  Even more coincidentally, Bob mentions a game in his book called "RoboWar", which is somewhat similar in concept to what I'm working on.  Clearly fate has brought us together at this nexus of time and space.  Let's move on to the review.

The overall tone of the book is exactly where I like it to be.  Bob stuffs every pages with useful technical nuggets, while at the same time weaving in his own, often humorous voice, with little asides.  In one particularly funny section, Bob is critiquing historical overuse of class inheritance during the emergence of OOP, and manages to illustrate the point with this aside, which cracked me up:
"That same year, Ace of Base had not one but three hit singles, so that may tell you something about our taste and discernment back then."
Hey Bob, we thought we were cool in the 80's okaaaaaay.  We invented Spuds Mckenzie, fat laces, and tails!

You're damn right we made animals hock our beer in the 80s!
The content of the book is laid out in groups of design patterns, with each group containing chapters for several specific patterns.  For each pattern, Bob provides a "motivation", along with pros, cons, and examples that arch over a common use case.  I liked the balanced approach he took, which to me sums up as "Hey you might find this pattern helpful for this set of problems, but be aware of this other set of problems using the pattern might create."

Another aspect of the book I enjoyed was that periodically Bob would open the doors to the "big game development" sausage factory, and share with the reader a bit of what it's like to work in those companies.

If someone came to me and said "John, describe the flyweight pattern to me.", I would start with "uhhhh" and then proceed to describe it in an "all over the map" style that would leave your head spinning.  Bob does an amazing job balancing the depth at which he covers each pattern against a trajectory that moves the reader along a common use case for it.  There are many rabbit holes to go down when talking about design patterns, and Bob does a good job of only dipping down far enough to get his point across.

Nearly all of the code examples in the book are in C++.   This is certainly the best choice for the target audience I think.  I wondered if this choice may exclude the more "webified" community of game developers who  may find it more difficult to map the concepts to concrete examples, in say javascript or other popular GC languages.  It's a nit issue really.  To Bob's credit, he does visit this point of "GC vs non-GC" languages a few times in the book and how this may affect the decision to use a pattern or not.  I would have liked to have seen more side-by-side examples though.

The book is nicely illustrated, in just the right places.  If I'm not mistaken, it looks like Bob did all of his own illustrations.  Impressive.

What I liked best about the book, and the reason why I'd recommend it as a buy, is that it sparked real ideas in my 8-bit brain as to how I might improve my own code.  Several times while reading, I was tempted to put it down and go re-factor some old project of mine.  I call that a serious mark of success.

So now, go buy Bob's book Game Programming Patterns, and enjoy it as much as I did!  I leave you with this inspirational video...

No comments:

Post a Comment