Update class docs

This commit is contained in:
Serhii Snitsaruk 2023-09-19 13:44:26 +02:00
parent efe693347e
commit 827dc80cce
4 changed files with 36 additions and 26 deletions

24
doc_classes/BT.xml Normal file
View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="BT" inherits="Resource" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description>
Base of [BTTask].
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<constants>
<constant name="FRESH" value="0" enum="Status">
Task wasn't executed yet or execution was cancelled.
</constant>
<constant name="RUNNING" value="1" enum="Status">
Task is being performed and hasn't finished yet.
</constant>
<constant name="FAILURE" value="2" enum="Status">
Task has finished with failure.
</constant>
<constant name="SUCCESS" value="3" enum="Status">
Task has finished with success.
</constant>
</constants>
</class>

View File

@ -6,7 +6,7 @@
<description> <description>
Base class for all [BehaviorTree] conditions. Extend [code]BTCondition[/code] to create your own conditions. Base class for all [BehaviorTree] conditions. Extend [code]BTCondition[/code] to create your own conditions.
Condition is a task in a [BehaviorTree] that checks for a specific condition before executing subsequent tasks and often used inside composite tasks to control the execution flow. It is used to verify the state of the environment, check for the presence of an enemy, or evaluate the health status of the agent. The use of [BehaviorTree] condition tasks can improve the efficiency of the system and avoid unnecessary actions. However, it may not be suitable for complex decision-making processes, and too many condition tasks can make the [BehaviorTree] difficult to read. Condition is a task in a [BehaviorTree] that checks for a specific condition before executing subsequent tasks and often used inside composite tasks to control the execution flow. It is used to verify the state of the environment, check for the presence of an enemy, or evaluate the health status of the agent. The use of [BehaviorTree] condition tasks can improve the efficiency of the system and avoid unnecessary actions. However, it may not be suitable for complex decision-making processes, and too many condition tasks can make the [BehaviorTree] difficult to read.
Conditions usually don't take multiple ticks to finish and return [constant BTTask.SUCCESS] or [constant BTTask.FAILURE] immeditely. Conditions usually don't take multiple ticks to finish and return [code]SUCCESS[/code] or [code]BT.FAILURE[/code] immeditely.
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>

View File

