Some Examples of AI in Video Games AI is sometimes by inspectadeck


									             Some Examples of AI in Video Games
    AI is sometimes defined as “computer simulation of intelligent behavior”. But
in video games, it sometimes is the simulation of the illusion of stupidity.

1   Bots and Finite State Machines

A virtual character is a bot. One needs the bot to do seemingly intelligent things.
This requires some input: e.g. in Quake it must know where player, where she is
looking, the situation it is in, and the equipment it has.
    Often need bots to do interesting and realistic things. The idea is a mixture of
precoded responses, with a bit of randomness/nondeterminism added, so that there
is the occasional element of unpredictability. Thus, for example, for believability:
there should be a timeout and fallback mechanism.
    Scott lists three things for the illusion of intelligence:

    • predictability and unpredictability

    • support (for ally)

    • surprise (including believable stupidity)

   A common methodology is to use a Finite State Machine (FSM). Here is a
simple example:
              find dragon            find peasant             get close
       flee                  roam                    chase                 fight
                escape              lose sight of            get far
    The change of state is triggered by an event, or a function that is calculated.
    Construction of a more complex FSM can be achieved by the amalgamation of
multiple automata, or even a hierarchy of FSMs. Their construction is aided by
having a suitable modeling software, or a scripting language.
    There is also the need for synchronization of multiple bots. The simplest ap-
proach is via shared memory, sometimes called bulletin board.
    Simplicity is sometimes just in the organization. Put the smarts in the world:
e.g. a tree knows what a bot should do with it.

2   Bot Motion

Often the bot must move to a particular place. One obvious AI idea is to use the
A* algorithm. But this can be time-consuming. So one can consider precomputing

certain navigation tasks. Note that realism is a problem: the human would not
know before hand the optimal path in a maze! One way to deal with the time issue
is to start the bot on an approximate path while it calculates the real path.
    Note also that computer can cheat! So the environment can be designed for
the bot (e.g. cues for direction in the environment). For example, an alternative to
A* is the “crash and turn” algorithm. The bot continues until it hits an obstacle
and then turns towards the goal. The environment can be designed so that the
algorithm works.
    Another idea is that the movement of a bot can be choreographed, for example
to achieve patrolling.
    Chasing can be naive; or predictive (aimed at future position). Evasion is
similar. Other tasks for a bot include hiding.

3   Boids

Boids were developed by Reynolds. They were originally used for the simulation of
flocking behavior in graphics. Boid are an example of artificial life, in particular,
emergent behavior. The complexity emerges from the interaction of individual
agents governed by simple set of rules, as in cellular automata.
   A boid’s motion was the result of three rules:

    • separation: try to get sufficiently far from neighbors

    • alignment: try to move in the same direction as nearby boids

    • cohesion: stay close to the barycenter of the flock

   One can also deal with obstacles and goals. Boids exhibit unexpected behavior
but realistic behavior.

4   Tactical AI

Tactical AI is needed for the computer player in strategy games such as Age of
Empires. A common approach is an expert system.

5   References

AI Game Programming Wisdom, edited by Steve Rabin
   Core Techniques and Algorithms in Game Programming, Daniel S´nchez-Crespo


To top