Hey devs,
I've been learning a lot about behavior trees, but one thing is a bit confusing to me.
On one hand, the behavior tree starts from the root every tick, and re-checks all the conditions, so it can adjust to changes.
On the other hand, a sequence can be used to group perform several actions one after the other.
Now, if the sequence finished performing the first action, it will start the second action, but in the next tick, won't it try to evaluate the first action once again?
For example, assume a root node sequence, that has 3 children: Walk to door, open door, walk to bed.
So at first it will perform walk to door, and continue performing it (because the walk to door node will return "running" state) until the ai reaches the door.
Then the walk to door node will return success, because the character is already at the door, and the open door node will execute until the door is open.
Next, both the walk to door and open door nodes return success, it will move on to the walk to bed node. After a tick of walking to bed, the ai is no longer near the door, so next time the "walk to door" node is ticked, instead of returning success, it will walk the AI back towards the door and return "running", until it is back at the door.
So the way I understand, it will be stuck walking one step from the door to the bed and back, over and over.
What am I not getting here?