How-To: Configure Auto-Saving
Goal: understand the world-state settings and pick the right capture / flush behavior for your game.
The defaults (recommended)
Out of the box the system is fully automatic: implementing ICrimsonSaveableActor + marking SaveGame is enough, and a normal save persists world actors.
| Setting | Default | Effect |
|---|---|---|
bAutoCaptureActorsOnSave | true | Every save scans loaded levels and captures all saveable actors. Turn off only if you want to capture exclusively via explicit OnActorStateChanged calls. |
bIncludeWorldStateInMainSave | true | RequestSaveProgress / auto / quick saves also flush world state - one call saves everything. |
bAutoLoadWorldState | true | Applies world slabs automatically after a load completes. Turn off to call LoadWorldState() yourself. |
WorldStateFlushIntervalSeconds | 0 (off) | Seconds between automatic flushes of changed world actors. Writes only what changed and never scans the world, so the cost follows how much moved, not how big the level is. Server-authority only. |
Save on quit (wire it into your game mode)
A save still has to be triggered - nothing saves on its own. To make "change something, then quit" persist with no explicit save call, call SaveGameToActiveSlotSynchronous() from your game mode's EndPlay. That covers world and global state.
GameMode::EndPlay runs during world teardown, after the local player has been removed and its PlayerController destroyed - so every player-owned component has already deregistered and the save finds nothing to write. Player-scoped fragments are persisted instead by the manager, which flushes each system's fragment as it unregisters. That path also covers the local player, who never logs out, and a client that disconnects mid-session.In your Game Mode Blueprint: Event End Play -> test the End Play Reason pin against the reasons you care about - two Equal (Enum) nodes, one for End Play In Editor and one for Quit, joined by a Boolean OR - -> Branch (True) -> Get Crimson Save Game Manager -> Save Game To Active Slot Synchronous.
Save Game To Active Slot Synchronous takes no pins and blocks the game thread on purpose: during teardown there is no later frame on which to finish an async write. No authority branch is needed, because a Game Mode only exists on the server.
SaveGame value, quit PIE, press Play again - the value persists (with bAutoLoadWorldState on). With the default storage provider on PC, a Slot<n>_W_<Level>.sav blob appears after quitting.ACrimsonGameMode), this EndPlay hook is already in place - you only need bAutoSaveOnExit enabled. The step above is for projects wiring their own game mode.Checkpoint / immediate flush
For a game that should persist a change the instant it happens (a lever thrown, a boss down), pair the incremental hook with per-change flushing.
At the moment the state actually changes - the lever finishes throwing, the boss dies - record it and then write it: Has Authority (Branch, True) -> Get World Subsystem (Class = Crimson Save World Manager Subsystem) -> On Actor State Changed -> Flush Dirty World State. Drag both calls off the same subsystem output pin.
On Actor State Changed's In Actor pin defaults to Self, so on the changed actor itself there is nothing to wire into it. Both calls are server-authority only, which is what the leading Has Authority branch is for. If you would rather flush on a timer than at each checkpoint, set Project Settings -> Crimson -> Crimson Save Game Manager -> World State -> `WorldStateFlushIntervalSeconds` and leave Flush Dirty World State out of the chain.
FlushDirtyWorldState writes one blob per changed actor and nothing else - it does not scan the world, so a checkpoint costs what moved rather than what exists. Calling it on every small change is still more disk traffic than it is worth; prefer a meaningful moment, and let WorldStateFlushIntervalSeconds cover the rest. SaveWorldState() remains the heavier call that looks at every saveable actor first.bVerboseLogging on, trigger a save and confirm a Slot<n>_W_<Level>.sav blob appears in Saved/SaveGames/ (default storage provider, PC).See also
- API Reference -> Developer Settings - the full settings reference
- Concept: World State & Identity - how capture and restore work