PinWright
← All text formats

Behavior trees

BTIR
Read as text

A Behavior Tree is a set of composites, tasks, decorators and services under a root node. You normally read it by tracing boxes and wires down the Behavior Tree editor canvas. BTIR writes the same tree out as indented text: every node named and typed, its decorators and services nested under it, the blackboard keys listed, and canvas @(x, y) positions kept. BTIR is for reading. Your assistant uses it to understand a tree, and you use it to review one.

What it gives you

Diffable in version control
A change to AI logic becomes a few changed lines in a pull request. The same text is saved in asset dumps as btir.txt, so Behavior Tree history is searchable in git.
Reviewable like code
Structure is explicit: each node's role and kind (root composite, child task), decorators and services nested as a block, and custom branch logic written as a decorator_logic [Not:1, Test:0] line. You see what runs and in what order without following wires.
Readable for your assistant
One text covers the whole tree, including root-level decorators and services, disconnected nodes and the blackboard. Your assistant loads the tree's real behavior in one step.
Faithful and consistent
BTIR reads the editor graph itself, so positions, per-node comments, disconnected nodes, decorators, services and decorator logic all show up. Nodes that can't be reached from the root appear as orphan with a warning, so nothing is silently dropped.

What the text looks like

The block names the blackboard, then nests the tree from its root. Each line reads role, kind, type and name, then the canvas position. Decorators and services sit inside their parent's { } block:

btir
behavior_tree /Game/AI/BT_Patrol.BT_Patrol {
  blackboard /Game/AI/BB_Patrol.BB_Patrol
  root composite Selector Root @(0, 0) () {
    child composite Sequence Chase @(-160, 180) () {
      decorator Blackboard IsTargetSet @(-160, 120) ()
      decorator_logic [Not:1, Test:0]
      child task MoveTo MoveToTarget @(-160, 320) (comment: "Move to current target")
    }
    child task Wait Patrol @(160, 180) ()
  }
}

How to ask for it

Ask a question about the tree, or ask for a change. Your assistant reads the tree as text to answer or to plan the edit, then makes the edit in the editor. BTIR itself doesn't write the asset. More examples are on the Behavior trees page.

exampleBehavior trees
You: What decides whether BT_Patrol chases instead of patrolling?

The root Selector tries Chase first. Chase runs only when the IsTargetSet
blackboard decorator passes. Otherwise the tree falls through to the Wait patrol.

Read-only

BTIR reads Behavior Tree and standalone Blackboard assets as text for review and for your assistant's context. Writing BTIR back into an asset is planned. Today your assistant makes Behavior Tree changes with its regular editing tools. Because BTIR never writes back, it keeps per-node comments as they are. Blueprint, material, Animation Blueprint and PCG text drop comment boxes instead. The per-format table has the full comparison.