DRIFTLANDS co-op survival on drifting tides — studio progress

Quick Design Spec: Save & Persistence

Type: New Small System Scope: The host-owned save file and the load/reconcile pipeline. Owns storage format, write atomicity, versioning, and reconcile orchestration — never the per-system schemas or reconcile semantics (each owning system defines those; this spec consolidates the five ⚑ provisional contracts). Does NOT own: diff schemas (Harvesting), metadata semantics (Crafting), structure posture (Base Building), stack serialization (Inventory), time/validity derivation (Tide). Date: 2026-08-26 Estimated Implementation: ~4 days (diff round-trip already spike-validated — prototypes/tide-scheduler-spike-2026-08-25/)

Overview

One world = one host-owned save file. The world itself is mostly math — DockedLands(seed, t, config) is pure — so the save stores only what the tide cannot recompute: the seed and clock guard, the group's earned knowledge, harvest diffs, the structure registry, gear identity, and inventories. On load, Save orchestrates a fixed reconcile order in which each system applies its own already-locked rules. Two classes of state exist and never blur: droppable (harvest diffs — stale ones age out by design) and permanent (knowledge, marks, structures — never stale-dropped, reconciled to inert/orphan forms instead).

Core Rules

Tuning Knobs

Knob Default Range Category Rationale
saveDebounceMs00–1000gateMeaning restated by ADR-0004: 0 = one background flush job per dirty drain; > 0 = coalescing window after a dirty drain before enqueuing (merging further drains). Raise only if disk I/O measurably hurts — anything above 0 widens the loss window and needs a measured reason
flushDeadlineMs25050–1000gateADR-0004: a flush exceeding this logs loudly (never a gameplay effect). Conservative default, retuned from the standalone-build measurement before Alpha
backupCopies31–10gateRolling previous-good copies; the recovery path when the current file is damaged outside a torn write

Values live in assets/data/save.json, not hardcoded.

Acceptance Criteria

Systems Index

Already tracked as MVP system #4 (Persistence, quick-spec, "Diff-contract validated (spike)"). On approval: status → **Designed (quick-spec)** — and the five ⚑ provisional rows in tide/harvesting/crafting/base-building/inventory reconcile against this spec.

Forward refs owned elsewhere: on-disk serialization format choice (JSON vs binary) + save-file location → implementation; replication of loaded state to late-joining clients → netcode ADR; save-anyone-can-host → Tier 1 (first-to-slip, explicitly not designed here).