Godot save load systems

From thedivergentai/GD-Agentic-Skills · View interactive version

Godot save load systems is an AI agent skill from the GitHub repository thedivergentai/GD-Agentic-Skills. Expert blueprint for save/load systems using JSON/binary serialization, PERSIST group pattern, versioning, and migration. Covers player progress, settings, game state persistence, and error recovery. Use when implementing save systems OR data persistence. Keywords save, load, JSON, FileAccess, user:

How to use this skill

Skill file

NEVER Do


Available Scripts

MANDATORY: Read the script for the chosen format before writing SaveManager code.

[save_load_patterns.gd](scripts/save_load_patterns.gd)

MANDATORY for JSON / binary / PERSIST collect — patterns default store_var(..., false).

[save_migration_manager.gd](scripts/save_migration_manager.gd)

MANDATORY when any save has a version field that can lag the build.

[save_system_encryption.gd](scripts/save_system_encryption.gd)

MANDATORY before encrypted slots — password from secure storage / user secret, never hardcoded in examples.

[save_integrity_validator.gd](scripts/save_integrity_validator.gd)

Rolling .bak + SHA-256 verify before trusting a slot; fall back to backup on mismatch.


Deep dive (load on demand)

MANDATORY for JSON/PERSIST walkthroughs, binary examples, gotchas, and elite encrypted paths — references/save-patterns-deep.md. Do not paste Step 1–3 Autoload tutorials into scenes.

Expert WHY (critical)

CAUTION: Baseline tutorials used store_var(data, true). Untrusted user:// saves must allow_objects=false — RCE risk on modded/workshop files.


Decision Tree: Pick a Persistence Shape

| Need | Format | MANDATORY |

|------|--------|-----------|

| Human-readable, small/medium progress | JSON + version | save_load_patterns.gd |

| Type-faithful Variants / larger blobs | Binary store_var with allow_objects=false | same |

| Typed Resource trees / inspector schemas | ResourceSaver / .tres/.res | Peer godot-resource-data-patterns |

| Many scene nodes auto-collect | PERSIST group + save()/load() | save_load_patterns.gd |

| Schema evolved | Migrate then load | save_migration_manager.gd |

| Anti-tamper / sensitive fields | Encrypted FileAccess | save_system_encryption.gd |

Do not paste Step 1–3 JSON Autoload tutorials here — implement from the scripts.

`allow_objects` Trust Boundary

Default always store_var(data, false) / get_var(false).

| Case | allow_objects | Rule |

|------|-----------------|------|

| Player user:// saves, workshop mods, downloads | false | NEVER true — RCE risk |

| Trusted local only (your own tooling, offline debug fixtures you control) | true only if unavoidable | Document why; never ship as default; prefer Resources / Dictionaries of primitives |

Encrypted elite paths still use false unless the payload is explicitly trusted-local and non-user-editable.

Golden Path (version → migrate → backup → atomic write)

  1. Version field on every save blob.
  2. Migrate via save_migration_manager.gd when versions differ.
  3. Backup existing file (DirAccess.copy_absolute to .bak) before overwrite.
  4. Write to temp then rename, or write-after-backup; validate open errors.
  5. Integrity optional: FileAccess.get_sha256 compare; fall back to backup on mismatch.
  6. Paths only user:// — never absolute OS paths.
  7. When to save — menu, checkpoint, level complete — never per physics frame.

Settings may use ConfigFile separately from run-progress JSON/binary.

Reference

Progressive disclosure: open Official Documentation links only when researching a specific API; load Related Skills when routing to a peer domain — do not preload the whole lattice.

Official Documentation

Related Skills

Prerequisites
Complements
Downstream / consumers
Master
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.