PoBDSDocs
简体中文v1.0.0
POBDS / 12

Nodes, types and lifecycle reference

Look up connection rules, basic operations, completion semantics and serialized configuration formats.

Pins and value types

TypeUseRule
ExecutionEntry, Actions, BDS and child graphsConnect execution pins only.
BoolGates and logicNot interchangeable with integer scores.
Int / FloatArithmetic, comparisons and variablesRespect concrete types; no arbitrary conversions.
Vector2 / Vector3Position and directionOptional component outputs retain scalar types.
ColorColor valuesCan split RGBA.
ActorSelf, target and reference variablesReference equality / existence and typed member access.
Score / ContextAbility → EvaluationNot an unrestricted ordinary numeric value.

Basic data operations

  • Arithmetic: add, subtract, multiply, divide, min and max. Define integer truncation and zero-divisor behavior.
  • Vectors: addition, subtraction, normalization and components. Separate float presentation from integer authority.
  • Comparisons: compatible operand types first, then a supported operator. Do not order Actor references numerically.
  • Random Integer: inline or wired Min / Max, inclusive output. For permille, roll 1–1000 and compare to a threshold.
  • Reusable input fields: literals remain editable until connected; disconnecting restores local editing.

Enter / Update / Exit

Action lifecycle and multi-Action completion. · Click to view full image

Enter initializes each Action. Later frames update unfinished continuous Actions. Exit cleans up when leaving the node. When all Actions finish, the node automatically emits FINISHED even if an optional completion-event field is empty.

SituationOutcome
Continuous ActionUpdate until its own logic finishes or fails.
One-shot Action finishesOther unfinished Actions keep running.
All Actions finishEmit FINISHED; follow the next execution connection.
FailureUse FAILED or the configured failure event.
InterruptionExit the old branch without reporting false success.

How Action completion reaches BDS

An Action calls Finish() → every Action in the node finishes → the node emits FINISHED → execution follows the next node. A Return, or a terminal completed node without a continuation, completes the behavior flow. BDS observes completion, invokes OnAbilityFinished and selects from this frame’s evaluated, available candidates. An empty optional completion-event field does not block this chain; no additional Ability-finished event is required.

An ordinary candidate waits for the entire behavior flow. A higher-scoring interrupting candidate may exit the old branch early. If the original Ability still has the highest score and is not on cooldown, it may run again after completion.

Editor shortcuts

ControlOperation
Marquee / multiselectSelect nodes for alignment, distribution or folding.
DeleteDelete selected nodes.
Home / FFrame all / frame selection.
Ctrl + Shift + LArrange automatically.
[ / ]Collapse / expand selection.
Ctrl + SpaceSearch nodes and commands by category path.
Double-click a callOpen its graph/BDS reference or create configuration.
Back / ForwardFollow the cross-graph navigation history.

State and Action lifecycles

NodeHow it runsWhen it exits
StateRuns its Enter, Update and Exit event graphs at the corresponding phases. Use it for persistent states such as patrol or aim.A matching condition or event leaves the state. State Exit runs before the target node enters.
ActionEnters enabled Actions in order and updates unfinished Actions on subsequent frames. Delayed Actions also count as pending.When all Actions have ended, the node emits FINISHED or FAILED and looks for a matching execution wire.
ReturnReads the configured return pins.Completes the current graph and delivers its results to the caller.
Graph ExitRuns cleanup Actions when the graph stops.Runs once per invocation after completion, interruption or an error that stops the graph.

A Simple state event uses In and runs on state entry. A Full event graph offers separate Enter, Update and Exit entries. By default, all enabled visual events run for their matching phase. In sequential mode, reaching Out advances the sequence. Use Graph Exit for resources owned by the entire graph.

Event-driven transitions and global events

  • The node emits FINISHED or FAILED when all enabled Actions have ended. The individual Action completion field may be left blank. A custom event waits until the other Actions in the node end.
  • An event first tries a matching execution output on the current node. If no output is available, it looks for a matching Event Listener in the graph. Set the listener to Alert and wire it to the desired State.
  • Event Sender can send a graph-local or global event. Host code can call PoBDSEventManager.Instance.SendGlobalEvent("Alert"). Enable global listening on the Event Listener to subscribe. Events queue while the current Action node is unfinished.
  • BDS keeps scoring independently. A candidate with forced preemption enabled can end the old behavior and trigger its cleanup.

Run child flows in parallel

One Ability runs movement and shooting as parallel flows. · Click to view full image
  1. Add branches to one BDS Ability

    Select the Execution node, choose Flow Graph and click Add Flow. For example, keep Orbit first and add a shooting flow second. Double-click the Execution node to choose a branch to open.

  2. Supply arguments

    Flow 1 supports argument and result bindings. Additional flows use their own input defaults. Each branch has graph-local variables and can share Actor-global variables for the same Actor.

  3. Define completion

    The Ability completes when all branches end. A persistent branch keeps it active until the branch ends or the Ability is preempted.

  4. Compose flows inside a graph

    Use the Parallel node in the Flow Graph editor to run several child graphs. The parent continues after all branches exit. For simpler parallel work, several Actions in one Action node can update together.

Graph Exit and cleanup

Completion, forced stop and error stop share the same cleanup path. · Click to view full image
  1. Place a Graph Exit node

    Search for Graph Exit in the flow canvas context menu. Connect its execution output to one Action node, then wire data pins for method arguments. Inline cleanup Actions can also be configured in the Graph Exit inspector.

  2. Configure immediate cleanup

    For example, use Set Variable to set the Actor-global Bool Global/IsFiring to false, then call an immediate Actor method to release reserved cover. Inline cleanup runs first, followed by the directly connected Action node. Each Action runs Enter and Exit. The cleanup skips Update and delays and follows no subsequent execution wires.

  3. Verify completion and interruption

    Cleanup runs when the graph returns or reaches its end, when Stop() is called, when BDS preempts it, and when a runtime error stops it. The active node exits first. When a nested call is stopped, the child cleans up before the caller.

Graph locals and arguments remain readable during cleanup. Actor-global writes survive into the next behavior. On a normal return, the return values are captured before cleanup. Cleanup is synchronous and suits resource release, state resets and variable writes.

Execution runner pooling

Each root AI simulation clock pools behavior flows and child BDS runners. Completion, interruption or exit runs Exit, stops descendants and returns the runner. Recycling waits until active callbacks unwind, so another behavior cannot reuse a context that is still exiting.

Renting clears locals, arguments, return values, queued events, cooldowns and debug state, then binds the new configuration, Actor and call arguments. Actor-global variables belong to the Agent and survive behavior changes without being shared across Actors. Each invocation has its own debug/history identity.

Use runner.SimulationClock.ExecutionPool to set Capacity (32 idle runners per kind by default), inspect CachedFlows / CachedBds and CreatedFlows / CreatedBds, or Clear() idle caches. Capacity=0 disables caching without limiting active nesting. Pooling reduces runner creation; Action instances, parameter binding and history capture can still allocate during transitions.

Binary configuration files

.bytes files store serialized configuration, not Actor C# source. The serializer supports PBDS binary data with integrity checks and legacy JSON reads. Renaming text to .bytes does not create a valid binary asset.

Preserve Unity .meta files and resource references when migrating. Use Resources, an asset service or host-injected loaders instead of editor-only package directories at runtime.

Combine keywords with / · Enter opens first result · Esc closes