Behavior Bricks (BB) is a state-of-the-art engine for Behavior Trees (BTs) along with an intuitive visual editor. Behavior Bricks has been designed with three main goals in mind: efficiency, extensibility, and reusability. As a result, Behavior Bricks includes some *unique features* not to be found in other tools for Behavior Trees available in the Asset Store.
State-of-the-art, unique features, and free, how is that even possible? Behavior Bricks is the showcase of the work from a research group from the Complutense University of Madrid in Spain. We work on new methods for creating artificial intelligence (AI) for non-player characters (NPCs) in games. Check our web page to find research papers related to machine learning and behavior trees, and take a glimpse of what the future may bring to Behavior Bricks: http://gaia.fdi.ucm.es/research/bb/.
For complete documentation, examples and information visit: http://bb.padaonegames.com
Unity forum thread: Link
=== Parameterized trees ===
Behavior trees are widely used to create autonomous behaviors in games and simulations. In other tools BTs abstractions are commonly limited to the reuse of subtrees in other trees, the equivalent of defining a nonparametric function. While useful it is still a very limited abstraction.
In Behavior Bricks we bring more powerful abstractions from general programming languages to BTs. Through local variables and parameterized subtrees we make the creation of reusable behavior trees both easier and less error prone. It is then possible to apply different versions of the same behavior to different NPCs without duplicating code.
The parameters for a BT can be set for a single game object in the Unity inspector, or through code by instantiating a prefab and thus unleashing the full power of parameterized behavior trees.
=== Performance by default ===
- Performance: Actions and conditions can be suspended thus avoiding CPU unfriendly busy waiting. Have your actions and conditions register as observers for a given event and have them being resumed when it takes place. Composite nodes are suspended by default.
- Control your AI CPU budget: Specify the maximum number of subtasks or nodes that an NPC may run per tick. The engine manages a queue of nodes that guarantees the correct execution across ticks.
- Low memory footprint: The same behavior tree, possibly with different parameter configurations, is shared among every game object that use it, thus avoiding unnecessary code duplication. Using the memento design pattern, the behavior executor of each NPC replicates just those nodes currently being executed. The impact of this feature grows as the size of the BT, and or the number of entities sharing the same BT grows.
=== Additional features ===
- Program new actions and conditions: Actions, and conditions can be programmed in C# extending some pre-defined classes available in the framework. Such classes use common C# and Unity types and do not require any fancy wrapper. Using C# attributes, actions and conditions are annotated with information about parameters, and become automatically integrated into the Behavior Bricks visual editor.
- Behavior trees are also assets: Behavior trees are stored as assets (Scriptable Objects), smoothly integrated with Unity and thus supporting some of our unique features. Being a separate asset you can easily move BTs between projects. Furthermore, since BB differentiates the logical name of a behavior from the name of the asset used to store it, we can easily avoid name clashes when mixing behaviors from different sources.
- Debug mode: In debug mode it is possible to visualize the execution flow of a behavior tree, set a breakpoint in a node of the tree, watch its variables, pause its execution, and tick the BT on a given entity.