Hi,
I have a behavior tree using a classical design, here the class tree :
Behavior Tree
Behavior Tree Node
-> Task
-> Composite
-> Selector
-> Sequence
-> Parallel
-> Decorator
-> ForceSuccess
-> Loop
The problem is the Loop Decorator Node, if you loop one node in a composite it has to loop and go to the next node, that mean the composite node has to reset the counter only when all children are processed. What is the best design about that ? The behavior for the reset of the loop decorator is not the same in the parallel, selector and sequence surely. What is the good behavior for each and what is the good design to call the reset on the decorator node ? Also what should return about SUCCESS/RUNNING/FAILED ?
Thank you for the help
Loop Decorator Node design
If the "loop decorator" you are talking about resembles the Unreal Engine one (repeat the child node N times or forever, presumably stopping when it cannot be performed) it must not matter whether it's the child of a composite node, or which type of composite node: after all, the execution of the loop node should be indistinguishable from the execution of a sequence (or other composite) of the appropriate number of identical nodes. Thinking the parent composite should deal with the loop counter of its loop child is particularly wrong.
"Resetting" the loop node to execute it again is also a non-issue: the loop always runs until it stops (running out of iterations or having its child fail), so it can reset its loop counter etc. either at the beginning or at the end of execution, unconditionally.
Omae Wa Mou Shindeiru