Tuesday, May 17, 2005

Physics for Game Programmers Reviewed

A short while ago, I posted that I'd just received Physics for Game Programmers. I was on vacation last week, and it seemed like a good book to read. So I did. And I really liked it. Herewith, my review.

First of all, I should point out again that this book was sent to me by the publisher, for free, presumably in the hopes that I would give it a favorable review here. I like to think that this doesn't bias me, but I wanted to make sure I pointed this out clearly in the interest of full disclosure.

The book is divided roughly into two parts. The first part deals with general physical concepts, like what happens when two objects collide, and the equations governing projectiles. As a guy with a Masters degree in Electrical Engineering, I know a fair amount about basic physics, and am pretty comfortable with math, but even still I definitely learned a few things. I could have used the bit about how rotating objects collide a few years back when I was writing a DirectX demo. One of the more interesting topics was the aerodynamic effect of spin on projectiles (think curveball).

The second part of the book is what you might call “applied game physics”. There are chapters on things like how to model cars, boats, and various sports games, using the principles outlined in the first part of the book. I thought this was a pretty reasonable approach. Although I'm not writing a game that requires this sort of simulation at the moment, if I were I think there would be plenty here for me to make use of. For example, I liked  the presentation of damage models for armored vehicles.

As far as the style of the book goes, I think that's actually where it really shines. The author has a way of explaining things that's thorough without being verbose. He also does a good job of keeping the scope limited to what I could actually fit in my head over the course of a week of relatively relaxed reading. As a result, the book weighs in at a reasonable 400 pages or so. I like that it's not an 800-page monster that tries to address everything under the sun.

There are a couple of places where I might have liked to see a bit more treatment of a particular subject. For instance, the author punts on the topic of three-dimensional collisions of rotating objects. This is a pretty reasonable compromise, particularly in service of keeping the book manageable, but because it's a topic that I've had to address in the past, I found myself somewhat disappointed to find it elided in the text. Still, I have to admit that there's enough material in there that I could likely work it out from what was presented.

One thing I should point out is that this is more a book about physics than it is about games. Although the author includes quite a few sample applications, they're hardly the sort of thing that you'd play on a Saturday night: they're more like simple demonstration programs. But again, in the service of simplicity, I see this as a good thing.

Speaking of simplicity, let me mention math. There's a fair amount of it in the book. The integral symbol appears a few times, and differential equations make a frequent appearance. This may challenge some people, but frankly, if you can't handle some math, you can't handle game programming anyway. And I think the author does a pretty good job of explaining the basics, although I may be a poor judge, since I was already familiar with all the mathematical concepts he presented. In any event, there's code that implements most of the equations he presents, which should help most people.

As a final note, the source code presented in the book is in Java. As a C# guy, I found this to be dead easy to read, so I never even bothered to grab the C# translation that's available on the website.

In summary, I definitely liked this book. It's a nice length, the style is pleasantly clear, and the material is a pretty good balance of depth and breadth. If you're writing a program where things fly through the air, collide, explode, or fall, this is a handy resource. Like I said before: “Physics. Games. Programming. What's not to love?”


  1. Great review, I've ordered a copy. (You've accomplished what Apress was looking for, I presume. ;) )

    A related and--by the looks of your review and the sample chapter online --less "applied" but more in-depth coverage of hardcore physics as it pertains to games, can be found here: http://www.amazon.com/exec/obidos/tg/detail/-/1558607404/. Definitely not for the faint of heart, but it was a fascinating read and has been an indispensable reference book.

  2. Interesting. I love physics. I'll have to peruse this one next time I'm at a physical bookstore. Thanks for the heads-up!

    (Oh, and given that I made you spend money on the Apress book, I hope you like it.)

  3. There is some interesting content in the book
    But it is not well written and much of the physics you need for a video game is simply missing
    Most of this book is already available for free (and better written) on Wikipedia and other well known game programming websites
    To understand RK4 you need to read across multiple sections of multiple chapters - piecing together how it works between long descriptions of the code like "the constructor initialises the variable" and "there are standard getter and setter properties" with little discussion about the important points - the code itself is bizarre - it should be written to highlight HOW it works rather than a failed attempt to show coding best practices
    The book is not layed out correctly - for instance code samples break across multiple pages making them hard to read and the fonts used for the math notation and code is horrible to read
    The author does not and has not written video games for a living - that is painfully obvious
    This book has some slight value but overall is irritating to read