Write introduction into BTs in the BehaviorTree class doc

This commit is contained in:
Serhii Snitsaruk 2023-10-23 22:28:44 +02:00
parent d481d43790
commit 93cba4581a
1 changed files with 12 additions and 7 deletions

View File

@ -4,8 +4,13 @@
Contains Behavior Tree data. Contains Behavior Tree data.
</brief_description> </brief_description>
<description> <description>
[BehaviorTree] is a hierarchical structure used to model and control the behavior of agents in a game. It is composed of tasks that represent specific actions or decision-making rules. The [BehaviorTree] is executed from the root task down to the leaf tasks, which represent the actual actions or behaviors that the agent should perform. Behavior Trees are hierarchical structures used to model and control the behavior of agents in a game (e.g., characters, enemies, entities). They are designed to make it easier to create complex and highly modular behaviors for your games.
See also [BTTask] class. Behavior Trees are composed of tasks that represent specific actions or decision-making rules. Tasks can be broadly categorized into two main types: control tasks and leaf tasks. Control tasks determine the execution flow within the tree. They include [BTSequence], [BTSelector], and [BTInvert]. Leaf tasks represent specific actions to perform, like moving or attacking, or conditions that need to be checked. The [BTTask] class provides the foundation for various building blocks of the Behavior Trees. BT tasks can share data with the help of [Blackboard]. See [member BTTask.blackboard] and [Blackboard].
[b]Note:[/b] To create your own actions, extend the [BTAction] class.
The BehaviorTree is executed from the root task and follows the rules specified by the control tasks, all the way down to the leaf tasks, which represent the actual actions that the agent should perform or conditions that should be checked. Each task returns a status when it is executed. It can be [code]SUCCESS[/code], [code]RUNNING[/code], or [code]FAILURE[/code]. These statuses determine how the tree progresses. They are defined in [enum BT.Status].
Behavior Trees handle conditional logic using condition tasks. These tasks check for specific conditions and return either [code]SUCCESS[/code] or [code]FAILURE[/code] based on the state of the agent or its environment (e.g., "IsLowOnHealth", "IsTargetInSight"). Conditions can be used together with [BTSequence] and [BTSelector] to craft your decision-making logic.
[b]Note[/b]: To create your own conditions, extend the [BTCondition] class.
Check out the [BTTask] class, which provides the foundation for various building blocks of Behavior Trees.
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>
@ -13,13 +18,13 @@
<method name="clone" qualifiers="const"> <method name="clone" qualifiers="const">
<return type="BehaviorTree" /> <return type="BehaviorTree" />
<description> <description>
Makes a copy of behavior tree. Makes a copy of the BehaviorTree resource.
</description> </description>
</method> </method>
<method name="get_root_task" qualifiers="const"> <method name="get_root_task" qualifiers="const">
<return type="BTTask" /> <return type="BTTask" />
<description> <description>
Returns root task of the [BehaviorTree] resource. Returns the root task of the BehaviorTree resource.
</description> </description>
</method> </method>
<method name="instantiate" qualifiers="const"> <method name="instantiate" qualifiers="const">
@ -27,20 +32,20 @@
<param index="0" name="p_agent" type="Node" /> <param index="0" name="p_agent" type="Node" />
<param index="1" name="p_blackboard" type="Blackboard" /> <param index="1" name="p_blackboard" type="Blackboard" />
<description> <description>
Instantiates behavior tree and returns the root [BTTask]. Instantiates the Behavior Tree and returns the root [BTTask].
</description> </description>
</method> </method>
<method name="set_root_task"> <method name="set_root_task">
<return type="void" /> <return type="void" />
<param index="0" name="p_value" type="BTTask" /> <param index="0" name="p_value" type="BTTask" />
<description> <description>
Assign new root task to [BehaviorTree] resource. Assigns a new root task to the [BehaviorTree] resource.
</description> </description>
</method> </method>
</methods> </methods>
<members> <members>
<member name="description" type="String" setter="set_description" getter="get_description" default="&quot;&quot;"> <member name="description" type="String" setter="set_description" getter="get_description" default="&quot;&quot;">
User-provided description of BehaviorTree. User-provided description of the BehaviorTree.
</member> </member>
</members> </members>
</class> </class>