Artificial intelligence for computer games has come a long way in the last 2½ decades since I started in the industry. In the earliest days the subject was just lumped in with “game play” and very little thought was given to improving enemy behavior beyond adding a few “if-then-else” conditional tests to the core of the game. Most behaviors in a game were predictable, non-learning, and relatively simplistic—making it easy to determine the “motivations” and qualifying conditions under which they would react to you. Rarely were the rules anything more complex than “walk towards player, fire when gun is ready.”
A lot of what was called “artificial intelligence” actually had little to do with the physics and mechanics of the game world, rarely operating under the same rules and limitations that the player did. Enemy AI would have unlimited ammunition and resources, move and turn faster than the player’s avatar, and always know where the player stood (even when hidden behind several meters of impenetrable wall). While the player would be limited to a firing rate determined by the weapon they had selected, rarely would the computer-controlled enemy be limited by anything other than a named constant somewhere in the source code that determined how fast they could fire—hardly fair and scarcely interesting for the most part. One of the many reasons that Sid Meier (Civilization), Chris Crawford (Balance of Power), and Peter Molyneux (Populous) so easily created genuinely interesting game play and computer opponents was that they hid the simplistic governing rules and variables—really making you think there was something more going on than what the reality was.
In AI Game Development: Synthetic Creatures with Learning and Reactive Behaviors, author Alex Champandard provides a hugely interesting, non-academic look at the current state of the art in reactive, learning AI implementations as used in the game industry today. Whilst Champandard focuses primarily on the first-person shooter genre for his animats (a.k.a. bots), it shouldn’t be construed that this narrows the book’s subject matter; there is much to be gained for other AI practitioners from the numerous stated problems and solutions provided.
Champandard notes the difference between the top-down approach to game design, explicitly driven by the game designer, questioning the need for any kind of AI beyond simple scripting and path-finding—and the bottom-up, implicit approach as found in such games as Pizza Tycoon and SimCity. He briefly cites the combining of both approaches as found in Grand Theft Auto III and Black & White, where the AI is either over-ridden during cut-scenes or guided by the player, who in turn is guided by a designer-driven storyline.
Once the initial philosophizing over what intelligence is, whether we need AI in games, and its entertainment value and believability is covered in the two opening chapters, Champandard gets down to the meat of the problem. Chapter three defines the reactive behavior seen in many modern games: the planning and organization of AI components that control each animat within the world.
Each chapter is broken down into a simple statement and analysis of the problem, the research that has taken place in the stated problem domain, and finally development of a solution in the form of a modular C++ component that works within Champandard’s FEAR (Flexible Embodied Animat ’Rchitecture) framework (based on the Quake 2 source code). All of the chapters wrap up with possible ways to optimize the discovered solution once the initial experimentation and testing has taken place.
This simple approach provides a rich playground to experiment with a variety of AI problems, enabling the source code to concentrate purely on the puzzle being solved, without concern as to display technology or other factors such as receiving player input and designing interesting worlds. Many AI books have fallen into the trap of providing what many professional developers would consider to be “Mickey Mouse” solutions that lack real-world applicability, usually based on wholly contrived examples that do little more than illustrate the problem with a brittle resolution. Champandard provides robust, concrete solutions that can be used almost as-is by most developers/designers creating games today.
In any book on artificial intelligence, it is almost guaranteed there will be a chapter on pathfinding. One thing that Champandard does not do is dwell on twenty ways to skin the cat, but a good number of chapters cover movement through the world, detailing the difference between discrete (grid-based) and continuous (the “real world”) environments without going into too much detail on how to solve this one narrow problem.
What Champandard achieves is a fast-paced, interesting overview of the movement and navigation problem—in one chapter that segues, in the following chapter, into classical solutions before returning again to the area with this newfound knowledge. This style continues throughout the book, with the chapters covering target acquisition, weapon selection, use of environmental objects, strategic and tactical decision making, and so on.
Each chapter is short and to the point, and this interjectory manner really works, making each section memorable and easy to digest. While many chapters build on earlier ones, the book is written in the style of a cover-to-cover reading book; each chapter is self-contained enough that the reader can dip in to almost any area.
AI Game Development has an accompanying website where you can download the source code covered in each chapter. The website requires that you enter information from the book to verify purchase, giving me a bit of a flashback to games that require you enter a particular word from the specified page and paragraph of the user manual. It’s a novel approach (applied to books that have accompanying websites) that I’m sure we will be seeing a lot more of in the future as more books forego the included CD and instead present the source code and examples via the web. How long until books start appearing with 20+ digit CD keys? The web site appears to be regularly updated too, providing demos and extra material, such as forums and mailing list announcements not covered in the book.
Long gone are the days when A* pathfinding algorithms were considered state-of-the-art. Now programmers are dealing with complex single- and multi-agent systems that coordinate their group behaviors and seek out new opportunities to thwart the player beyond merely simple scripted behavior. AI Game Development provides one of the strongest and well-written books available on the subject; one which belongs on the desk of anyone implementing modern game AI, no matter the focus of the game.
Author: Alex J. Champandard
Publisher: New Riders Group
10 out of 10