July 23rd 2009

Book review: C++ For Game Programmers

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...Loading...

Some books geared toward game programming beginners tend to only scratch the surface of the presented language and of what it takes to write a game. There are some pitfalls that are specific to games that need to be addressed (or so the book says), and this is what this book is about.

Content and opinions

The book is split in three main parts. The first one describes the general advantages of C++: (multiple) inheritance, type safety, templates or exceptions. The goal is to let the developer know what it can do (also what she shouldn’t do). Every usual warning of C++ (const-correctness or the different casts) is present in this part, and this should lead to good code quality.

The second part deals with performance and memory issues. Unfortunately, the STL is only presented here, and not in the first part, where it should belong as it is one of the basis of C++. At least, it is considered as a C++ standard library, and not something fancy that you may use if you like. C++ pitfalls concerning performance are dealt accordingly, it seems to me that it browses correctly the different aspects of it. The chapter on memory is good as well, as it explains the diffent kind of memory you can use, the impact on performances that allocation has, how it can be enhanced, … It suggests you can overload the new operator, although it is sometimes not recommanded by some C++ authors, so on this part, the picture is not so nice, a big warning might have been welcome.

The third part is split in smaller chapters on “special techniques”. There are first some useful language specifics, as abstract interfaces, that can be really useful, especially for plugins, to extend one’s game. Two chapters deal with object creation, management and persistence. One chapter deals with RTTI, it shows another way of having something like RTTI, but with a lesser CPU cost. Interesting, but to be used with care. Finally, a chapter is about large projects and how to optimize them, and the last one deals with what is called crash-proofing (how do you deal with an error when the game is shipped?).

Conclusion

A lot of stuff are in fact not game dependant. OK, the author aimed at the developer population, but it is useful for every developer. One may not need everything (like the custom RTTI, only useful if you need it badly with speed, which may be because there is an architectural issue), but C++ basics (the first two parts) are essential for all people. And a large part of the third part is also useful for everyone.

There are some mistakes (like including the string class to the STL), but compared to other C++ beginner books, this one raises the bar and gives the best practices for game programming in C++.

Tags: , , ,

No Comments yet »

Trackback URI | Comments RSS

Leave a Reply

« | »

  • Blog Vitals

    Blog Stats
    6,499,291
    192
    213
    44
  • Advertisement