andersch.dev

<2022-05-19 Thu>

Artificial intelligence (AI) in video games

The term artificial intelligence - or AI - in the field of game developement encompasses all mechanisms that serve to improve the intelligence (or the illusion of intelligence) of computer controlled entities (NPCs).

AI in video games differs from academic AI, since the primary goal is the best possible player experience rather than accurate, human-like intelligence.

The two most common systems used in AI programming are Finite State Machines (FSM) and behaviour trees.

Technologies that are usually responsibility of the AI subsystem in a game:

Behavior Tree

Behavior trees are hierarchical models to manage the behavior of AI in games and robotics. Each tree node represents a behavior or decision-making process. Behavior trees are executed in a top-down manner (root node evaluated first).

Node Types:

  • Composite Nodes: Control flow of execution among child nodes.
    • Sequence: Executes child nodes in order until one fails.
    • Selector: Executes child nodes until one succeeds.
  • Decorator Nodes: Modify behavior of a child node (e.g. adding conditions)
  • Leaf Nodes: Represent actual actions or conditions (e.g. moving to a location)

Resources: