top of page

Stealth Design Part 2 - AI States

  • Writer: gamedesigndiary
    gamedesigndiary
  • Feb 14, 2024
  • 8 min read

Updated: Feb 15, 2024



Part 2 of the Stealth series focuses on AI States. There are multiple building blocks to a great stealth system, AI States, Player Detection (Visual & Audio), Abilities & Gear, AI Varieties & Level Design.

 

Remember there are many approaches to any system so always consider What Experience your design needs to deliver, Why it needs to deliver this experience & How you will deliver this design while knitting it into other complimentary game systems to deliver on the vision.

 

Part 2 - AI states

Part 3 - States & behaviour

Part 4 - Audio detection

Part 5 - Stealth system summary

Part 6 - AI variants & equipment

Part 7 - Combat

Part 8 - Level design tips

Part 9 - The 3 C's - camera, control & character

Part 10 - Co-op

 

Feel free to message me (click here) if you have questions.

 

Stealth Series

Part 2 - States & behaviours

 

This post will cover the AI states triggered by the detection system covering:

 

1 - State flow overview

2 - State descriptions

3 - Player feedback & gameplay

4 - Summary

 

An enemies response to the players actions needs to feel consistent & believable. Reactions must be clear to the player allowing them to form a tactical response to any situation or even manipulate AI. The AI states/reactions should be varied enough to provide emergent & diverse gameplay.


1 - State-flow overview


Games with AI have states that change in response to detecting the players actions. Some require more states & others less depending on what's needed e.g. Mario 3D DS has a mushroom that only requires a simple state-flow of Idle/patrol to combat back to idle/patrol.



  • In this case the mushroom simply moves between the two states based on player proximity or aggression (throwing fireballs)

  • Players can move away from the encounter to avoid combat, it is their tactical choice to fight or not.

  • Animation, sound & FX reinforce the change between states communicating safe vs. danger of an attack



[Note: I truly love the imagination & playfulness of Mario titles]


Stealth games require multiple states in order to successfully convey appropriate enemy reactions to the player, ability, equipment or level actions & events. It also needs to provide a way back to stealth. The player is at their most powerful while they are hidden so we must allow them to regain this advantage if detected.

 

A stealth state-flow moves AI's between game play states, in this case the states being Casual, Suspicious (x3) & Combat. This state-flow covers what we need for a stealth experience. States must:

 

  • Be driven by a robust & consistent detection system that drives the change between states (see Part 1)

  • Provide a path back to stealth from combat e.g. AI's returning to a casual state

  • Provide a believable response to varying levels of events

  • Provide understandable & consistent responses, empowering the player to learn & be more in control & formulate their tactical solutions by having clear state behaviours.

  • Provide variety & challenge as levels progress & add new enemy varieties, new abilities & new equipment creating more diverse & interesting challenges to solve.

The state-flow below in combination with our light detection system (link) provides players with enemies that can be causal, alert, curious, search, aggressively search or identify the player & enter combat.


A typical transition through this state-flow would be:

 

  • Starting in an unaware a casual state the AI will show suspicion when they first detect the player. If the player is still in view the AI changes to a casual search as 'they think they saw something' to close the distance & then changing to a more aggressive search as they become more aware of 'definitely' seeing something.

  • At any time the player can withdraw into darkness & the AI will eventually return to a casual state.

  • If the player remains detectable the enemy's will eventually identify the player as an enemy & enter a combat state

  • If the player manages to evade the AI & hide during combat, the enemy will eventually return to an alerted casual state after finishing their search near the players last know position.

  • Due to previously being in combat, these AI's have enter an 'alerted casual' state representing them being more on edge. If the enemy then detects the player again they will enter an aggressive search & skip a suspicious search.

  • If the player hides & a significant amount of time passes the AI will return to a casual state finally dropping their guard.



