From what I understand on Behavior Trees, each Behavior should be a short goal oriented Action that could be done in a few iterations.
So for example, below is an image of a Behavior Tree:
Now let us assume that the Drive To Enemy behavior takes more than a few iterations in the tree. So on each pass Drive To Enemy is called because it is now in the running state.
The problem is I want to call Evade Enemy if an Enemy is nearby. And considering that Drive To Enemy is always called I never get a chance to call Evade Enemy (Should probably be called Avoid Enemy).
- Should I traverse the Tree EACH pass no matter what Action is currently running?
- Am I going about this the right way?
- What is the proper way of handling such a behavior?
Originally asked on Stackoverflow. Thought here would be a more appropriate place to ask this question.