Getting started
In this tutorial you'll build a "patrol if safe" behavior tree from scratch. By the end you'll know how to drag nodes, connect them, edit ports, and export to JSON.
Time: ~5 minutes. Prerequisites: a modern browser. No account, no install.
1. Open the editor
Head to bteditor.dev. You should see a node palette on the left, an empty canvas in the middle, and a toolbar above the canvas. If the language doesn't auto-detect to English, pick it from the ๐ dropdown in the top right.
2. Drag a Sequence onto the canvas
In the left palette, expand Composite Nodes. You'll see Sequence, Selector, Parallel, RandomSelector, and RandomSequence. Drag Sequence onto the canvas.
Sequence runs its children left-to-right and only returns
SUCCESS if all children succeed. It's the right starting
point when you have a sequence of mandatory steps.
3. Add the safety check
Expand Condition Nodes and drag IsEnable onto the canvas. Place it to the left of the Sequence. The editor auto-layouts in horizontal mode by default; you can switch to vertical with the โ button in the toolbar.
Conditions are leaves โ they have no children. They return
SUCCESS or FAILURE based on external state.
In a real robot, IsEnable would be wired to a "system
healthy" flag from your telemetry bus.
4. Connect IsEnable โ Sequence
Hover over IsEnable until the blue output port appears on
its right edge. Click and drag from that port to the input port on the
left edge of Sequence. A light gray line should appear.
Release.
That's a parent โ child relationship. When you tick the tree,
Sequence will call IsEnable first.
5. Add the patrol action
Expand Action Nodes, drag Wait onto the canvas, and place it as a child of Sequence. Connect Sequence's output to Wait's input.
The Wait node has a duration port. Click the node body to
expand it; you'll see a text field next to "duration". Type
2.0 and press Enter. This makes the patrol tick wait 2
seconds between checks.
6. Export the tree
Click the Export button in the header. The default format is JSON; you can also pick XML or BehaviorTree.CPP XML from the radio buttons.
For a tiny tree like ours, the JSON will look like:
{
"root": {
"name": "Sequence",
"type": 0,
"children": [
{ "name": "IsEnable", "type": 3 },
{ "name": "Wait", "type": 1, "ports": { "duration": 2.0 } }
]
}
}
You can copy the JSON to clipboard or download it as
behavior_tree.json. Either format can be re-imported
later with the Import Tree button.
7. Re-import to verify round-trip
Hit Clear to wipe the canvas. Then Import Tree, paste the JSON, and confirm. Your tree should come back exactly as you left it.
Drag the canvas with the right mouse button (or hold Space and drag with the left button) to pan. Mouse wheel to zoom. The ๐ฏ button in the toolbar centers the view on your tree.
What next?
- Node types reference โ what each node does and when to use it.
- Replay NDJSON logs โ capture a real run and step through it.
- Define custom node types โ extend the library with your own.
- Reactive control patterns โ when to reach for behavior trees vs. state machines.