feat: add schema version system with outdated save detection

Introduces a schema version field to GameState. Saves without the
current schema version are flagged on load (showing a modal prompting
reset or proceed), and cloud saves from outdated clients are rejected
server-side. Removes all backfill code now that outdated saves are
handled via the reset flow instead.

New POST /game/reset endpoint creates a fresh save for players who
choose to reset. Save version and current schema version are displayed
in the sidebar below the app version.
This commit is contained in:
2026-03-07 17:34:26 -08:00
committed by Naomi Carrigan
parent 4ed3ccc69c
commit 5d2d71983a
11 changed files with 205 additions and 276 deletions
+2
View File
@@ -1,5 +1,6 @@
import type { ApotheosisData, ExplorationState, GameState, Player, PrestigeData, TranscendenceData } from "@elysium/types";
import { DEFAULT_ACHIEVEMENTS } from "./achievements.js";
import { CURRENT_SCHEMA_VERSION } from "./schemaVersion.js";
import { DEFAULT_ADVENTURERS } from "./adventurers.js";
import { DEFAULT_BOSSES } from "./bosses.js";
import { DEFAULT_EQUIPMENT } from "./equipment.js";
@@ -70,4 +71,5 @@ export const INITIAL_GAME_STATE = (player: Player, characterName: string): GameS
apotheosis: { ...INITIAL_APOTHEOSIS },
exploration: structuredClone(INITIAL_EXPLORATION),
companions: { unlockedCompanionIds: [], activeCompanionId: null },
schemaVersion: CURRENT_SCHEMA_VERSION,
});