Finite State Machines in Games - PowerPoint PPT Presentation

1 / 5
About This Presentation
Title:

Finite State Machines in Games

Description:

Reminder. Next class (Tuesday) , you should have formed groups and select a topic for presentation among: Real-Time Strategy games (Luis Villegas, Dulmovits ... – PowerPoint PPT presentation

Number of Views:27
Avg rating:3.0/5.0
Slides: 6
Provided by: Jarr157
Category:

less

Transcript and Presenter's Notes

Title: Finite State Machines in Games


1
Finite State Machines in Games
  • Jarret Raim
  • 2004
  • Based on
  • AI Game Programming Wisdom 2

2
FSM Example
  • States
  • Attack
  • Chase
  • Spawn
  • Wander
  • Events
  • E see an enemy
  • S hear a sound
  • D die

Attack
E
D
E
Wander
E
E
Spawn
D
Problem Cant remember what we were doing
3
FSM Implementation - Code
  • Simplest method
  • After an action, the state might change.
  • Requires a recompile for changes
  • No pluggable AI
  • Not accessible to non-programmers
  • No set structure
  • Can be a bottleneck.

void RunLogic( int state ) switch( state )
case 0 //Wander Wander()
if( SeeEnemy() ) state 1
if( Dead() ) state 2
break case 1 //Attack
Attack() state 0 if(
Dead() ) state 2 break
case 3 //Dead SlowlyRot()
break
4
FSM Example
Attack
Problem Cant remember what we were doing
E
D
E
Wander
E
E
Spawn
D
Solution Add an stack to keep track of the
states I have visited
5
Stack FSM Thief 3
Stack allows AI to move back and forth between
states.
Leads to more realistic behavior without
increasing FSM complexity.
Write a Comment
User Comments (0)
About PowerShow.com