Behavior trees - Team player exampleDec 15, 02:35 PM

NOTE: These tutorials were created for Behave 0.3, and Behave has changed considerably since then. You can use them as guidelines for concepts, but do not expect the code will work straight out with the latest libraries.

Continuing with our series of examples of behavior tree implementations using AngryAnt’s Behave component for Unity, this demo shows branching behavior with selectors.

In this case we have implemented the concept of teams, the team number displayed above each cube. A cube will pursue the ball only if it doesn’t consider it to be owned by another cube of the same team. Cubes who own the ball butfind themselves overwhelmed will attempt to pass it to another cube of their team. If a cube doesn’t own the ball, but knows that one of his team has it, he will attempt to intercept nearby enemies so that they don’t attack his teammate.

The kicker’s color indicate its current status in the behavior tree:

  • Red: going for the ball
  • Magenta: someone else is has the ball and we’ve located a nearby enemy, intercepting
  • Yellow: can’t see a ball, but detected moving players – following
  • Blue: can’t see a ball or players, waiting

The tutorial will be coming soon, but you can inspect the behavior tree meanwhile.

<div align="center"> This content requires the Unity Web Player<br /> <br /> <a href="http://www.unity3d.com/unity-web-player-2.x">Install the Unity Web Player today!</a> </div>

by Ricardo J. Mendez

Commenting is closed for this article.