User Tools

Site Tools


dragengine:modules:dragonscript:behaviortrees

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dragengine:modules:dragonscript:behaviortrees [2025/05/21 15:22] – [Running] dragonlorddragengine:modules:dragonscript:behaviortrees [2025/06/12 17:01] (current) – [File Format (*.debt)] dragonlord
Line 68: Line 68:
 The main use for this rule is to force waiting until a rule conditions fails. The main use for this rule is to force waiting until a rule conditions fails.
  
-Since this rules returns ''BTResult.running'' it must have an ''id'' to make it persistable.+Since this rules returns ''BTResult.running'' it must have an ''id'' to make it persistable. A typical example is this: 
 +<code xml> 
 +<running id='.running'/> 
 +</code> 
 ===== Yield ===== ===== Yield =====
  
Line 77: Line 81:
 This rule can also be used to add single frame delays in a behavior tree, for example to ensure actors are not running actions too fast. This rule can also be used to add single frame delays in a behavior tree, for example to ensure actors are not running actions too fast.
  
 +Since this rules can return ''BTResult.running'' it must have an ''id'' to make it persistable. A typical example is this:
 +<code xml>
 +<yield id='.yield'/>
 +</code>
  
 ====== File Format (*.debt) ====== ====== File Format (*.debt) ======
  
-The behavior tree file format is recognized by the LoadBehaviorTree script class. The file is an XML file with a simple structure to define a behavior tree using XML.+The behavior tree file format is recognized by the LoadBehaviorTree script class. The file is an XML file with a simple structure to define a behavior tree using XML. See [[https://lordofdragons.github.io/dragengine/artifacts/xmlschema/dragengine/latest/behaviorTree.xsd|XML Schema]] for use with editors like VSCode.
  
 <uml> <uml>
Line 160: Line 168:
 } }
 behaviorTree --> yield behaviorTree --> yield
 +
 +object "subtree" as subtree {
 +  <#transparent,#transparent>|parameter|  <color:gray>string|
 +  |condition|  <color:gray>string|
 +  |conditionMode|  <color:gray>enum|
 +}
 +behaviorTree --> subtree
  
 @enduml @enduml
Line 184: Line 199:
 ^Attribute^Description^Occurance^Default^ ^Attribute^Description^Occurance^Default^
 |name|Name of action to run.|Required|-| |name|Name of action to run.|Required|-|
 +|id|Rule identifier. Required for actions potentially returning ''BTResult.running'' to support persistance. If identifier starts with ''.'' the parent rule identifier is prepended.|Optional|-|
 |doNotFail|If action fails return ''BTResult.success''. Useful to running optional actions without failing the parent rule.|Optional|''false''| |doNotFail|If action fails return ''BTResult.success''. Useful to running optional actions without failing the parent rule.|Optional|''false''|
  
Line 204: Line 220:
 ^Attribute^Description^Occurance^Default^ ^Attribute^Description^Occurance^Default^
 |loop|Loop sequence.|Optional|''false''| |loop|Loop sequence.|Optional|''false''|
 +|id|Rule identifier. Used to support persistance. If identifier starts with ''.'' the parent rule identifier is prepended.|Optional|-|
 |doNotFail|If sequence fails return ''BTResult.success''. Useful to optional sequences running as many rules in a sequence as possible without failing the parent rule.|Optional|''false''| |doNotFail|If sequence fails return ''BTResult.success''. Useful to optional sequences running as many rules in a sequence as possible without failing the parent rule.|Optional|''false''|
  
Line 232: Line 249:
 ^Attribute^Description^Occurance^Default^ ^Attribute^Description^Occurance^Default^
 |loop|Loop choice.|Optional|''false''| |loop|Loop choice.|Optional|''false''|
 +|id|Rule identifier. Used to support persistance. If identifier starts with ''.'' the parent rule identifier is prepended.|Optional|-|
 |doNotFail|If choice fails return ''BTResult.success''. Useful for optional choices there failing the choice should not fail the parent rule.|Optional|''false''| |doNotFail|If choice fails return ''BTResult.success''. Useful for optional choices there failing the choice should not fail the parent rule.|Optional|''false''|
  
Line 289: Line 307:
  
 Adds a running rule. Adds a running rule.
 +
 +^Attribute^Description^Occurance^Default^
 +|id|Rule identifier. Required to support persistance. If identifier starts with ''.'' the parent rule identifier is prepended.|Optional|-|
  
 ^Tag^Description^Occurance^Default^ ^Tag^Description^Occurance^Default^
Line 305: Line 326:
  
 Adds a yield rule. Adds a yield rule.
 +
 +^Attribute^Description^Occurance^Default^
 +|id|Rule identifier. Required to support persistance. If identifier starts with ''.'' the parent rule identifier is prepended.|Optional|-|
  
 ^Tag^Description^Occurance^Default^ ^Tag^Description^Occurance^Default^
dragengine/modules/dragonscript/behaviortrees.1747840939.txt.gz · Last modified: 2025/05/21 15:22 by dragonlord