docs
Systems
Execution
FlowControllerSystem
FlowControllerSystem Overview

FlowControllerSystem

The FlowControllerSystem provides FlowController, an abstract base class that connects one Domain on the command bus to the code that handles that domain's commands. It is part of the SaffronLibrary Prime systems, under _Core/Execution.

Key responsibilities

  • Domain registration: During Init, each controller registers its HandleCommand method on the CommandBus for its Domain, so commands addressed to that domain are routed to it.
  • Command handling entry point: Subclasses implement HandleCommand to hold the domain's command processing logic. Each domain should have exactly one flow controller.
  • Initialization integration: FlowController implements IInitializable, so the InitializationManager pipeline calls Init at boot. Subclasses that override Init must call base.Init() to keep registration working.

Who should use it

Gameplay and engineering developers who add a new domain or own the command logic for an existing one. Subclass FlowController, return the matching Domain value, and implement HandleCommand. Developers who only send commands should use the command bus and command types, not this class.

Connections

The controller depends on the bootstrap and messaging layers. InitializationManager constructs and initializes it, ServiceLocator supplies the bus registry, and CommandBus performs the routing. The Domain enum and ICommand define the routing key and the payload type.