artificial intelligence in games

24
AI in Video Games Grzegorz Mazur

Upload: devgamm-conference

Post on 10-Feb-2017

152 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Artificial Intelligence in games

AI in Video Games

Grzegorz Mazur

Page 2: Artificial Intelligence in games

Who we are?

Vile Monarch

Warsaw, Poland

Page 3: Artificial Intelligence in games

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

[email protected]

@dagenoth

Page 4: Artificial Intelligence in games

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

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

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

What makes AI good for developer?

● It should support gameplay... ;)

● Configurable

● Predictable

● Reusable

● Scalable

Page 8: Artificial Intelligence in games

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

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

Finite State Machines

Idle

Combat

Following after enemyRetreat

Page 11: Artificial Intelligence in games

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

Behaviour Trees

Enemy

CombatFollowing after

enemy Idle

Page 13: Artificial Intelligence in games

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

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

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

Behaviour Trees

Page 17: Artificial Intelligence in games

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

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

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

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

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

Influence Mapping

Page 23: Artificial Intelligence in games

Other techniques

● Planners

● BDI

● Neural Networks

● Fuzzy Logic

Page 24: Artificial Intelligence in games

Thank you!

[email protected]

@dagenoth