Slashdot Mirror


Artificial Intelligence for Computer Games

Craig Maloney writes "Artificial Intelligence (AI) is a very hot topic today in computer circles because of the interest in modeling behaviors on machines that we find in nature. Many books have been dedicated to studying and expanding the field of AI, but generally fall into two categories: those that concentrate on AI as a research topic, and those that concentrate on AI in the field of game development. Artificial Intelligence for Computer Games (AI for Computer Games) is unique in how it takes classical AI and merges that knowledge into AI for game development. It's an approach that will be fascinating to those currently studying AI, but the approach limits the usefulness of this book to a select audience of AI researchers interested in game development." Read on for the rest of Maloney's review. Artificial Intelligence for Computer Games author John David Funge pages 127 publisher A K Peters, td. rating 6 reviewer Craig Maloney ISBN 1568812086 summary An introduction to Gaming Artifical Intelligence

AI for Computer Games begins with a brief introduction to the historic roles that AI has played in games such as Pac Man and Mario, and how these Non-Playable Characters (NPCs) achieved fame through their roles as NPCs. The NPCs play important roles in games, and their behavior can ultimately determine if the game is entertaining or frustrating. The author then describes the differences between the field of Artificial Intelligence as compared with Gaming Artificial Intelligence. Later he shows how these two fields can intertwine with each other, and how Gaming Artificial Intelligence can be useful to AI researchers via game-playing robots and other similar experiments. The author also introduces the architecture of the components of a game. They are:
  • Game State: The current state of the world
  • Simulator: Encodes the rules for how the game state changes, and the rules for the game (physics, etc.)
  • Renderer: The display of the game
  • Controllers: The player and NPC methods for interacting with the game.
The book then focuses on simulating a gaming environment for the NPCs and player to operate in. The author uses a game of Tag as the game framework for the rest of the book, with the player and the NPCs playing the classic game of chasing and hiding. The roles of the game state, simulator, renderer and controllers are explored in depth in this section.

Next, AI for Computer Games discusses NPC perception. Players in a gaming environment are hindered by what the renderer will display to them, so likewise, the NPCs should not have omniscience in the game. The author recommends a strategy for handling this for NPCs: use the render engine for determining the perception of the NPCs as well. This allows the players and NPCs to work from the same rules. The author also describes how NPCs can handle partial observability, as well as prediction.

The rest of the book deals with the NPCs' abilities to react, remember, search, and learn to the game environment. This is the heart of the book, and provides a good analysis of the various methods available to the developer to model complex behaviors. The section on learning is especially interesting, as the idea of rewarding the algorithm when it performs correctly seems both strange and obvious at the same time (although the author points out that sometimes the algorithm can do undesirable things in order to obtain that reward). There are many ideas in these sections for perfecting the AI of the game, and the author expertly describes each one and where each would best be used.

AI for Computer Games was both enlightening and frustrating at the same time. The author obviously possesses a lot of knowledge in the AI field; the frustration is in his telling of that knowledge. The book reads much like an academic paper on AI applications in games, and could put off many potential readers with its rather dense descriptions of complicated material. The book also suffers from being rather short. The book is 127 pages in total length with code snippets, diagrams, and other page artwork. The brevity makes the book easy to pick up and read for a bit, but the density ensures you'll be re-reading several chapters in order to catch what the author is trying to convey. The code snippets also suffer from brevity. The code snippets are in C++, but are primarily constructors, with precious few methods defined. The author has excellent ideas; using an environment where the player and the NPCs are equals removes much of the complexity for the example AI to handle. Unfortunately the execution in this book leaves me wanting more.

You can purchase Artificial Intelligence for Computer Games from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