@ -12,7 +12,7 @@
<method name="get_last_status" qualifiers="const"> <method name="get_last_status" qualifiers="const">
<return type="int" /> <return type="int" />
<description> <description>
Returns last execution status. See [enum BTTask.TaskStatus]. Returns last execution status. See [enum BT.Status].
</description> </description>
</method> </method>
<method name="restart"> <method name="restart">

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="BTTask" inherits="Resource" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd"> <class name="BTTask" inherits="BT" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description> <brief_description>
Base class for [BehaviorTree] tasks. Base class for [BehaviorTree] tasks.
</brief_description> </brief_description>
<description> <description>
Base class for all [BehaviorTree] tasks. A task is a building block in a [BehaviorTree] that represents a specific behavior or control flow. It is the basic unit of the Behavior Tree (BT) and is used to create complex behaviors by combining and nesting tasks in a hierarchy. Base class for all [BehaviorTree] tasks. A task is a building block in a [BehaviorTree] that represents a specific behavior or control flow. It is the basic unit of the Behavior Tree (BT) and is used to create complex behaviors by combining and nesting tasks in a hierarchy.
Tasks perform work and return their status with [method _tick]. See [enum TaskStatus]. Tasks perform work and return their status with [method _tick]. See [enum BT.Status].
A Task can be an action, a condition, a composite, or a decorator. Each type of task has its own corresponding subclass: [BTAction], [BTCondition], [BTDecorator], [BTComposite]. A Task can be an action, a condition, a composite, or a decorator. Each type of task has its own corresponding subclass: [BTAction], [BTCondition], [BTDecorator], [BTComposite].
[b]Note:[/b] Do not extend [code]BTTask[/code] directly for your own tasks, instead extend one of the subtypes above. [b]Note:[/b] Do not extend [code]BTTask[/code] directly for your own tasks, instead extend one of the subtypes above.
</description> </description>
@ -15,14 +15,14 @@
<method name="_enter" qualifiers="virtual"> <method name="_enter" qualifiers="virtual">
<return type="void" /> <return type="void" />
<description> <description>
Called when task is "entered", i.e. when task is executed while not having a [constant RUNNING] [member status]. Called when task is "entered", i.e. when task is executed while not having a [constant BT.RUNNING] [member status].
It is called before [method _tick] in the execution order. This method is used when preparation is needed before main work begins, usually when it takes more than one tick to finish the task. It is called before [method _tick] in the execution order. This method is used when preparation is needed before main work begins, usually when it takes more than one tick to finish the task.
</description> </description>
</method> </method>
<method name="_exit" qualifiers="virtual"> <method name="_exit" qualifiers="virtual">
<return type="void" /> <return type="void" />
<description> <description>
Called when task is "exited", i.e. after [method _tick] returns [constant SUCCESS] or [constant FAILURE] status. Called when task is "exited", i.e. after [method _tick] returns [constant BT.SUCCESS] or [constant BT.FAILURE] status.
</description> </description>
</method> </method>
<method name="_generate_name" qualifiers="virtual const"> <method name="_generate_name" qualifiers="virtual const">
@ -44,11 +44,11 @@
</description> </description>
</method> </method>
<method name="_tick" qualifiers="virtual"> <method name="_tick" qualifiers="virtual">
<return type="int" /> <return type="int" enum="BT.Status" />
<param index="0" name="p_delta" type="float" /> <param index="0" name="p_delta" type="float" />
<description> <description>
Called when task is "ticked", i.e. executed by [BTPlayer] or [BTState] during update. Called when task is "ticked", i.e. executed by [BTPlayer] or [BTState] during update.
Returns [enum TaskStatus]. Returns [enum BT.Status].
*Note:* Tasks perform their main function by implementing this method. *Note:* Tasks perform their main function by implementing this method.
</description> </description>
</method> </method>
@ -74,10 +74,10 @@
</description> </description>
</method> </method>
<method name="execute"> <method name="execute">
<return type="int" /> <return type="int" enum="BT.Status" />
<param index="0" name="p_delta" type="float" /> <param index="0" name="p_delta" type="float" />
<description> <description>
Performs task's execution. During execution [method _enter] is called first, unless current task [member status] is [code]RUNNING[/code]. [method _tick] is called next to perform task's main function. If [constant SUCCESS] or [constant FAILURE] status is returned by [method _tick], [method _exit] will be called next. Performs task's execution. During execution [method _enter] is called first, unless current task [member status] is [code]RUNNING[/code]. [method _tick] is called next to perform task's main function. If [constant BT.SUCCESS] or [constant BT.FAILURE] status is returned by [method _tick], [method _exit] will be called next.
</description> </description>
</method> </method>
<method name="get_child" qualifiers="const"> <method name="get_child" qualifiers="const">
@ -198,22 +198,8 @@
Elapsed time since the task was entered. Elapsed time since the task was entered.
Returns 0 when task is not [code]RUNNING[/code]. Returns 0 when task is not [code]RUNNING[/code].
</member> </member>
<member name="status" type="int" setter="" getter="get_status"> <member name="status" type="int" setter="" getter="get_status" enum="BT.Status">
Last execution [enum TaskStatus] returned by [method _tick]. Last execution [enum BT.Status] returned by [method _tick].
</member> </member>
</members> </members>
<constants>
<constant name="FRESH" value="0" enum="TaskStatus">
Task wasn't executed yet or execution was cancelled.
</constant>
<constant name="RUNNING" value="1" enum="TaskStatus">
Task is being performed and hasn't finished yet.
</constant>
<constant name="FAILURE" value="2" enum="TaskStatus">
Task has finished with failure.
</constant>
<constant name="SUCCESS" value="3" enum="TaskStatus">
Task has finished with success.
</constant>
</constants>
</class> </class>