Sein World Subsystem
Class · USeinWorldSubsystem : UWorldSubsystem
#include "Simulation/SeinWorldSubsystem.h"
The deterministic simulation for one world. Owns the world state, the fixed-tick scheduler and the core services (entities, tags, the diplomacy ledger, live tuning), and reads components and players. Gameplay, orders, economy, match and collision logic live in their own world subsystems, which register systems, entity hooks and state blocks here.
Functions
Section titled “Functions”Match
Get Match Build State
Section titled “Get Match Build State”Where the match build stands: not built, building tick zero, built, or failed.
ESeinMatchBuildState GetMatchBuildState() const;Get Match Entity
Section titled “Get Match Entity”The entity that carries the match’s components (Game State), or an invalid handle.
FSeinEntityHandle GetMatchEntity() const;Simulation
Is Simulation Running
Section titled “Is Simulation Running”True once the simulation has started ticking, until it stops.
bool IsSimulationRunning() const;Get Current Tick
Section titled “Get Current Tick”The current simulation tick; zero is the tick the match was built at.
int32 GetCurrentTick() const;Get Fixed Delta Time Seconds
Section titled “Get Fixed Delta Time Seconds”Wall-clock length of one simulation tick, from SimulationTickRate.
float GetFixedDeltaTimeSeconds() const;Get Interpolation Alpha
Section titled “Get Interpolation Alpha”Interpolation alpha between simulation ticks (0-1) for rendering.
float GetInterpolationAlpha() const;Player
Get Player Entity
Section titled “Get Player Entity”The entity that carries a player’s components (Player State), or an invalid handle.
FSeinEntityHandle GetPlayerEntity(FSeinPlayerID PlayerID) const;Is Registered Player
Section titled “Is Registered Player”True when the player is registered in this match.
bool IsRegisteredPlayer(FSeinPlayerID PlayerID) const;Get Registered Player IDs
Section titled “Get Registered Player IDs”Registered player IDs in ascending order.
TArray<FSeinPlayerID> GetRegisteredPlayerIDs() const;Get Player Count
Section titled “Get Player Count”How many players are registered in this match, Neutral included.
int32 GetPlayerCount() const;C++ members (75)
static void AddReferencedObjects(UObject* InThis, FReferenceCollector& Collector);Component payloads live as raw bytes; this reports their object references to the collector.USeinEntitySubsystem& Entities();Created with the world and valid for its whole life.const USeinEntitySubsystem& Entities() const;USeinTagSubsystem& Tags();const USeinTagSubsystem& Tags() const;USeinDiplomacySubsystem& Diplomacy();const USeinDiplomacySubsystem& Diplomacy() const;USeinLiveTuningSubsystem& LiveTuning();const USeinLiveTuningSubsystem& LiveTuning() const;bool BeginMatchBuild(FString& OutError);NotBuilt -> Building: freeze the execution topology, let modules prepare their static data, and allow tick-zero writes. Match service only.bool FinishMatchBuild(FGuid& OutChecksum, FString& OutError);Building -> Built: check every module’s start invariants and the state’s types, and return the tick-zero checksum peers compare. Match service only.void FailMatchBuild(const FString& Reason);NotBuilt or Building -> Failed, with an error on screen.const FString& GetMatchBuildFailureReason() const;bool IsExecutionTopologyFrozen() const;bool IsExecutionTopologyValid() const;const FString& GetExecutionTopologyFailureReason() const;void PoisonExecutionTopology(const FString& Reason);Mark the execution contract broken: before freeze it poisons the pending topology, after freeze it stops the simulation and broadcasts OnExecutionTopologyInvalidated.void InvalidateDeterministicExecutionContract(const FString& Reason);Fail-stop a world whose frozen execution contract can no longer describe execution.void TerminateAndReleaseForModuleUnload(FName OwnerModuleId, const FString& Detail);Release all module-owned live-world state before a deterministic implementation DLL unloads. Broadcasts the topology failure first; the world cannot restart.bool IsTerminalAfterModuleUnload() const;bool IsTearingDown() const;True during world teardown or after a module-unload release.bool StartSimulation();Start or resume ticking a built match. False for a match that has ended.void StopSimulation();Stop ticking.bool RequireStateMutationAuthorization(const TCHAR* Operation) const;Gate for direct deterministic-state writes: a match build, a running fixed-tick context, or a validated restore. Mutation libraries call this first.bool IsInReadOnlyCallback() const;True inside a read-only or observer callback.bool IsInObserverCallback() const;True inside an observer callback, which may not even submit commands.bool IsTickDispatchInProgress() const;True for the whole fixed-tick callback, completion observers included.bool IsRestoreInProgress() const;True while RestoreState replaces the world state.uint64 GetFormationOrderTokenEpoch() const;Process-local generation for formation-order tokens; advances after a restore so drafts made against the replaced state cannot be submitted. Not simulation state.bool IsSimulationPaused() const;True while simulation time is frozen; only pause-control commands run.void SetSimPaused(bool bPaused, bool bRejectCommandsWhilePaused = false);Pause or resume. A soft pause queues ordinary commands for the first resumed tick; a hard pause rejects them.ESeinMatchState GetMatchState() const;const FSeinMatchSettings& GetMatchSettings() const;The immutable match settings installed at match start.uint64 GetAuxiliaryRevision() const;Change counter for entity tags, players and diplomacy, for derived caches. Not state.void BumpAuxiliaryRevision();FSeinNavAgentProfile BuildNavAgentProfile(FSeinEntityHandle Handle) const;The entity’s complete navigation policy: its tags, then what Navigation, Movement and Orders resolve for it. The radius overload takes a footprint radius a hot caller already resolved.FSeinNavAgentProfile BuildNavAgentProfile(FSeinEntityHandle Handle, FFixedPoint ResolvedFootprintRadius) const;static int32 GetTicksPerTurn();Ticks in one lockstep turn, from the tick and turn rates.void SetCatchingUp(bool bInCatchingUp);While catching up (a reconnect or a replay seek) every frame runs as many ticks as the turn source allows, up to Max Ticks Per Frame.bool IsCatchingUp() const;const FSeinEntity* GetEntity(FSeinEntityHandle Handle) const;FSeinEntity* GetEntityMutable(FSeinEntityHandle Handle);Mutable entity access for deterministic code; null from read-only callbacks. Does not grant mutation authority by itself.bool IsEntityAlive(FSeinEntityHandle Handle) const;FSeinPlayerID GetEntityOwner(FSeinEntityHandle Handle) const;const FSeinEntityPool& GetEntityPool() const;FSeinEntityPool* GetEntityPoolMutable();Mutable pool access for deterministic systems; null from read-only callbacks.TSubclassOf<AActor> GetEntityActorClass(FSeinEntityHandle Handle) const;The Blueprint class an entity was spawned from (for the actor bridge).const FSeinEntity* GetDestroyingEntity(FSeinEntityHandle Handle) const;The dying entity and its owner, only during its destroy notification.FSeinPlayerID GetDestroyingEntityOwner(FSeinEntityHandle Handle) const;FSeinEntityHandle GetEntityInTeardown() const;The entity whose deferred destroy is running, or invalid.const ISeinComponentStorage* GetComponentStorageRaw(UScriptStruct* StructType) const;ISeinComponentStorage* GetComponentStorageMutable(UScriptStruct* StructType);Mutable raw storage for deterministic code; null from read-only callbacks.ISeinComponentStorage* GetOrCreateStorageForType(UScriptStruct* StructType);Get or create the storage for a struct type (runtime-typed component adds).TArray<UScriptStruct*> GetComponentStorageTypes() const;Registered component types, unordered: sort by a stable identity before deterministic use.int32 GetComponentStorageCount() const;const FSeinWorldState& GetState() const;The canonical world state.FSeinWorldState& GetStateForWrite();Write access for simulation services that are already inside an authorized mutation. Never call it from presentation.bool CaptureState(TArray<uint8>& OutBytes, FString& OutError) const;Write the world state (state and presentation streams, packed). Between ticks only.bool ComputeChecksum(FGuid& OutChecksum, FString& OutError) const;Checksum of the state stream. Peers compare it to detect a desync.TArray<FString> DescribeChecksumParts(bool bDetailed) const;One checksum per part of the state stream, as “<checksum> <part>”: each root field, module block and component storage, and with bDetailed each entity’s component and each sim object in a part too. Comparing two peers’ lists at the same tick names what a desync changed. Between ticks only; empty otherwise.bool RestoreState(TConstArrayView<uint8> Bytes, bool bResume, FString& OutError);Replace the world state with bytes from CaptureState. The bytes are read into a fresh state and validated first, so a failure leaves the live world untouched. The abandoned timeline is dropped silently: no cancellation or removal callbacks fire for it. Derived state is then rebuilt, OnAuthoritativeStateRestored fires, actors are reconciled, and the simulation resumes when bResume is true. A world that never started is adopted as a consumed match.bool RegisterStateBlock(const UScriptStruct* Type);Add a module’s canonical state block: a USTRUCT the world owns, captures and restores. Register at world initialization, before the match starts.void RegisterAI(const UObject* AI, FSeinPlayerID Player, FSeinAIThink Think);Run an AI controller’s Think every tick, before that tick’s commands process, in player order. AI reasoning runs only on the host; only the commands it emits reach other peers. Registering the same AI again replaces its entry.void UnregisterAI(const UObject* AI);bool EmitAICommand(const UObject* AI, const FSeinCommand& Command);Issue a command for the AI whose Think is running. Any other caller is refused.bool HasAI(FSeinPlayerID Player) const;True when an AI controller plays this player.const FGuid& GetSettingsHash() const;Hash of every sim-affecting setting, frozen when the world starts.int64 GetSessionSeed() const;Seed of the world’s deterministic random stream.bool RegisterSystem(ISeinSystem* System, FString* OutError = nullptr);Register a deterministic system before topology freeze. Repeating the same pointer is idempotent; a missing or duplicate name poisons the pending topology.bool UnregisterSystem(ISeinSystem* System, FString* OutError = nullptr);Remove a system. After freeze this invalidates the live simulation, except at teardown.void EnqueueVisualEvent(const FSeinVisualEvent& Event);Enqueue a visual event (simulation to presentation, one-way).TArray<FSeinVisualEvent> FlushVisualEvents();Take every queued visual event (presentation).bool HasPendingVisualEvents() const;FFixedRandom& GetSimRandom();The world’s deterministic random stream. Simulation code only.const FFixedRandom& GetSimRandom() const;