BehaviorTree.CPP
Behavior Trees Library in C++. Batteries included.
What is BehaviorTree.CPP?
Behavior Trees Library in C++. Batteries included.
Overview of BehaviorTree.CPP
What it is
BehaviorTree.CPP is a C++17 library that provides a framework for creating Behavior Trees. It is designed to be flexible, easy to use, reactive, and fast. The primary use case is robotics, but it can also be used to build AI for games or to replace Finite State Machines. The library makes asynchronous (non-blocking) Actions a first-class citizen and supports reactive behaviors that execute multiple Actions concurrently. Trees are defined using a Domain Specific scripting language based on XML and can be loaded at runtime. Custom TreeNodes can be statically linked or converted into plugins and loaded at runtime. The library includes a type-safe and flexible mechanism for Dataflow between nodes, as well as a logging/profiling infrastructure for visualizing, recording, replaying, and analyzing state transitions.
Key features
- Asynchronous Actions (non-blocking) are first-class citizens.
- Reactive behaviors that execute multiple Actions concurrently (orthogonality).
- Trees defined using a Domain Specific scripting language (XML) and loaded at runtime.
- Custom TreeNodes can be statically linked or loaded as plugins at runtime.
- Type-safe and flexible Dataflow mechanism between nodes.
- Logging/profiling infrastructure for visualization, recording, replay, and analysis of state transitions.
Use cases
- Robotics (main use case).
- AI for games.
- Replacing Finite State Machines.
Getting started
BehaviorTree.CPP requires a compiler that supports C++17. Three build systems are supported: colcon (ROS2), conan, and straight cmake. Compiling with conan (requires CMake 3.23 or newer): conan install . -s build_type=Release --build=missing cmake --preset conan-release cmake --build --preset conan-release Compiling with straight cmake (if dependencies like ZeroMQ and SQLite are already installed): mkdir build_release cmake -S . -B build_release cmake --build build_release --parallel Alternatively, you can install using vcpkg: git clone https://github.com/Microsoft/vcpkg.git cd vcpkg ./bootstrap-vcpkg.sh ./vcpkg integrate install ./vcpkg install behaviortree-cpp For more details, see the repository README.
License and pricing
BehaviorTree.CPP is licensed under the MIT License. It is open source and free to use.
Based on the project's public README and repository metadata.