Back

Explore Courses Blog Tutorials Interview Questions
0 votes
10 views
in AI and Deep Learning by (50.2k points)

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:

enter image description here

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 running.

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 passes 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?

1 Answer

0 votes
by (108k points)

While you are in the "Drive To Enemy" behavior, you include some sort of way to run some additional checks to make sure that behavior should still be continued.

You can use the parallel composite: a type of behavior tree node that runs all its children simultaneously.

It would look like this:

  • MainSelector:
    • Evade Enemy
    • Locate Enemy
    • Drive-in opposite direction
  • Parallel
    • Is Enemy Nearby?
    • Chase Enemy
    • Find the path to the enemy
    • Drive to enemy
    • Fire Weapon
    • Chase Flag
    • Locate flag
    • Find Path
    • Drive to flag
If you are looking to learn more about Artificial Intelligence then you visit Artificial Intelligence Tutorial and Artificial Intelligence Course. Also, if you are appearing for job profiles of AI Engineer or AI Expert then you can prepare for the interviews on Artificial Intelligence Interview Questions.

Browse Categories

...