limboai/doc_classes/BehaviorTree.xml

59 lines
3.5 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<class name="BehaviorTree" inherits="Resource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description>
Contains Behavior Tree data.
</brief_description>
<description>
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.
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>
<tutorials>
</tutorials>
<methods>
<method name="clone" qualifiers="const">
<return type="BehaviorTree" />
<description>
Makes a copy of the BehaviorTree resource.
</description>
</method>
<method name="copy_other">
<return type="void" />
<param index="0" name="p_other" type="BehaviorTree" />
<description>
Become a copy of another behavior tree.
</description>
</method>
<method name="get_root_task" qualifiers="const">
<return type="BTTask" />
<description>
Returns the root task of the BehaviorTree resource.
</description>
</method>
<method name="instantiate" qualifiers="const">
<return type="BTTask" />
<param index="0" name="p_agent" type="Node" />
<param index="1" name="p_blackboard" type="Blackboard" />
<description>
Instantiates the Behavior Tree and returns the root [BTTask].
</description>
</method>
<method name="set_root_task">
<return type="void" />
<param index="0" name="p_value" type="BTTask" />
<description>
Assigns a new root task to the [BehaviorTree] resource.
</description>
</method>
</methods>
<members>
<member name="description" type="String" setter="set_description" getter="get_description" default="&quot;&quot;">
User-provided description of the BehaviorTree.
</member>
</members>
</class>