artificial intelligence in games
TRANSCRIPT
AI in Video Games
Grzegorz Mazur
Who we are?
Vile Monarch
Warsaw, Poland
Who I am?
● Co-Boss and Technical Director at Vile Monarch
● Previously 11bit studios – Lead Programmer of This War of Mine and Sleepwalkers Journey
● Lecturer at Warsaw Film School
● Musician - amateur
@dagenoth
What is AI in games?
● Interactive system that animates game world
● AI Agent
● Agent based on his state and game world state takes action
What is AI in games?
Stimulus, for example:- enemy in sight- hearing call for help- taking damage
State of agent, for ex:- HP level- resource quantity- current goal
AI System
Action, for example:- shooting- playing animation- beginning of movement- command to move troop
What makes AI good for player?
● It should support gameplay...
● ... especially create challenge
● Good AI DOESNT have to be SMART
What makes AI good for developer?
● It should support gameplay... ;)
● Configurable
● Predictable
● Reusable
● Scalable
Scripted AI
● Simple scripts "if X then Y" and event-based programming
● Simple customization
● You have to predict everything
● Its hard to make it emergent
● It becomes drastically complicated with size
Finite State Machines
● In every moment Agent is in a single, specific state. For example: combat, retreat, looking for enemy.
● State → specific behaviour
● Under specific conditions agent can make transistion from current state to another
Finite State Machines
Idle
Combat
Following after enemyRetreat
Behaviour Trees
● Node – complex agent behaviour
● Each node knows if he can run
● When node is running it tries to run its first runnable child
● Thats how tree-based decision structure appears
● At each moment only one branch of tree is running
Behaviour Trees
Enemy
CombatFollowing after
enemy Idle
Behaviour Trees
Enemy
CombatFollowing afterenemy Idle
Choos random POI[Range:5m]
Move[Speed:3][Mode: Walk]
Play random idle animation[Loop: false][Time:5-10s]
Wait[Time:5-10s]
Behaviour Trees
Enemy
CombatFollow after enemy Idle
Is enemy in range[Range: 1m]
Play animation[Animation: hit]
Deal damage[Damage: 30]
Behaviour Trees
● Sequences, selectors, actions, decorators
● After certain time/after certain stimulus we cen reevaluate whole tree
● After reevaluation of tree a new branch can start running
● Behaviour trees look similar to hierarchical finiste state machines
Behaviour Trees
Influence Mapping
● Method of finding areas in which we should move our troops
● Game world represented by grid or graph
Influence Mapping
● Each unit/building/resource on a map has its own base influence – area and value
● Map of our influence
● Map of enemy influence
Influence Mapping
● Influence Map = Our influence map – enemy influence map
● Weight of area = influence / cost of movement
● Goal for troop = area with highest weight
Influence Mapping
● Tension map = our influence + enemy influence
● The higher value – the bigger forces at the area
● Vulnerability map = tension map – ABS(influence map)
● The higher value – the bigger even fights at the area
Influence Mapping
● Based on information from different maps and additonal conditions we can create any strategy
● Optionally we can introduce inertia and propagation of influence
● Designer can introduce his own additional goal map
● Simple scripts are enough to make use of influence map
Influence Mapping
Other techniques
● Planners
● BDI
● Neural Networks
● Fuzzy Logic