Skip to content

Save Games

Player saves are a first-class engine system, separate from the project files a creator saves in the editor. A save is a versioned sektor.player-save/v1 slot written atomically, hash-checked against corruption, and restored exactly: not "close enough to resume", but bit-for-bit simulation state.

What a save captures

More than most engines: the runtime scene, Event variables, counters and the custom-event queue, deterministic random stream cursors, active timers and Wait continuations, started scripts, the fixed tick and time, UI focus, pointer policy, dynamic-body and character velocities, third-person camera state, and every Audio Source's playback cursor, gain, and in-progress fades.

The consequence of that completeness: loading cannot break gameplay. An enemy mid-jump lands the jump. A fading music track keeps fading from the same sample. A Wait 3 seconds with one second left fires one second after loading.

Using it

Saving and loading are ordinary Event actions, so the pattern is one line each:

  • Checkpoint volume: trigger on_trigger_enter with Hero, action save_game.create slot "Checkpoint".
  • Quicksave: trigger input.action_pressed "Quicksave", action save_game.create slot "Quick".
  • Load from the pause menu: ui.on_click on LoadButton, action save_game.load slot "Quick".

Slots are named, timestamped, and listable, so a save menu is a UI page plus three events.

Safety rails

  • Atomic writes: a crash during save never corrupts the previous save.
  • Content hashes reject corrupted files instead of loading garbage.
  • Project fingerprints prevent loading a save into an incompatible newer project revision; the failure is a clear diagnostic, not undefined behavior.
  • After restore, the engine resynchronizes interpolation, physics, audio voices, replay state, and the fixed clock in one step.

Project saves are different

Project save Player save
Who The creator, in the editor The player, at runtime
Contains Scenes, assets, events, settings Progress and live simulation state
Protection Atomic writes plus 30-second crash-recovery autosaves Atomic writes, hashes, fingerprints

Automate it

The same operations are available to AI and to automated tests:

{"op":"runtime.save.create","slot":"Before Boss"}
{"op":"runtime.save.list"}
{"op":"runtime.save.load","slot":"Before Boss"}
{"op":"runtime.save.delete","slot":"Before Boss"}

Automated evidence in the engine's test suite covers save and load through Events and AI, audio sample-position restoration, rigid-body velocity, compatibility rejection, and deletion. Saving is one of the most-tested paths in the engine, because nothing destroys player trust faster than a broken save.