Skip to content

Sein Command Dispatcher

Class · USeinCommandDispatcher : UWorldSubsystem

#include "Input/SeinCommandDispatcher.h"

The world’s command path. A command enters through one of four doors: a local player, an AI controller, a lockstep or replay turn, or a deterministic system. It waits in the world state’s pending commands until the tick’s command phase, where the dispatcher admits it (schema, match context, authority policy) and runs its handler. A refused command becomes a CommandRejected visual event.

Standalone, a local or AI command is admitted for the player it names. While a network session runs, Route takes it instead: the session stamps the player and brings it back as part of a turn, or, for a resume while paused (a paused world takes no turns), through EnqueuePauseControl.

Services register their handlers while they initialize. The set, with the project’s handler classes, freezes when the world freezes its execution topology at match build.

C++ members (20)
  • bool RegisterHandler(const FSeinCommandSchemaDescriptor& Schema, FSeinCommandExecute Execute); Register the handler for one command type. Call it while initializing; a malformed or duplicate schema disables the command path.
  • bool Freeze(FString& OutError); Add the project’s handler classes and fix the set. The world calls it when it freezes its execution topology.
  • const FSeinCommandSchemaDescriptor* FindSchema(FGameplayTag CommandType) const; The registered schema for a command type, or null.
  • ESeinCommandStructureResult ValidateStructure(const FSeinCommand& Command) const; Check a command against its registered schema.
  • bool IsReady() const; True once the authority policy loaded and the handler set froze without error.
  • void ReleaseHandlers(); Drop every handler and binding; their code may live in a module about to unload. The world calls it when a module withdraws its state and at teardown.
  • bool SubmitLocal(const FSeinCommand& Command, bool bAsMatchAdministrator = false); A local player’s command. Standalone admits it for Command.PlayerID, or as the match administrator; a network session takes it through Route. True when accepted.
  • bool SubmitAI(FSeinPlayerID Player, const FSeinCommand& Command); An AI controller’s command for its player. The world’s AI tick calls it.
  • bool SubmitForPlayer(FSeinPlayerID Player, const FSeinCommand& Command); Command for Player, when this machine may act for it: its own player; on a network host, also an AI-run player, or Neutral as the match administrator; standalone, any player. False, with nothing submitted, otherwise.
  • FSeinPlayerID GetLocalPlayer() const; This machine’s player: the local Player Controller’s. Neutral when it has none (a dedicated server, or before a controller claims a slot).
  • void EnqueueTurn(TConstArrayView<FSeinCommand> Commands); A lockstep or replay turn’s commands, already stamped with their players. They run in the next tick.
  • void EnqueueDerived(const FSeinCommand& Command); A deterministic follow-up command every peer emits identically. Simulation context only.
  • bool EnqueuePauseControl(const FSeinCommand& Command); A resume (or another pause-control command) a network session or replay delivers while the world is paused, already stamped with its player. It runs in the next paused frame. False when the world is not paused, the command is not pause control, or another one still waits: one at a time, so every peer stops at the same command.
  • bool CanControlEntity(const FSeinCommand& Command, FSeinEntityHandle Entity) const; The active authority policy’s answer for one entity.
  • FSeinPlayerID ResolveResourcePayer(const FSeinCommand& Command, FSeinEntityHandle Entity) const; The player the authority policy charges for a command’s costs on one entity.
  • const USeinCommandAuthorityPolicy* GetAuthorityPolicy() const;
  • void Reject(const FSeinCommand& Command, FGameplayTag Reason = FGameplayTag(), FSeinEntityHandle Entity = FSeinEntityHandle::Invalid()); Reject a command with a reason; presentation hears it as a CommandRejected visual event, naming Entity, or the command’s own entity when it acts on one.
  • int32 NextCohesionOrder(); Within-tick sequence for broker cohesion groups; reset at each command drain.
  • void ProcessPending(); Run the pending commands. The world calls it in each tick’s command phase.
  • void ProcessPauseControl(); Run the commands accepted while simulation time is frozen by a pause.