Book Review: C++ for Game Programmers

C++ for Game Programmers

C++ for Game Programmers

Noel Llopis

Foreword

The following is a book review I wrote when I finished my first reading of C++ for Game Programmers back in early 2005. I’ve left it intact so it differs from the formatting of the other reviews I’ve posted.

I remember why I bought this book in the first place. It was December of 2004 and I was having some trouble while working through Zerbst’s 3D Game Engine Programming. I had never officially had a course on C++ and my knowledge of C was rudimentary. I kept reading about const and “pure virtual” member functions (among other things), and finally came to the conclusion that I needed to take a step back and learn about those before moving forward in Zerbst. I found C++ for Game Programmers at a not quite local Barnes & Noble and picked it up. I especially remember the fact that this book really met me where I was as a programmer: not bothering with the basics of programming, but rather concentrating on the aspects of C++ with which I was unfamiliar. As a result, I’ve had a special fondness for the book, as well as a great appreciation for its author.

Looking back, with maybe the exception of McGuire’s Writing Solid Code, I think this is one of the programming books I’ve reread the most. In addition to his clear presentation of the fundamentals, Noel touches several important and useful topics (a number of which I have incorporated into my own code base) in the later chapters.

It should be noted that a second edition has since been released by a different author. I don’t know how different it is from Noel’s edition.

The Review

Noel Llopis’ C++ for Game Programmers is an excellent reference for any game programmer at any level. The text focuses on both essentials of the C++ programming language like inheritance and constness as well as low-level systems within a game’s code base such as memory management and object serialization. The advice offered in Noel’s book has affected and improved every piece C++ I have written since I picked it up and started reading.

C++ for Game Programmers starts off by covering concepts that every C++ programmer should internalize: Inheritance (single and multiple), the const keyword, passing by reference, the C++ style casting, templates, and exception handling. Each topic discussion includes outlining their advantages and disadvantages, when and when not to use them, and is accompanied by simple, yet real-world code examples and scenarios relevant to game development.

After bootstrapping up these aforementioned fundamentals, Noel address principles every programmer is concerned about: performance, memory. The importance of these topics in game programming cannot be understated; both of these chapters are loaded with detailed explanations, practical examples, and useful recommendations. I think that one of the most important components of this book was the straightforward walkthrough of the need for and the implementation of a versatile memory management system (full source code provided on the CD) that can be easily integrated into any C++ project.

The next two chapters of this book are spent evaluating both the advantages and pitfalls found in the C++ Standard Template Library (STL). The overview includes direction on which data structures are good candidates for particular data sets found in games, as well as why they are poor candidates for others. Overall, these two chapters compose a very solid argument for using the STL in game development.

Part Three is where this text really shines. Starting with an in-depth discussion on Abstract Interfaces, the foundation is set for some extremely useful subsystems for game development, including for plug-ins, Runtime Type Information (RTTI), and object serialization. Even though most of the source code provided with these chapters is not designed to be thrown straight into a large code base, all of the important concepts needed for designing a game engine subsystem based on any one of the components mentioned above are clearly provided in the text.

One last, important feature is point of view taken throughout the book. It’s one thing to be working on a project, but it’s a completely different ball game to be working on a large-scale project. Noel brings industry-grade advice to the table for each and every topic covered in the book. This was something I appreciated again and again throughout my reading and I suspect others will too.

So, if you are looking for a book that doesn’t cover the just the basics of C++ programming in the light of game development: this book is for you!