Friday 27 October 2017

4.1 State Machine


State Machine

A state machine in AI or otherwise known as a finite state machine or FSM is a algorithm used in gaming to give the AI options in real time, it will use this technique to set as its current state which will be what mood or what action the AI chooses to make.

So for example lets use the game Assassins Creed, as the player character approaches the AI villain is this scenario, the AI character will see the player character as see him as a threat which will then using the state machine algorithm set the action for the AI, The AI will then go into an evade state where it could then choose to avoid or run away from the player character. The other option for the AI would be the attack state which is where the AI would then fight the player character.

(12)

Now from Bevilacqua's FSM you can see the basic fundamentals of how the algorithm works, this is the state machine for an AI character. Now the state machine can work in relation to a health bar, for example if the health bar gets below 60% for the AI then the AI would decide to hide or take cover to reduce the risk of taking more damage and reducing health. When the health bar drops again below a certain point, the AI would choose to run from the scene, this links in with the Fuzzy logic algorithm and this is where the state membership has a float range and not made up of 0 and 1's, I have refereed to Fuzzy logic in (4.2 Fuzzy Logic) part of my blog.

A state machine basically consists of a set number of states that are connected in a graph by the transitions between them. A game entity starts with an initial state and then looks out for the events and rules that will trigger a transition to another state. A game entity can only be in exactly one state at any given time.(12) 

To finish, I have inserted a quote from the book Unity AI Game Programming because for me it indicated the definition of FSM. What I mean by this is by looking at the game Pacman and the AI algorithm (1.1 Algorithms) involved in the ghosts AI, they wander the maze, chase Pacman when in attack mode, run away from Pacman when in the evade state and then return when the games complete. It looks at the current event before making its initial decision, then transits into a different state when called upon.

No comments:

Post a Comment

Introduction to: NWC603COM – Using AI in Computer Games Assignment 1

Introduction to: NWC603COM – Using AI in Computer Games Assignment 1 Artificial intelligence (AI) in the gaming world today has become ...