BeeT is an intuitive tool to create, run and debug behavior trees.
Use the Visual Editor to create and edit behavior trees to be used by the library.
Use the Visual Debugger to keep track of the evolution of the tree. Enable the network to debug your game while you play in a different machine!
Using the second generation of BTs with the event-driven approach we avoid traverse the whole tree each frame, instead the tree is passively waiting for events.
Conditionals are decorators: making the tree more readable, leaving the leafs as task nodes, and gaining full advantage of the event-driven letting the decorators act as observers at critical nodes in the tree.
Parallel nodes are replaced for simple parallel nodes that only allow two children: one leaf task and another different subtree. The parallel functionality remains the same but we take advantage of the event-driven trees to guarantee a high standard performance.
Taking advantage of the event-driven trees makes BeeT the perfect candidate for any type of development: from amateur projects to high performance requeriments projects.
BeeT includes a visual editor to create, edit and debug behavior trees visually. Therefore, making the iteration process much faster and pleasant.
Test your game in any device and debug it remotely over the network. No need to debug your game in the same PC!
The library is written in C to allow an easy integration in any C/C++ project.
Integrate BeeT library quickly and easily and start taking advantage of its features right away!
All code is open source to allow developers to modify and extend the library freely.
This is a quick guide of how to integrate BeeT into your project in a few minutes. It will aslo teach how to create a behavior tree with the editor.
First of all, download the latest release of BeeT.
If you want to skip the behavior tree creation go here.
1- Open BeeT Editor.
2- Create a tree
3- Save it
1- Include the beet.h
header and link BeeTLib
library to your project.
2- Initialize the library with BEET_Init()
and before closing the application remember to call BEET_Shutdown()
3- (Optional) If you want to enable the debugger, call BEET_InitDebugger
after the initialization. The call is the following:
BEET_bool BEET_InitDebugger(const char* ip, int port);
You will need to pass the ip and the port of the computer where your application will connect to debug, not the computer that your application will run (or yes if you are using the same). The ip will be a const char like: “127.0.0.1”.
4- Call BEET_Tick(deltaTime)
in your main loop and send the deltaTime (time since last frame) as a parameter.
5- Set up the task callback function, the function that will be called once the tree reaches a leaf node (always will be a task node), with BEET_SetTaskCallbackFunc(TaskCallbackFunc);
. The callback function must have this structure:
NodeStatus TaskCallbackFunc(unsigned int btId, const char* taskId, NodeFunction func, const BBVar* extraData);
NodeStatus: the status of the task after being executed. It can either be: NS_SUCCESS
, NS_FAILURE
or NS_RUNNING
.
btId: the id of the tree that is running that task
NodeFunction: the function that is called for that task. It can be: NF_ONINIT
, NF_UPDATE
or NF_ONFINISH
.
BBVar: pointer to a variable of the blackboard passed as extra data for that task. If no extra data has been passed this will be NULL.
6- To load a behavior tree you can either:
Load it from memory with BEET_LoadBehaviorTree(const char* buffer, int size, BEET_bool debug);
Load it from a file with BEET_LoadBehaviorTreeFromFile(const char* filename, BEET_bool debug);
The debug
boolean will specify if this behavior tree is considered for debugging. Note: the debugger needs to be initialized beforehand in order to work.
7- Save the behavior tree id returned by the previous function to keep track of the tree. With that id you can change the blackboard variables later on with calls like:
BEET_bool BEET_BBGetBool(unsigned int btId, const char* varName);
BEET_bool BEET_BBSetBool(unsigned int btId, const char* varName, BEET_bool value);