Skip to main content
Flow Core Documentation
Menu

Overview

Choosing a Logic Model

Match Flow, FSM, Behavior Tree, Stack, or GOAP to the responsibility you need to express.

Audience
System designers and developers
Time
10 minutes
Requires
Flow Core in Five Concepts
Modules
Flow, FSM, Behavior Tree, Stack, GOAP
On this page

Choose a model by the question it must answer at runtime. Flow Core modules can cooperate, but each responsibility should have one clear owner.

Decision table

ModelRuntime questionStrong fitPoor fit
FlowWhat happens next after this event?Ordered work, waits, side effects, signals, UI, handoffsRepeated priority reevaluation
FSMWhich long-lived mode is active?Patrol/Combat, locomotion modes, interaction phasesLarge priority trees
Behavior TreeWhich valid behavior has highest priority now?AI decisions, ordered checks, reactive fallbackLong cinematic or UI timelines
StackWhich temporary layer is currently on top?Menus, input contexts, dialogue overlays, inspect modeConcurrent state families
GOAPWhich action sequence can reach the desired facts at acceptable cost?Dynamic planning from world factsFixed short sequences

Start with normal Flow

If a button click should validate input, play feedback, wait, and open another screen, a normal Flow owns that sequence clearly. Do not add a state or planner when the route is already known.

Add FSM for persistent identity

Use FSM when the active mode changes what behavior is allowed. A character may be in Patrol, Combat, or Stunned. The state owns entry, active behavior, transitions, and exit.

Add a Behavior Tree for priority

Use a Behavior Tree when choices must be checked again as facts change. A combat tree may prefer Attack, then Chase, then Take Cover, then Idle. The tree owns the decision; normal Flow can perform visible consequences after the result.

Add Stack for temporary coverage

Use Stack when a mode is covered and later restored in reverse order. Gameplay can be covered by Pause, then Options; popping Options resumes Pause, and popping Pause resumes Gameplay.

Add GOAP for discovered sequences

Use GOAP when the authored content defines possible actions, but the planner should discover a route from current facts to desired facts. If the action order is always known, authoring the sequence directly is usually clearer.

flowchart TD A{"Known ordered route?"} -->|Yes| F["Flow"] A -->|No| B{"Persistent active mode?"} B -->|Yes| S["FSM"] B -->|No| C{"Re-evaluate priority?"} C -->|Yes| T["Behavior Tree"] C -->|No| D{"Cover and restore?"} D -->|Yes| K["Stack"] D -->|No| G["GOAP"]

Compose without overlapping ownership

A common composition is:

  1. Flow receives an event and activates Combat.
  2. FSM owns whether Combat remains active.
  3. A Behavior Tree inside Combat chooses Attack, Chase, or Cover.
  4. Flow performs animation, camera, audio, and UI consequences.
  5. Blackboard values carry shared facts such as TargetVisible and CanAttack.