Behaivour Tree
Features
- C++20's concepts.
- CMake basic structure.
- constexpr all things.
- Templatized structures/functions.
- Memory pool / memory arena.
- Tiny Behaivour tree example:
Steps:
1 . BTBoolean = false, so return FAIL.
2 . Sequence fails, so return FAIL.
3 . Selector its gonna look next branch.
4 . Sequence returns SUCCESS.
5 . BTBoolean = true, return SUCCESS.
6 . Return SUCCESS.
SELECTOR
/ \
SEQUENCE SEQUENCE
/ \ / \
BOOLEAN SAY_NAME MOVE MOVE
File / Class Structure
-
include
- BehaivourTree.hpp : Behaivour tree class.
- BTNode.hpp : BTNode created (Selector and Sequence templatized)
- BTNodeSelector.hpp : Specialization selector.
- BTNodeSequence.hpp : Specialization sequence.
- Node.hpp : Node class to derive and use on our Behaivour tree.
-
src: Main and helper functions.
-
CMakeLists: Generation / Compilation file.
Installation and compilation
- Clone this repositoy
git clone https://github.com/parequena/BehaviourTree
- Get into our folder
cd BehaviourTree
- Create build folder
mkdir build && cd build
- Generate the project
cmake .. # Add as much variables as you want
- Compile and execute
make && ./BehaviourTree