BeeT
Behavior Tree Library

Overview


BeeT is an intuitive tool to create, run and debug behavior trees.


Visual Editor

Use the Visual Editor to create and edit behavior trees to be used by the library.

Visual Debugger

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!

Features


Event-driven

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.

Decorators

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.

Simple parallel

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.

Low performance impact

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.

Visual editor and debugger

BeeT includes a visual editor to create, edit and debug behavior trees visually. Therefore, making the iteration process much faster and pleasant.

Debug over the network

Test your game in any device and debug it remotely over the network. No need to debug your game in the same PC!

Written in C

The library is written in C to allow an easy integration in any C/C++ project.

Easy Integration

Integrate BeeT library quickly and easily and start taking advantage of its features right away!

Open Source

All code is open source to allow developers to modify and extend the library freely.

Getting Started


WORK IN PROGRESS

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.

Create a simple tree

1- Open BeeT Editor.

2- Create a tree

3- Save it

Integrate BeeT library

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);