Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/customer/www/qualgame.com/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340
Behavior Forest | BtEngineSDK

Behavior Forest

Table of contents

1. Introduction
2. Behavior Forest Components
2.1 Behavior Forest Root Node
2.2 Behavior Forest Node
2.3 Behavior Tree Node
3. Behavior Forest Operations
3.1 Play
3.2 Pause
3.3 Resume
3.4 Stop
3.5 Reset
3.6 Load
3.7 Destroy
4. Behavior Forest Properties
4.1 Forest Property Wrapper

1. Introduction
A behavior forest is a group of behavior trees. The behavior forest interface provides several group tree operations. All of the trees in a forest were implemented to run in separated threads.

2. Behavior Forest Components
Behavior forest components include these nodes: Behavior Forest Root Node, Behavior Forest Node, and Behavior Tree Node.

2.1 Behavior Forest Root NodeForestRootNode

A Behavior Forest Root Node represents the root node of a group of behavior forests that can be loaded and run by the behavior tree engine.

2.2 Behavior Forest NodeForestNode

A Behavior Forest Node represents a group of behavior trees that share some properties and operations. The ForestNode class is the representation of a Forest Node instance that performs corresponding responses on the Unity engine side. A list of node operations are defined to perform these operations accordingly.

Member Function Definition
OnConstruct A node operation that is invoked when loading any one of the trees in a non-existing forest.
OnDestruct A node operation that is invoked when destroying all of the trees in an existing forest.

2.3 Behavior Tree NodeTreeNode

A Behavior Tree Node represents an individual behavior tree with a corresponding behavior tree xml file name, which is also equivalent to the Tree Root Node in a behavior tree diagram.

3. Behavior Forest Operations
The group tree operations at forest level include these operations: play, pause, resume, stop, reset, load, and destroy.

3.1 Play

Start to execute all existing tree instances in a forest with each tree specific accumulated loop count reset to 0. Refer to the Bt Engine API of group tree operations at forest level – BtEngine.Play.

3.2 Pause

Pause all existing tree instances in a forest. Refer to the Bt Engine API of group tree operations at forest level – BtEngine.Pause.

3.3 Resume

Resume to execute all existing tree instances that were paused in a forest with each tree specific remaining loop count. Refer to the Bt Engine API of group tree operations at forest level – BtEngine.Resume.

3.4 Stop

Stop all existing tree instances in a forest. Refer to the Bt Engine API of group tree operations at forest level – BtEngine.Stop.

3.5 Reset

Reset all existing tree instances in a forest. Refer to the Bt Engine API of group tree operations at forest level – BtEngine.Reset.

3.6 Load

Instantiate a non-existing forest and all non-existing trees in it. Refer to the Bt Engine API of group tree operations at forest level – BtEngine.Load.

3.7 Destroy

Destroy an existing forest instance and all existing tree instances in it. Refer to the Bt Engine API of group tree operations at forest level – BtEngine.Destroy.

4. Behavior Forest Properties

4.1 Forest Property Wrapper

The properties of a forest instance can be queried from a forest property wrapper. The forest property wrapper is a wrapper that contains the properties from the forest level down to the node level depending on the depth level. The depth level of the forest property wrapper can also be specified when acquiring the property wrapper from the Bt Engine API. The forest property wrapper enable users to iterate through all properties of those tree and node instances under a particular forest instance. Refer to the Bt Engine API of forest properties – BtEngine.GetForestPropWrap.