Example tree (Source): Example behaviour tree

As far as I understood, a sequencer iterates over the children until one failed or all are successful. If one children returns "running", the sequencer will start to process from that child on the next tick.

Let's say "Do I have food?" takes longer than one tick because the AI has to walk to the fridge. When "Am I Hungry" was successful, it won't be processed anymore. Now while walking to the fridge, the hunger magically disappears. How do I prevent the tree from processing the other nodes even though I am not hungry anymore? Should every following node check the condition again? That doesn't seem to fit the idea of a behaviour tree.

How do I implement a condition that has to stay true while following nodes are processed?


Found an answer here.

I thought a behaviour tree should start at the last running node to start computation time but that lead to the problem stated in the article.

Treating Running States





Your Answer