10 of 259 comments (clear)

  1. Obligatory complaint by thephotoman · · Score: 4, Insightful

    Why do we always link to just one store? Why not link to a series of various places selling the book for those who are interested?

    Yeah, it's an obligatory complaint. Mod me down for it.

    --
    Haec merda tauri est. Ceterum censeo Carthaginem esse delendam.
  2. Natural stupidity by redelm · · Score: 5, Insightful
    I'm sorry, but I can't help thinking:

    Natural stupidity beats artificial intelligence every time

    You cannot make something idiot-proof because idiots are too ingenious (variable). Unfortunately, I see much of AI as trying to impose order on chaos which cannot be done with deterministic methods. AI _can_ help with data reduction, but not understanding.

  3. Enlightening and frustrating. by GillBates0 · · Score: 4, Insightful
    AI for Computer Games was both enlightening and frustrating at the same time.

    Much like how AI is, atleast in it's current state.

    Enlightening because even the most basic attempts at simulating intelligence in machines makes us realize how vastly superior Nature's machines are. And frustrating because of how difficult it is proving for us to reach an adequately satisfactory understanding of "real" intelligence/consciousness inspite of all the research/effort we've been putting in.

    --
    An Indian-American Hindu committed to non-violent thought/speech/action alarmed by the global explosion of radical Islam
  4. Comment removed by account_deleted · · Score: 4, Funny

    Comment removed based on user account deletion

  5. Game 'AI'... by sarlos · · Score: 5, Insightful

    I've never really liked calling a Game's 'AI' Artificial Intelligence for one reason - they don't learn. It's always seemed more of what I'd call Simulated Intelligence. There's always a stopping point, even if they train the computer to play themselves. A point where it's not learning anymore and the computer only seems to be acting intelligent.

    From the review, it seems this books touches on this a bit. Hopefully more game developers will start putting additional effort into making dynamic, learning Artificial Intelligence components to their games.

    Of course, part of the problem is also building the AI to act Human. Humans make mistakes, and so should the computer. In warfare, there's always been that element of random chance where you can capitalize on an enemy's mistakes. Take in factos like morale, confidence, etc. It's no fun to play against a perfect oponent all the time :p

    I think the first game company to get this careful balance right is going to be laughing all the way to the bank.

    --
    Government's view of the economy: If it moves, tax it. If it keeps moving,regulate it. If it stops moving, subsidize it.
  6. Genetic Algorithms by joepeg · · Score: 5, Interesting

    The section on learning is especially interesting, as the idea of rewarding the algorithm when it performs correctly seems both strange and obvious at the same time (although the author points out that sometimes the algorithm can do undesirable things in order to obtain that reward).

    Genetic Algorithms will most definitely be involved in the way the gaming experience progresses.

    To expand on the idea of rewarding, those genomes that are rewarded the most are then permitted to "mate" with other strong genomes, which will take into account inheritance, mutation, natural selection, and recombination (or crossover) resulting in the "smartest" population.

    The fitness test could also be controlled by the player, keeping the game even more interesting, for a much longer period of time.

    --

    ZEN is a prime number in base-36

    1. Re:Genetic Algorithms by Unordained · · Score: 5, Insightful

      Err ... 'evolution' results, if all goes well, in a local-maximum. Nothing about the process of evolution, real or simulation, says you'll get "the best" anything. Only that, on average, things will tend to improve in a way that matches the particular constraints at the time, according to available variations. If the constraints change, or there were several ways around a problem ("hack",) or there wasn't sufficient diversity, or a bad trait just happened to get rewarded along with a good trait, you may wind up with a terribly bad result.

      This is why I get so annoyed when scientists (and creationists) ask "what is this organ useful for?" expecting that every animal's every organ is entirely well-suited to its environment -- because either evolution or the hand of god made it perfect. That's not what the theory(!) of evolution predicts. Narwhals wound up with a long tooth, and sure, maybe they use it to impress the females now -- but is that why they have it in the first place, do they maybe only use it because they have it? Could it be that somewhere along the line, some freak just happened to survive an accident when others didn't, and passed on the freak gene causing this tooth to be a horn?

      Weird results from genetic algorithms are even more likely in small-population scenarios like games. You can only send so many 'test' enemies at the player before he gets bored. Particularly considering that in most games, either the player surives or the computer survives, I'm not seeing at what point you can reward the AI by letting it reproduce except when the player loses (at least in an FPS setting.) In that case, the game only gets better if the player loses a lot -- and most games try to make sure the player doesn't lose too much, but is instead always on the brink of losing (to keep him hopeful but challenged.) On the other hand, if you train them in the studio, you'll have to be careful to not train them to be good only against the testers. You don't want to release a game in which the AI is really good -- so long as you don't lure it into getting stuck in a corner, just because no tester thought to do that often enough to breed it out.

      But genetic algorithms are certainly not guaranteed to produce good results. They merely might.

  7. Re:Pong AI by iamdrscience · · Score: 4, Funny
    Here's my phenomenal AI for NES "Track and Field":
    while (1){
    controller1.pressA();
    controller1.pressB();
    }
  8. Another good one... by tcopeland · · Score: 4, Informative

    ...is M. Tim Jones' AI Application Programming. It's got all sorts of predator/prey and pathfinding stuff in there.

    The code examples are in C, although I ported some of them from the 1st edition of the book to Ruby.

  9. AI doesn't have to be realistic to be good by Dr.+Manhattan · · Score: 4, Interesting
    I was skimming a book on AI and games (maybe even this one) and they pointed out some neat tricks that aren't 'realistic' but which result in useful behavior. In "No One Lives Forever", the enemies would plot a path to you, trying to find the least "costly", generally the shortest.

    But when the first one found a path to you, they would mark the grid point just before you with a high (but not infinite) 'cost'. Then the next enemy to plot a path to you would naturally try to avoid that spot, but would use it if there were no other choice.

    Presto, enemies naturally try to come at you from multiple directions, without having to spend a lot of expensive cycles on modelling 'intelligent' coordination and strategy.

    --
    PHEM - party like it's 1997-2003!