Skip to content

forcepusher/com.bananaparty.behaviortree

Repository files navigation

com.bananaparty.behaviortree

Unity package. Fully cross-platform Behavior Tree.
Does not reference Unity Engine, so it could be used in a regular C# project.

Make sure you have standalone Git installed first. Reboot after installation.
In Unity, open "Window" -> "Package Manager".
Click the "+" sign on top left corner -> "Add package from git URL..."
Paste this: https://github.com/forcepusher/com.bananaparty.behaviortree.git#5.2.0
See minimum required Unity version in the package.json file.

Key differences from BehaviorTree in UnrealEngine, BehaviorDesigner, and NodeCanvas:

  1. Strict OOP architecture and minimalism.
    • Trees are built by using nested constructors. Beware, it's all code.
  2. There are only 2 node callbacks, OnExecute and OnReset.
    • Determining whether a node just started executing in OnExecute or being interrupted in OnReset is accomplished by comparing the current BehaviorNode.Status.
  3. Reactive Evaluation/Conditional Aborts/Observer Aborts are implemented similarly to how it's done in NodeCanvas rather than in BehaviorDeisgner or UnrealEngine.
    • It's as simple as all nodes being reevaluated every frame in ReactiveSequenceNode and ReactiveSelectorNode.
  4. No separation between Actions and Conditions.
    • In case of multiple Actions in a self-interrupting Sequence (ReactiveSequenceNode), you would need to group them togehter into an additional Sequence, so Actions aren't starting from the beginning every frame.
  5. No such concept as a Blackboard.
    • Inject the classes (or their interfaces) you need to mutate via constructor. However, you can still write a DTO and use it as a Blackboard.
  6. Text-based visualization.
    • Execution status of an entire tree could be viewed in a build.
  7. Designed with Prediction-Rollback network code in mind.
    • You can write RollbackNodes utilizing the Memento pattern.

The library assumes that you're familiar with OOP and BehaviorTrees.
There are no Samples yet, refer to the Tests folder instead.