Behaviour trees

Behaviour trees let the user define conditional behaviours for your simulation. With behaviour trees, you can define both simple and complex behaviours depending on certain conditions.
The Atoms UI has a behaviour tree editor where you create behaviour tree graphs. For a full list of nodes, please check this page.

The behaviour tree differs from the state machine as each node is considered a task rather than a state. Each task/node will either iterated through child nodes, verify certain conditions, perform actions on the agents or the blackboard, etc.
A Behaviour tree is graphically represented as a directed tree in which the nodes are classified as root, decorators, composite and behaviours.

Behaviour trees work alongside Blackboards which can be nested. Blackboards store data (Blackboard keys) the behaviour tree needs to know to make informed decisions. For instance, depending on the value of a specific key, you might process different behaviour tree branches.
A Behaviour Tree will always have a Blackboard.  In Atoms, a parent blackboard can optionally be created on the Behaviour Tree module to send data to the Behaviour Tree to take decisions depending on the scene content.

It's important to know Atoms creates a Behaviour Tree and Blackboard per agent, but users can edit other agents belonging to the same simulation from within a Behaviour Tree.


Nodes

Nodes can return tree values during the tree execution: Running, Success or Failure. 
Depending on each node's return value and the tree logic, the tree will run in a certain way.

Each node has parameters, and the value of these parameters can be linked to a blackboard key of the same type. This is how nodes can pass data to other nodes in the same tree.

You will find the following nodes in a Behaviour Tree:

  • Root Node: The Root node is actually a decorator, but it acts as the start point of the graph.
  • Composite Nodes: Composite nodes work with multiple children and execute them in a specific order based on the composite functionality.
    The children of a composite node are always evaluated from top to bottom (nodes are ordered based on their position Y value in the graph, no matter how their connections are visually displayed inside the graph).
  • Decorator Nodes: Decorator nodes have one child. Decorators provide extra functionality to the child, check conditions, etc.
  • Behaviour Nodes: Behaviour nodes do not have any child and act as the end of points on the graph's branch. A behaviour node is used for setting agent metadata or blackboard keys, although they cover several other functionalities.

Blackboard

Blackboards can contain any number of keys which be of different types.

Users can specify default values for each key, and these values can be edited during the simulation.

Keys can be linked to agent metadata:

  • None, the key is not attached to an agent metadata, and it is a simple blackboard key
  • Link, the key is linked with an agent metadata having the same name of this key
  • Cache, the value of the agent metadata having the same name as this key is cached before the computation of all agents trees. In this way, even if you edit metadata, you will still be able to access its original value during a single frame evaluation.

UI Interaction

Please find below a list of mouse actions which can be performed in the node viewport.

  • Left mouse click on node: Select node (works with Shift and Ctrl modifiers)
  • Left mouse click on node+ drag: Select node and move
  • Left mouse click on viewport + drag: Select node with a marquee  (works with Shift and Ctrl modifiers)
  • Right mouse click on viewport: show node list
  • Click on node port + drag + drop on another node port: create connection
  • Click on node port + drag + drop on viewport: show node list; if a valid node is selected from the list, a new node is created and connected
  • Ctrl click on connected port + drag: Disconnect port (connections can be connected to another port)
  • Right click on a connection: show menu for changing connection interpolation


Please find below a list of keyboard shortcuts:

  • f : frame graph
  • Shift + f:  frame selection
  • Backspace or Del : delete selected nodes
  • Ctrl + C: copy selected nodes
  • Ctrl + V: paste
  • Ctrl + Z: undo
  • Ctrl + Y: redo



Copyright © 2017, Toolchefs LTD.