artificial intelligence in games
TRANSCRIPT
![Page 1: Artificial Intelligence in games](https://reader031.vdocument.in/reader031/viewer/2022022201/589d572b1a28abef688b51b1/html5/thumbnails/1.jpg)
AI in Video Games
Grzegorz Mazur
![Page 2: Artificial Intelligence in games](https://reader031.vdocument.in/reader031/viewer/2022022201/589d572b1a28abef688b51b1/html5/thumbnails/2.jpg)
Who we are?
Vile Monarch
Warsaw, Poland
![Page 3: Artificial Intelligence in games](https://reader031.vdocument.in/reader031/viewer/2022022201/589d572b1a28abef688b51b1/html5/thumbnails/3.jpg)
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
![Page 4: Artificial Intelligence in games](https://reader031.vdocument.in/reader031/viewer/2022022201/589d572b1a28abef688b51b1/html5/thumbnails/4.jpg)
What is AI in games?
● Interactive system that animates game world
● AI Agent
● Agent based on his state and game world state takes action
![Page 5: Artificial Intelligence in games](https://reader031.vdocument.in/reader031/viewer/2022022201/589d572b1a28abef688b51b1/html5/thumbnails/5.jpg)
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
![Page 6: Artificial Intelligence in games](https://reader031.vdocument.in/reader031/viewer/2022022201/589d572b1a28abef688b51b1/html5/thumbnails/6.jpg)
What makes AI good for player?
● It should support gameplay...
● ... especially create challenge
● Good AI DOESNT have to be SMART
![Page 7: Artificial Intelligence in games](https://reader031.vdocument.in/reader031/viewer/2022022201/589d572b1a28abef688b51b1/html5/thumbnails/7.jpg)
What makes AI good for developer?
● It should support gameplay... ;)
● Configurable
● Predictable
● Reusable
● Scalable
![Page 8: Artificial Intelligence in games](https://reader031.vdocument.in/reader031/viewer/2022022201/589d572b1a28abef688b51b1/html5/thumbnails/8.jpg)
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
![Page 9: Artificial Intelligence in games](https://reader031.vdocument.in/reader031/viewer/2022022201/589d572b1a28abef688b51b1/html5/thumbnails/9.jpg)
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
![Page 10: Artificial Intelligence in games](https://reader031.vdocument.in/reader031/viewer/2022022201/589d572b1a28abef688b51b1/html5/thumbnails/10.jpg)
Finite State Machines
Idle
Combat
Following after enemyRetreat
![Page 11: Artificial Intelligence in games](https://reader031.vdocument.in/reader031/viewer/2022022201/589d572b1a28abef688b51b1/html5/thumbnails/11.jpg)
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
![Page 12: Artificial Intelligence in games](https://reader031.vdocument.in/reader031/viewer/2022022201/589d572b1a28abef688b51b1/html5/thumbnails/12.jpg)
Behaviour Trees
Enemy
CombatFollowing after
enemy Idle
![Page 13: Artificial Intelligence in games](https://reader031.vdocument.in/reader031/viewer/2022022201/589d572b1a28abef688b51b1/html5/thumbnails/13.jpg)
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]
![Page 14: Artificial Intelligence in games](https://reader031.vdocument.in/reader031/viewer/2022022201/589d572b1a28abef688b51b1/html5/thumbnails/14.jpg)
Behaviour Trees
Enemy
CombatFollow after enemy Idle
Is enemy in range[Range: 1m]
Play animation[Animation: hit]
Deal damage[Damage: 30]
![Page 15: Artificial Intelligence in games](https://reader031.vdocument.in/reader031/viewer/2022022201/589d572b1a28abef688b51b1/html5/thumbnails/15.jpg)
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
![Page 16: Artificial Intelligence in games](https://reader031.vdocument.in/reader031/viewer/2022022201/589d572b1a28abef688b51b1/html5/thumbnails/16.jpg)
Behaviour Trees
![Page 17: Artificial Intelligence in games](https://reader031.vdocument.in/reader031/viewer/2022022201/589d572b1a28abef688b51b1/html5/thumbnails/17.jpg)
Influence Mapping
● Method of finding areas in which we should move our troops
● Game world represented by grid or graph
![Page 18: Artificial Intelligence in games](https://reader031.vdocument.in/reader031/viewer/2022022201/589d572b1a28abef688b51b1/html5/thumbnails/18.jpg)
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
![Page 19: Artificial Intelligence in games](https://reader031.vdocument.in/reader031/viewer/2022022201/589d572b1a28abef688b51b1/html5/thumbnails/19.jpg)
Influence Mapping
● Influence Map = Our influence map – enemy influence map
● Weight of area = influence / cost of movement
● Goal for troop = area with highest weight
![Page 20: Artificial Intelligence in games](https://reader031.vdocument.in/reader031/viewer/2022022201/589d572b1a28abef688b51b1/html5/thumbnails/20.jpg)
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
![Page 21: Artificial Intelligence in games](https://reader031.vdocument.in/reader031/viewer/2022022201/589d572b1a28abef688b51b1/html5/thumbnails/21.jpg)
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
![Page 22: Artificial Intelligence in games](https://reader031.vdocument.in/reader031/viewer/2022022201/589d572b1a28abef688b51b1/html5/thumbnails/22.jpg)
Influence Mapping
![Page 23: Artificial Intelligence in games](https://reader031.vdocument.in/reader031/viewer/2022022201/589d572b1a28abef688b51b1/html5/thumbnails/23.jpg)
Other techniques
● Planners
● BDI
● Neural Networks
● Fuzzy Logic