Skip to content
Bit Quirky Behavior Trees and
State Machines

Search documentation

All topics and APIs

Close returns focus to Search.

What are you looking for?

Try a common topic or enter a complete API identifier.

Browse the reference instead

Esc closes · Tab reaches results · Enter opens the focused link

v0.6.0
Menu

Flip it

Inverter turns one branch's Success into Failure and back, so you can express "only when this is not true" without a second condition.

The smallest node in the set. Inverter wraps one child and swaps its Success and Failure, so a branch can run because something did not work.

A Platformer patrol should only walk the route while the route is open. You already have a check that answers “is the route blocked”, and you want the opposite answer. Authoring a second, mirrored check means two facts that can disagree, and the day they disagree you have a bug in two places.

DocumentationDecorators.bqbehavior keeps that shape as the Inverter called not blocked over a Condition named route is blocked.

  • Reuse one authored check in both directions, so “door is open” and “door is not open” stay the same fact.
  • Turn a member call’s failure into the thing you were waiting for: an interaction that reports Failure while an object is busy becomes Success once it stops being busy.
  • Turn a succeeding probe into a branch guard, where success means “somebody already did this” and you want the branch that handles the other case.
The route probe under the not blocked inverter holds the tick, then stops holding it: the inverter hands its branch's turn on and the next branch picks up the running pill.
The route probe under the not blocked inverter holds the tick, then stops holding it: the inverter hands its branch's turn on and the next branch picks up the running pill.

A decorator has no card of its own: it renders as a chip on top of its child’s card, and that one card carries the status pill. On a GameObject agent that pill marks the node holding the tick, so what you watch is the cursor leaving the probe and the branch above it moving on with the flipped answer. The Graph runtime status card in the rail is where the result itself is written out, and an entity graph paints a result on every card it evaluated.

  1. Open Assets/Platformer/Behavior/DocumentationDecorators.bqbehavior and select the Inverter called not blocked.

  2. Read the rail. There are no value fields: the semantic line plus a Child reading, because the only thing to author is which single child it wraps.

  3. Select the child, route is blocked. It reads the route_blocked blackboard variable.

  4. Set route_blocked to true in the Live blackboard while an agent runs this graph. The child succeeds, the Inverter reports Failure, and the Sequence above stops on that result.

  5. For a blackboard fact, read the result rule below before you rely on the false case. Comparing the variable directly, with the Condition’s own comparison set to == and the value false, reports Success when the route is open.

Inverter decorating a blackboard condition
Figure 1. The pill is the decorator. It carries no settings, which is the whole appeal.

Inverter swaps exactly two results and passes everything else through. It holds no state and ticks its child once per parent visit.

Result

Success
The child returned Failure.
Failure
The child returned Success.
Running
The child is still Running. Inverter has nothing to swap yet.
Child result Inverter result
Success Failure
Failure Success
Running Running
Blocked Blocked
Interrupted Interrupted
Timeout Timeout
Authority mismatch Authority mismatch

That fourth row is the one that surprises people. A blackboard Condition whose comparison is false reports Blocked, and Blocked passes through an Inverter unchanged, so wrapping a blackboard Condition inverts the true case alone. The product’s own test pins that pass-through.

Two ways to negate a blackboard fact:

  • Invert the comparison inside the Condition: choose == and the value false, which reports Success when the variable is false.
  • Use a Member condition and set its false mapping to Failed. Failure is the result an Inverter flips.

When it goes wrong

SymptomCheckFix
The branch never runs when the fact is false.Look at whether the child is a blackboard Condition, which reports Blocked instead of Failure.Invert the comparison inside the Condition, or bind a Member condition whose false mapping is Failed.
Everything under the Inverter behaves backwards.Read how much subtree the decorator wraps.Wrap the single check, and keep the work outside the Inverter.
A Timeout or Interrupted result was expected to flip.Those results pass through by design.Handle them in the branch above, where the typed reason is still readable.
Validation says a decorator needs exactly one child.Count the children on the canvas.Leave one child attached. Group several checks in a Sequence and wrap that.
Full-size image