Lossless, round-trippable JSON for dm2-saves #308
Labels
No labels
area/ci-release
area/cli
area/docs
area/dungeon
area/ftl
area/graphics
area/gui
area/music
area/saves
area/tooling
port/amiga
port/dos
port/fm-towns
port/mac
port/pc98
port/sega-cd
priority/high
priority/low
priority/medium
type/bug
type/chore
type/docs
type/feature
type/research
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jqueuniet/dm2-tools#308
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Give DM2 savegames a lossless, round-trippable JSON representation in
dm2-saves:implement the approved-but-unbuilt
SaveDumpschema (forward dump) and add publicreverse reconstruction so
parse -> JSON -> parse JSON -> reconstructreproduces theoriginal
SkSave.datbyte-for-byte.Design of record:
docs/superpowers/specs/2026-07-31-save-json-roundtrip-design.md(supersedes
2026-06-22-save-json-dump-design.md, which designed the schema but was neverimplemented and shipped no public reverse).
Motivation
Underpins a save editor (GUI, #303) and the browser save editor behind #301.
dm2-saveshas no
serdetoday. A real JSON->bytes library API (not just a test helper) is requiredso editing tools can write edits back, and a lossless form ensures no save state is
silently dropped.
Two lossless variants
record_stream); reload requiresdungeon.dat+graphics.datas inputs; smaller JSON.reload needs no external files either direction; gameplay-editable only (SGB /
globals / champions / effects / timers). This is the lightweight web-editor path and the
#307 self-contained form.
Scope / acceptance
SaveDumpschema (gameplay typed + base64rawescape hatches;raw-numeric values;
schema_version: 1), plus a fullraw.bitstreamescape hatch forthe self-contained variant (mutually exclusive with
raw.bitstream_pad).serde/serde_json/base64todm2-saves; newjsonmodule withSaveDump(Serialize + Deserialize), three forward constructors (
gameplay_only,self_contained,full),to_pretty_json, and two reverse methods:reconstruct(map_info, gdat)andreconstruct_self_contained().dm2 dumpsaves CLI path: default gameplay-only,--self-contained,and
--full(requires--gdat+--dungeon).fixture, byte-identical — field-driven (
reconstructwith inputs) and self-contained(
reconstruct_self_contained, no inputs) — plus a gameplay-edit-reflected test.the web serialization scheme (#307), and the wasm exposure (#301).
Labels
type/feature,area/saves,priority/medium.