Skip to main content

Crate arora_behavior

Crate arora_behavior 

Source
Expand description

Behavior interpreters: the executors the Arora runtime ticks each step.

Two things share the word “behavior”, and this crate is about only one of them:

  • A behavior (the noun) is an authored, editable representation of what a device should do — a behavior tree, a node graph — produced in a visual editor (Studio, the Vizij Workspace) and shipped as data.
  • A BehaviorInterpreter is the runtime-level executor that runs one of those: a behavior-tree interpreter, a node-graph interpreter. It is the thing the runtime actually ticks.

The runtime holds one Box<dyn BehaviorInterpreter> and ticks it — swapping the interpreter replaces the behavior. The behavior tree is one interpreter (arora-behavior-tree’s [BehaviorTreeInterpreter]); a Vizij node graph is another. Adding a new kind of authored behavior means adding a new interpreter here. Hand-implementing the trait to hard-code a single behavior in Rust is possible, but it is a corner case — the promoted path is to author a behavior in an editor and let an interpreter run it.

An authored behavior is a graph::Graph — nodes bound to functions, with typed I/Os and links — and interpreters are edited by applying a graph::GraphDiff. Loading a behavior is applying a diff onto an empty graph. See graph for the model.

Each tick an interpreter gets a BehaviorContext: the shared DataStore (read inputs, write intent / outputs) and a CallBridge (so a module-calling interpreter like the behavior tree can reach the engine). An interpreter uses whichever it needs — a graph reads/writes the store; the tree drives the caller.

Timing is not a tick argument. The runtime publishes the frame’s clock into the store under the golden keys before it ticks, so an interpreter that needs dt or elapsed time reads it from the store like any other slot.

Re-exports§

pub use graph::Graph;
pub use graph::GraphDiff;

Modules§

golden
Golden keys: well-known store slots the runtime maintains for every behavior.
graph
The shared behavior graph model: one serde-friendly data representation every BehaviorInterpreter reads.
interpreter_module
The behavior interpreter as a module: the well-known ids and call conventions under which the runtime exposes its one BehaviorInterpreter on the engine.

Structs§

BehaviorContext
What a BehaviorInterpreter receives each tick.
BehaviorError
An interpreter failed to tick.

Enums§

BehaviorStatus
Whether an interpreter wants to be ticked again.

Traits§

BehaviorInterpreter
A behavior executor: something the Arora runtime ticks once per step to run an authored behavior.