Game Development Reference
In-Depth Information
Chapter 9. Artificial Intelligence
This chapter covers three major aspects of artificial intelligence in
games: pathfinding, state-based behaviors, and strategy/planning.
Pathfinding algorithms determine how non-player characters (NPCs)
travel through the game world. State-based behaviors drive the de-
cisions these characters make. Finally, strategy and planning are re-
quired whenever a large-scale AI plan is necessary, such as in a real-
time strategy (RTS) game.
“Real” AI versus Game AI
In traditional computer science, much of the research on artificial intelligence
(AI) has trended toward increasingly complex forms of AI, including genetic al-
gorithms and neural networks. But such complex algorithms see limited use in
computer and video games. There are two main reasons for this. The first issue is
that complex algorithms require a great deal of computational time. Most games
can only afford to spend a fraction of their total frame time on AI, which means
efficiency is prioritized over complexity. The other major reason is that game AI
typically has well-defined requirements or behavior, often at the behest of design-
ers, whereas traditional AI is often focused on solving more nebulous and general
problems.
Inmanygames,AIbehaviorsaresimplyacombinationofstatemachineruleswith
random variation thrown in for good measure. But there certainly are some major
exceptions. The AI for a complex board game such as chess or Go requires a de-
cision tree, which is a cornerstone of traditional game theory. But a board game
with a relatively small number of possible moves at any one time is entirely dif-
ferent from the majority of video games. Although it's acceptable for a chess AI
to take several seconds to determine the optimal move, most games do not have
this luxury. Impressively, there are some games that do implement more complex
algorithms in real time, but these are the exception and not the rule. In general, AI
in games is about perception of intelligence; as long as the player perceives that
the AI enemies and companions are behaving intelligently, the AI system is con-
sidered a success.
It is also true that not every game needs AI. Some simple games, such as Solitaire
and Tetris , certainly have no need for such algorithms. And even some more com-
Search WWH ::




Custom Search