Guide library 12 guides

Learn behavior trees.
Build smarter agents.

A practical path from your first sequence node to production-ready game AI and robotics. Every example opens in our free online editor, so you can learn by changing real trees.

Start with the introduction

Foundations

Start with the mental model and the building blocks.

  1. 01 What Is a Behavior Tree? A Practical Introduction for Game AI Behavior trees explained from scratch: what they are, how ticks, sequences, selectors and decorators work, why games and robots use them, and an interactive editor to try one yourself.
  2. 02 Sequence, Selector, and Decorator Nodes Explained A complete reference to behavior tree node types — sequences, selectors, parallels, memory variants, decorators, conditions and actions — with worked examples you can open in a free online editor.
  3. 03 Behavior Tree Blackboards: How Nodes Share Data What a blackboard is, why every serious behavior tree framework has one, how key scoping works, and the patterns — and pitfalls — of using blackboards in Unreal, BehaviorTree.CPP, and behavior3.
  4. 04 Behavior Trees vs Finite State Machines: Which Should You Use? An honest comparison of behavior trees and finite state machines for game AI — scalability, reactivity, debugging, performance — with concrete guidance on when each one wins.

Tools & platforms

Choose an approach for the engine or runtime you use.

  1. 05 Behavior Trees in Unity: Options, Assets, and How to Choose Every way to get behavior trees into Unity in 2026 — Unity Behavior, Behavior Designer, NodeCanvas, open-source libraries, or rolling your own — with honest trade-offs and a design-first workflow.
  2. 06 Behavior Trees in Unreal Engine: How UE's Built-In System Works Unreal Engine ships behavior trees natively. Learn how UE's behavior trees, blackboards, tasks, decorators and services fit together, how UE's model differs from classic BTs, and how to design trees before you build them.
  3. 07 Behavior Trees in Robotics: BehaviorTree.CPP, ROS 2, and Nav2 Why robotics adopted behavior trees from games — and how BehaviorTree.CPP, ROS 2, and the Nav2 navigation stack use them today, with the key differences from game-style trees.
  4. 08 Behavior Trees in Python: py_trees, ROS 2, and Quick Prototypes How to build behavior trees in Python with py_trees — behaviours, composites, blackboards, and ASCII visualization — plus py_trees_ros for ROS 2 robots and when Python is (and isn't) the right runtime.

Practice & production

Build, debug, and scale trees that hold up in real projects.

  1. 09 Behavior Tree Examples: 5 Common Game AI Patterns Worked behavior tree examples you can open in a free online editor: patrol/chase/attack enemies, guard posts, fleeing at low health, retry loops, and cooldown-gated special attacks.
  2. 10 Debugging Behavior Trees: The 6 Classic Mistakes Why your sequence restarts every tick, why the tree won't switch branches, why the agent flip-flops between two behaviors — the recurring behavior tree bugs, their causes, and how to fix each one.
  3. 11 How to Write a Behavior Tree from Scratch (~100 Lines) Implement a working behavior tree runtime yourself: the status enum, sequence, selector, memory variants, and decorators in about 100 lines of TypeScript that port directly to C#, GDScript, or C++.
  4. 12 Structuring Large Behavior Trees: Subtrees, Reuse, and Scale How to keep behavior trees readable past 30 nodes — priority layering, extracting subtrees, parameterized leaves, naming conventions, and knowing when logic shouldn't live in the tree at all.