Skip to content

feat: add save load and persistent state - #14

Merged
pes7 merged 19 commits into
masterfrom
refactor/save-load-persistent-state
Jul 27, 2026
Merged

pes7 merged 19 commits into
masterfrom
refactor/save-load-persistent-state

Conversation

@pes7

@pes7 pes7 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

This stacked PR adds versioned save/load and persistent player state on top of refactor/legacy-cleanup-integration-hardening.

Completed scope

  • adds ZoneUA.Persistence runtime assembly
  • adds versioned SaveGameData schema
  • persists active scene, world seed, player transform, health and active weapon slot
  • adds explicit save schema migration
  • rejects unsupported future schemas
  • adds atomic primary/temp/backup file replacement
  • adds SHA-256 payload checksum validation
  • falls back to the previous backup when the primary save is corrupt
  • adds SaveGameCoordinator with manual save/load/delete and autosave hooks
  • defers player restore until additive scene activation completes
  • exposes WeaponSwitcher.ActiveWeaponIndex
  • adds EditMode tests for migration, round-trip storage, backup recovery and deletion
  • adds Docs/SAVE_LOAD_PERSISTENT_STATE.md

Stacking

Base branch: refactor/legacy-cleanup-integration-hardening

Merge after PR #13, or retarget after the earlier stacked PRs are merged.

Unity setup

Add SaveGameCoordinator to the persistent Bootstrap root and assign the production player root, Health, WeaponSwitcher and SceneBootstrapper references.

The world generator should call SetWorldSeed(resolvedSeed) after seed resolution and use CurrentWorldSeed before deterministic regeneration during load.

Validation required in Unity 6000.5.5f1

  • project compiles with zero Console errors
  • all SaveGamePersistenceTests pass
  • save/load restores player transform
  • current and maximum health restore correctly
  • active weapon slot restores correctly
  • loading a save from another scene waits for SceneActivated
  • corrupt primary save falls back to backup
  • pause autosave works on Android
  • application quit does not throw during shutdown
  • world seed is applied before player simulation resumes

The code scope is complete. This PR remains draft because filesystem behaviour, scene transitions, mobile pause handling and production prefab references must be validated in the Unity Editor and target builds.

@pes7 pes7 mentioned this pull request Jul 27, 2026
10 tasks
@pes7
pes7 force-pushed the refactor/legacy-cleanup-integration-hardening branch from 040def7 to 7ff103f Compare July 27, 2026 21:12
@pes7
pes7 force-pushed the refactor/save-load-persistent-state branch from 5c049cd to cf82e67 Compare July 27, 2026 21:14
@pes7
pes7 changed the base branch from refactor/legacy-cleanup-integration-hardening to master July 27, 2026 21:14
@pes7
pes7 marked this pull request as ready for review July 27, 2026 21:14
@pes7
pes7 merged commit 3756504 into master Jul 27, 2026
2 checks passed
@pes7
pes7 deleted the refactor/save-load-persistent-state branch July 28, 2026 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant