Skip to main content

Slot Workflow

Use SaveFlowSlotWorkflow when the user story is:

Build a save menu without rewriting slot IDs, metadata, and save cards every time.

SaveFlow deliberately does not own "the player's current slot". That state belongs to the project. SaveFlowSlotWorkflow keeps it explicit while removing repeated glue.

The active slot is a playthrough identity, not a single-file guarantee. Scene, Scope, and custom saves may write separate records under the same active slot.

SaveFlow slot workflow

What It Owns

SaveFlowSlotWorkflow owns:

  • active slot index
  • slot ID template
  • empty display-name template
  • slot ID overrides
  • metadata construction
  • empty save-card construction
  • save-card construction from slot summaries

It does not save gameplay data by itself.

var slot_workflow := SaveFlowSlotWorkflow.new()

func select_slot(slot_index: int) -> void:
slot_workflow.select_slot_index(slot_index)

func save_active_slot(scope: SaveFlowScope) -> void:
var metadata := slot_workflow.build_active_slot_metadata(
"Village Start",
"manual",
"Chapter 1",
"Forest Gate",
960
)
SaveFlow.save_scope(slot_workflow.active_slot_id(), scope, metadata)

Save Card Menu

Use cards to render a save/load menu without loading every full payload.

func refresh_cards() -> Array:
var summaries_result := SaveFlow.list_slot_summaries()
if not summaries_result.ok:
return []
return slot_workflow.build_cards_for_indices(
PackedInt32Array([1, 2, 3]),
summaries_result.data
)

Each card contains user-facing fields such as display name, chapter, location, playtime, save type, active state, and compatibility status.

Autosave And Checkpoint

Autosave and checkpoint usually write the active slot.

func trigger_autosave(scope: SaveFlowScope) -> void:
var metadata := slot_workflow.build_active_slot_metadata(
"",
"autosave",
"Chapter 1",
"West Room",
_current_playtime_seconds
)
SaveFlow.save_scope(slot_workflow.active_slot_id(), scope, metadata)

This keeps autosave understandable:

  • the active slot is still the storage target
  • scene and scope calls can target the relevant record inside that slot
  • metadata records that the write was an autosave
  • the save menu can display the new slot state through cards

Slot ID vs Metadata

Keep storage identity stable.

Keep player-facing naming in metadata.

Good:

slot_id = slot_1
display_name = Village Start
save_type = manual

Avoid using player-facing names as storage IDs. Names change; storage keys should not.

Slot ID vs Record Key

Keep slot_id stable for the player.

Let SaveFlow choose scene and scope record keys for scene-authored data.

slot_id = slot_1
record_key = scope:res://world/project_room_dungeon.tscn:room

If your project writes a custom record directly, choose a stable record key such as quest_log or world_state. Do not include display names, timestamps, or temporary scene state in record keys.