Difference between revisions of "Behaviour"

From RPG Creation Kit
Jump to navigation Jump to search
Line 26: Line 26:


== Purpose State, the Memory of the AI ==
== Purpose State, the Memory of the AI ==
Imagine the AI is following the Player, in this case the AI has as "Current Target" the Player.
Imagine the AI is following the Player, in this case the AI has as "Current Target" the Player and as a Purpose Behaviour "Following".


Now Imagine a bandit comes out of nowhere attacking the Player, the follower will perceive the threat and switch tho the Combat Behaviour.  
Now Imagine a bandit comes out of nowhere attacking the Player, the follower will perceive the threat and switch tho the Combat Behaviour.  

Revision as of 13:48, 13 February 2022

A Behaviour is a data structure that represents a bundle of AI instructions that are used to rule the AI actor that is utilizing it.

Behaviours are made of Behaviour Trees, which is an AI Model widely used in game development, essentially, they are just a collection of nodes that controls the flow of decision making of the AI. In this article it's not explained how a Behaviour Tree is created or how it works, if you're interested in knowing how in the inside Behaviour Trees works and how you can create your custom Behaviours. view Creating Behaviour Trees.

Rather, here we will analyze what a Behaviour is and how it can be used to make the AI perform the actions you want.

Keep in mind that while you do not need to know what a Behaviour Tree is and how to create it (because you can simply select which Behaviour the AI must follow between the existing ones), creating new Behaviour Trees unlocks the full potential of the Rck AI.

You can view a Behaviour as a brain for the AI, each Behaviour has its purpose and allows the AI to perform a certain set of actions, like roaming around the world, sitting on an chair or leaning against a wall, following a path, or attacking an enemy.

You can switch the current Behaviour of the AI at anytime, and you can even concatenate behaviours to create a set of more complex actions that the AI will execute.

Purpose Behaviour and Combat Behaviour

Each AI actor has two Behaviours set at time.

  • A Purpose Behaviour: used for when the AI actor is not in combat, that rules the neutral behaviour of the actor.
  • A Combat Behaviour: used for when the AI engages in combat with an enemy target.


Every time an AI actor perceives a threat or is attacked, he enters in combat and the Current Behaviour is switched to the Combat Behaviour.

When the AI finishs his fight, he will switch back to his Purpose Behaviour.


So we can say that the Purpose Behaviour is the objective of the AI, the why he lives in the world, hence, the purpose, while the Combat Behaviour simply describes how the AI has to fight. There are diverse Purpose Behaviour, while (in the Demo) every AI uses the same Combat Behaviour.

Purpose State, the Memory of the AI

Imagine the AI is following the Player, in this case the AI has as "Current Target" the Player and as a Purpose Behaviour "Following".

Now Imagine a bandit comes out of nowhere attacking the Player, the follower will perceive the threat and switch tho the Combat Behaviour.

Upon switching the Combat Behaviour, he will also switch his target, as now from the Player, his target became the Bandit, and his purpose from following became killing.

Everything works as expected, until the Bandit will die and the AI will switch back to its Purpose Behaviour. The "Current Target" of the follower is in fact still "Bandit", so the result will be that instead of following the player, the AI actor will follow the dead bandit.

Here is where the Purpose State takes his place.

The Purpose State allows you to set a goal for the AI that will be pursued until that goal has been completed or until you set otherwise.