[Note: This is just one result of how the state-flow could unfold. However enemies could start in an alert casual state or skip search state steps depending on how quickly the players detection raises etc.. It's a very flexible system]


2 - State descriptions

 

Here is a brief description of the behaviours in the states above:

 

  • Casual – The AI carries out their job/behaviour e.g. patrolling, sitting at a computer, talking etc. unaware of the player.

  • Casual Alert – The AI carries out their job/behaviour with heighted sense of ‘alert’ e.g. The AI now looks around more or now patrol with a flashlight in dark environments.

  • Suspicious ‘Turn & Look’ - The AI’s actions should communicate having briefly see something e.g. stop walking & then orientate themselves in that direction. If they continue to see the player they will enter a search state else they will return to their job.

    • AI's should also respond to objects such as switching a light off or a gadget used by the player as a lure or distract.

  • Suspicious:  ‘Search’ - The AI sees something ‘strange’ & will investigates at an unhurried pace

    • Untrained AI’s search in a more sloppy pattern, a shorter period of time & be faster to return from an alert casual state to a casual state.

    • Elite AI’s should be more effective in their search patterns, remaining alert for longer.

    • AI's also respond to objects such as a light switched off or a gadget used by the player as a lure or distraction.

  • Suspicious:  ‘Aggressive Search’ - The AI has definitely seen something that doesn’t belong in the world but not identified yet as the player or hostile. They will initiate a quicker & more determined search of the location.

    • A search switches to aggressive if a second event occurs during a search or the AI definitely sees something.

    • The suspicious state is also aggressive if the AI loses track of the player in combat & then see something after returning to causal alert.

    • AI will search aggressively if they are in a high security area (often using equipment such as a torch).

  • Combat – AI has detected & identified the player & their location. Combat is initiated until the player is killed or they lose track of them.

    • Elite & untrained soldiers combat behaviours should reflect their training.

    • Civilians maybe or may not enter combat, if they don't, a flee, scream or cover behaviour should be initiated instead.

 

[Note: I'll cover animals, automated defences, alarms, gadgets & AI variants in part 6 of this series. I will not be covering sci-fi as we are basing this in a modern contemporary military setting.]

 

3 - Player feedback & gameplay

 

State changes must be identifiable by the player the moment they happen, if the player has to spend too long identifying what's going on they will get frustrated or worse perform an incorrect action that leads to combat or death. You must empower the player to have time to make tactical choices. With this in mind there are a few things to consider when designing your feedback:

 

Animation:

  • Animations provide a narrative that informs the player of what is likely to happen at any moment

    • An enemy soldier stopping during a their patrol to sit down & relaxing does not require any special attention, the animation tells the story.

  • The way enemies perform their action shows they are trained vs. untrained guards

  • Make the intensity of animations matches the state i.e. A casual search vs. an intense search.

  • If the AI is going to use a equipment such as a torch as part of a search make a show of it. Take time to equip it & turn it on before continuing with a search (or add an audio bark).

  • Be fair, don't surprise the player with a random action that is not appropriate to the moment or fully unpredictable to the player resulting in combat.

  • Exaggerate your animations to avoid being too subtle but avoid making it into a parody.

  • Less intense state changes such as patrol to search can have longer transitions reflecting the lacy of urgency.

  • Even an 'instant' state change such as casual to combat must have a beat to give the player an option to react when possible.

  • Balance the speed of your animations vs. the players mobility.

    • For example: When the player is crouched, check the search speed of a searching enemy. If the enemy can close a medium distance to the player quicker than the player is able to relocate far enough from their last know position you need to adjust.

    • Check multiple distance to make sure that enough tactical options are available e.g. relocating, gadget use, prepare an ambush etc.

 

Audio, HUD:

  • Keep HUD usage (if you have a HUD) to the big things, you do not want a to hit information overload, keep it simple

  • Change the music/sfx mix with the state-flow changes can reinforce intensity & enhance the drama

  • Audio barks from enemy's pre-empt an AI action helping the player to react faster or reveal enemy's not in the players line of site

  • If it works for your game use colour to help convey a warning, we all know what green, orange & red mean.

  • Environmental sfx can have a massive effect on gameplay allowing players to hear everything in a quiet abandoned building vs. hearing almost nothing in a storm on a boat in the ocean.

 

Environments & story:

  • Set the scene with the environment & make sure the enemies within fit the location.

  • Always consider what is going on in the story & the effects of this on enemies, player and gameplay e.g.

    • Location: A military base.

    • Everything is calm, the lights are on reducing the places for the player to hide in. However there are only a few soldiers on patrol in a casual state. The area is also quiet so the player must be careful of making noise.

    • Halfway into the player infiltration the power of the base is cut a& as the backup generators kick in an alarm suddenly sounds (not the players doing, a set-piece).

    • Red emergency lights come on creating a lot more shadow for the player to move around in as well as an alarm that masks any noise the player makes.

    • More soldiers appear in the area an alerted state searching the area at random.

    • In a split-second the drama has increased & the gameplay has changed completely.

  • For major gameplay features make sure you provide tutorials as part of the level/story by showing actions/skills/events in game or provide a training option e.g. VR missions in Metal gear solid


[Note: During prototyping, use solid coloured AI to reflect state changes & test scenarios in various white box arenas (do this before you have expensive audio, animation or HUD). Your final solutions should communicate as clearly as they did in the prototype using these colours.]


4 - Summary

 

Use this as a base, then evolve/change it to fit your game's needs. Add new behaviours to each state that create more gameplay possibilities. I'll finish with these takeaways:

 

  • Feedback for each state must be clear & instantly show what's happening, subtle doesn’t work.

  • Clear feedback empowers players to make informed tactical decisions.

  • Always try to add to the narrative through your AI.

  • Reward the player for being observant & patient.

Comments


Commenting on this post isn't available anymore. Contact the site owner for more info.

© 2023 by Sasha Blake. Proudly created with Wix.com

bottom of page