User Tools

Site Tools


behavior-trees

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
behavior-trees [2020/07/17 15:11] maximebehavior-trees [2021/07/29 11:56] (current) maxime
Line 45: Line 45:
 ==== Functions ==== ==== Functions ====
  
-A leaf node has three basic functions: ''Init'', ''Update'', and ''Finish''. The ''Update'' function takes the level (''[[api:level|LEVEL]]'') and the tree instance (''[[api:behavior_tree_instance|BEHAVIOR_TREE_INSTANCE]]''as parameter, and returns a ''[[api:behavior_tree_node_result|BEHAVIOR_TREE_NODE_RESULT]]''.+A leaf node has three basic functions: ''Init'', ''Update'', and ''Finish''. The implementation of ''Init'' and ''Finish'' are optional. 
 + 
 +=== Init === 
 + 
 +''void **Init**(//instance//)'' 
 + 
 +^ Name ^ Type ^ 
 +| //''instance''// | ''BEHAVIOR_TREE_INSTANCE''
 + 
 +=== Update === 
 + 
 +''BEHAVIOR_TREE_NODE_RESULT **Update**(//level//, //instance//)'' 
 + 
 +^ Name ^ Type ^ 
 +| //''level''// ''LEVEL'' 
 +| //''instance''// ''BEHAVIOR_TREE_INSTANCE'' 
 + 
 +=== Finish === 
 + 
 +''void **Finish**(//instance//)'' 
 + 
 +^ Name ^ Type ^ 
 +//''instance''// | ''BEHAVIOR_TREE_INSTANCE'' |
  
 When a node is executed, the ''Init'' function is called first. Then, the ''Update'' function is called until it doesn't return ''[[api:behavior_tree_node_result|BEHAVIOR_TREE_NODE_RESULT.PROCESSING]]''. Finally, the ''Finish'' function is called. When a node is executed, the ''Init'' function is called first. Then, the ''Update'' function is called until it doesn't return ''[[api:behavior_tree_node_result|BEHAVIOR_TREE_NODE_RESULT.PROCESSING]]''. Finally, the ''Finish'' function is called.
  
 You can access all of the node's variables in those functions with ''self''. You can access all of the node's variables in those functions with ''self''.
behavior-trees.1595013101.txt.gz · Last modified: 2020/07/17 15:11 by maxime

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki