What It Is

The Stack system provides a stack-based layered execution model inside a Flow graph. It is designed for cases where behavior should be organized as a set of layered modes, and only the top layer should actively update at any given time.

A Stack Root owns the stack state and drives the update loop. A Stack Layer defines the lifecycle branches for one layer, including Push, Resume, Update, Pause, and Pop, and also serves as the entry point for pushing that layer onto a stack.

This model is useful when you want explicit and predictable control over temporary modes such as menus, dialogue, tutorials, or input overrides. It is not intended to replace FSM or Behavior Tree systems, and it is not a general-purpose scheduler.

Core Behavior

The system follows one simple rule:

Only the top layer updates. Lower layers remain paused.

When a new layer is pushed, the current top layer is paused, and the new layer becomes the active top. When the current top is popped, it is removed and the previous layer resumes. This makes layer transitions easy to reason about and avoids accidental parallel execution.

Mental Model

You can think of the stack like a pile of active modes:

This makes the system a strong fit for layered interaction states where temporary control should override previous behavior without destroying it.

Lifecycle

Push

When a Stack Layer is pushed:

  1. The target Stack Root is resolved.
  2. The current update loop is stopped.