Sunday, January 22, 2006

Artificial Intelligence for Computer Games Book Review

This week I read "Artificial Intelligence for Computer Games" by John David Funge. The first thing I noticed when I got it up was how thin it was. It reminded me of the small reference O'reilly books. Props for having a hardcover though. I think that it is really called "Artificial Intelligence for Computer Game An Introduction", but you would only know that by seeing it on the first page as that isn't on the cover, side or back. Reading through the preface I found that he hopes his book will inspire new academic research for AI in computer games and that he is working for a startup that is developing AI technology. This first I doubt will happen and the second clearly showed me where the next hundred pages was headed.

Before getting into the book I have to mention the code. You get your first glimpse of code on page seventeen where a class header is shown. The class name is tgGameState. Any guess what "tg" stands for? Neither do I. He tries to save on space by having functions with partial words like "inline getNumCharacters()", but the follows it with a pointless comment // Get the number of characters. In appendix B (Programming) it says that code is written to be as easy to understand as possible and is therefore not that efficient. If he had wanted to go for readability he would have expanded the function names, removed the pointless comment, and ditched all the inlines and not of even mentioned the constructor, deconstructor (which aren't defined in the book anyway) etc. Poor variable names, missing error checking, it would have been much better to use sudo code. I noticed a few bugs even. Overall this was the worst part of the book and I wouldn't want someone in the "entertainment industry" reading this if I was trying to sell them my code.

Onto the actual book. My mention of the reference O'reilly books wasn't just to point out the size. This book really does feel like a jumping off point for AI in computer games. topics are briefly mentioned, but never really gone into depth and to make it sound complicated greek symbols are used when showing a formula. I would have appreciated five or six footnotes per pages telling where to get more information, but most of the time there wasn't. The first two chapters where more of a crash course in game design. So by the time I was on chapter three and on page 33 you can tell that was nervous that i was 1/3 through the book and really hadn't gotten into any sort of real AI stuff. but it picks up from there. There are a lot of hints for how to integrate AI into games. For example a Non-player controller (NPC) could have an arrow drawn on its chest (where it thinks the player is) and other visuals indicating its internal state. Of course these are more likely just basic game tips and nothing to do with AI. One neat idea was that your NPC could have several decision making units that could be swapped out. When really close to the player the most CPU intensive one would be used and when far away in the locked room the "stand still" one could be used. Perception, Mood, Remembering, Searching, some basic physics were all touched upon. In chapter 7 it gets very close to mentioning/talking about genetic algorithms, but alas it was not to be. The last part of the book was very boring and I found myself putting down the book a lot before finally finishing it.

Overall I feet like I was cheated because of the poor cover title. The cover really should have had "an introduction" on it. I expected it to be bigger with more in-depth explanations that didn't leave me hanging, and not such sub-par code for a coding book. On the plus side I found out the name of the orc on the cover is named "Fluffy".

I have previously listed some books I highly recommend and am interested in hearing what you recommend is good.

No comments:

Popular Posts