feat: SaveGame level layout and chips from live state #484

Merged
jqueuniet merged 5 commits from feat/482-save-live-dungeon into main 2026-11-03 07:53:49 +01:00
Owner

Closes #482.

SaveGame.levelLayout(level) / levelChips(level, options): same JSON as DungeonFile's, drawn from the save's live state.

The save's raw sections are a dungeon.dat image, rebuilt the way the engine loads a save:

  • record-stream floor bits merge into tiles; static record bits (doors, teleporters, text, actuators) merge into their records;
  • every creature, item, missile and cloud is freed and reallocated from the stream, appended at each tile chain's tail (chains can share a static tail);
  • object list and column table rebuilt, checksum recomputed.

Beta saves' raw tables hold the shipped dungeon.dat's static records and keep items the stream dropped, hence the rebuild rather than pairing raw slots with stream records.

Bindings: wasm, C FFI (header regenerated), Python.

Known gaps, none visible in layout or chips:

  • slots past the rebuilt count keep stale bytes;
  • record caps are 1024 per type (768 clouds), not header capacity;
  • end-of-stream links (container-map chests, creature-held missiles) not applied;
  • back-link teleporter tiles lose their dynamic objects, as in the engine.
Closes #482. `SaveGame.levelLayout(level)` / `levelChips(level, options)`: same JSON as `DungeonFile`'s, drawn from the save's live state. The save's raw sections are a dungeon.dat image, rebuilt the way the engine loads a save: - record-stream floor bits merge into tiles; static record bits (doors, teleporters, text, actuators) merge into their records; - every creature, item, missile and cloud is freed and reallocated from the stream, appended at each tile chain's tail (chains can share a static tail); - object list and column table rebuilt, checksum recomputed. Beta saves' raw tables hold the shipped dungeon.dat's static records and keep items the stream dropped, hence the rebuild rather than pairing raw slots with stream records. Bindings: wasm, C FFI (header regenerated), Python. Known gaps, none visible in layout or chips: - slots past the rebuilt count keep stale bytes; - record caps are 1024 per type (768 clouds), not header capacity; - end-of-stream links (container-map chests, creature-held missiles) not applied; - back-link teleporter tiles lose their dynamic objects, as in the engine.
feat(bindings): SaveGame.levelLayout and levelChips
Some checks failed
CI / msrv (1.90) (pull_request) Successful in 31s
CI / audit (pull_request) Successful in 20s
CI / stable (pull_request) Failing after 54s
CI / python bindings (3.11) (pull_request) Successful in 26s
88ccec5afb
test(saves): gate live dungeon fixtures on game files
All checks were successful
CI / msrv (1.90) (push) Successful in 30s
CI / msrv (1.90) (pull_request) Successful in 30s
CI / stable (pull_request) Successful in 58s
CI / python bindings (3.11) (pull_request) Successful in 27s
CI / audit (pull_request) Successful in 20s
CI / audit (push) Successful in 19s
CI / stable (push) Successful in 57s
CI / python bindings (3.11) (push) Successful in 27s
def52c9926
jqueuniet deleted branch feat/482-save-live-dungeon 2026-11-03 07:53:49 +01:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jqueuniet/dm2-tools!484
No description provided.