[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.3.9 Behaviour Tree

Property Class Details

General Information

A behaviour tree is an ai tool for designing character behaviours and controlling enitities. A CEL behaviour tree can replicate any standard FSM in an intuitive manner. Behaviour trees are responsive and useful for programming standard behaviours with fallback plans.

Anybody interested in this tool is highly recommended to visit http://www.AiGameDev.com, specifically these freely available resources:


Each node of a CEL behaviour tree must implement the iBTNode interface. That is it must have an execute method that returns a boolean indicating its success of failure and an add child method. It is possible for developers to create their own nodes if they wish to add unavailable functionality to their tree, however, the basic nodes provided are very descriptive and powerful when used in combination.

Selectors (plgSelectors)

A selector is a composite node, it has multiple children that it must decide which to execute. The following selectors are available at this time in CEL:

Leaf Nodes (plgBehaviourTree)

The leaf nodes of a behaviour tree are where conditions are evaluated or actions performed. To make use of CEL rewards, triggers and parameters, the following wrapping classes are available.

It is possible to define your own leaf nodes and it is expected that many developers may choose to implement bespoke conditional nodes for checking game specific data.

Decorators (plgDecorators)

Decorators tend to have only one child (although they are not limited to as such). There purpose is not to decide an action to take but to add some functionality to their child node/subtree. A number of decorators have been implemented as default in CEL, they are:

Again it is possible to define your own decorators by implementing the iBTNode interace. It is hoped that as public use of the CEL behaviour tree grows, so will the library of available decorators. Their potential uses covers a wide spectrum of possibilities and the more available the more powerful the tool becomes. For example decorators that may be of use, please see http://aigamedev.com/hierarchical-logic/decorator/.

Construction and Execution

Finally to construct a behaviour tree, each node must be connected to its children using its own AddChild (iBTNode* child) method from the interface iBTNode.

The root node must then be set as the child of an instance of cel.behaviourtree. The execute of this instance can then be executed, and the tree will be evaluated each frame.

Alternatively, if the tree need only be evaluated occasionally the developer may choose not to create the behaviour tree node and instead call the execute method of the root node whenever they require for single shot evaluations of the tree.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated using texi2html 1.76.