Skip to content

Behaviour Trees

Kurtis edited this page Sep 30, 2021 · 3 revisions

Behaviour Trees

Behaviour trees are used to program AI in the game. Anything autonomous from NPCs to enemies are controlled by behaviour trees.

1. Node Types

Conceptually, there are three types of nodes in our behaviour tree model:

  1. Input Node
    • Input nodes take data from the world and store them in the behaviour tree. Example: Finding the player entity.
  2. Processing Node
    • Processing nodes take stored data and interpret and change that data. These are the core of behaviour trees. Example: Taking the already retrieved player and getting its position.
  3. Action Node
    • Action nodes use the data from the input & processing nodes to take certain actions. Example: Moving towards the player's position.

2. Node Documentation

Name Type Function
FindActorByTagNode Input Finds an actor via the given tag.
GetActorPositionNode Processing Gets the position of a stored actor.
GetRandomPositionNode Processing Generates a random position within a certain radius from a stored origin.
HasPropertyNode Processing Returns success if the agent has the specified property.
NotNode Processing Succeeds if its children fail, and fails if its children succeed.
RangeCheckNode Processing Succeeds if the agent is within the specified distance of a stored position; else fails.
SelectorNode Processing Executes children until one doesn't fail.
SequenceNode Processing Executes children until one doesn't succeed.
SimpleMoveNode Action Moves the agent toward a stored position ignoring physics and without pathfinding.
SuccessNode Processing Always succeeds.

3. Node Methods (IBehaviourTreeNode)

Behaviour tree nodes must inherit the IBehaviourTreeNode interface, which comes with two methods:

void Init(Behaviour behaviour)

The init method is used to create and initialize methods on this node.

NodeStatus Tick(Tree<Behaviour>.Node self, BehaviourObject obj)

Tick is called once per frame when this node is running. This is where a node will process data and do what it needs to do during runtime.

About

> Home
> Our Team
> Milestone 1: αω plasmashark

Programming

Setup
> Merge Conflicts
> Using GitHub

Tools
> Behaviour Trees

Game Systems

Character
> Level Progression
> Alignment
> Inventory

Gameplay
> Gameplay Loop
> Combat
> Quests
> Items
> Dialogue

Content Design

Art
> Art Style
> Thematic Decisions
> UI

Music + Sound
> Inspiration Board

Story
> Prologue

Clone this wiki locally