Publishing a book on data structures and algorithms isn't an easy task, because there's no computer science genre that's got as much of a pedigree. With titles ranging from a dozen good college textbooks to Sedgewick's five-volume _Algorithms_ series to Knuth's dense and eternally-unfinished _Art of Computer Programming_ series, any new book on data structures and algorithms is facing some serious competition. When I learned that Ron Penton, a newcomer to the programming book scene, was entering the foray with _Data Structures for Game Programmers_, I was skeptical. Could a book explaining the deep subject of data structures and algorithms written by someone with comparatively little experience in programming hold its own against books written by lifelong academics?
Unfortunately, that answer is "not really". While _Data Structures for Game Programmers_ does a reasonable job of explaining the data structures and algorithms that are necessary for games, the book suffers from serious organization problems and a lack of depth.
The book does cover the expected basics and follows the standard format, with a chapter on arrays, a chapter on linked lists, a chapter on binary trees, a chapter on stacks & queues, etc. These are covered reasonably well, showing how the structures are represented, the advantages and disadvantages of each, and how to code them. The book does try to distinguish itself from a standard college data structures textbook in two ways. First, each data structure and algorithm includes an interactive example program on the included CD. These examples are very well done and are an excellent way to see constructs "in action". Second, the example programs are all game-oriented, mostly involving a Zelda/Ultima style adventure game.
Around page 600, the book takes a turn into algorithm territory, and it does take a more game-oriented focus following the obligatory chapter on sorting. Chapters on data compression, random numbers, and path-finding are natural fits for all kinds of games.
Following the algorithms are a few short appendices covering the basics of C++ (or as much as can be covered in 30 pages, which isn't much), a few pages on how PC memory is organized, a quick overview of SDL (the graphics library used to make the example programs), and twenty pages on STL.
Unfortunately, the short shrift given to STL is one of the problems with the book. While the value of STL was once debated, it is now blessed by ISO as the C++ standard library and is now as much a part of C++ as the if( ) statement. About half of the data structures covered in the book are already implemented in STL, and the rest can be made out of combinations of STL containers and algorithms. The book, however, ignores STL in favor of building all data structures from the ground up. While I understand the need to show how data structures look and work internally, the chapters should at least mention that the structures are already part of C++ and don't need to be implemented directly.
Early on I mentioned the organizational problems with the book, and a couple of them are significant. The first is how, despite the fact that the book is aimed at C++ beginners, the book opens with a fairly advanced chapter on templates. The templates chapter is followed by a far-simpler chapter on arrays. Despite having not covered arrays yet, the chapter on templates implements an array container assuming that arrays are already understood. Even worse, chapter 9 is a tutorial on how to write classes in C++, even though C++ classes have been in heavy use since chapter two! I honestly don't know if this is a case of chicken-egg syndrome run amok or if it's a case of an author and editor not spending enough time organizing the layout of the book, but it does make for a confusing read.
My final complaint about the book is about the relative lack of depth given to the subjects. While simple structures like arrays are covered comprehensively, there is too much "this is too advanced a topic for this book" later on. For example, the chapter on binary trees shows how to build and climb a binary tree. The chapter does correctly state that binary trees suffer from a significant flaw, which is that the search efficiency is very dependent on the order of the data inserted. The chapter also states that there are ways around this flaw, namely AVL and red-black trees which re-balance themselves. That's where the book stops, though. Even though the book could cover balanced trees with a few more pages, the book just recommends you look elsewhere and leaves (no pun intended) binary trees with their flaws. This is later repeated in the chapter on minimax trees, mentioning that tree-searches can have their performance improved significantly, but not detailing those ways because, according to the author, the chapter was getting too big and most folks aren't interested in minimax trees anyway.
In conclusion, _Data Structures for Game Programmers_ tries to achieve a lofty goal, staking a space among books written by the top people in the field. Unfortunately, though, it only partially reached that goal, covering some topics well and gaining big points for the quality of the programs on the included CD, but falling well short of the mark in organization and depth of advanced coverage.