Bindings: Dungeon handle for dungeon.dat and the magic map #443
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#443
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?
Follow-up to #440. The
dungeon.datbindings are free functions that each detect and parse the dungeon, and the magic-map ones also parsegraphics.dat(8.6 MB on DOS), on every call. Rendering every map or level of a dungeon re-parses both files once per call; through wasm, both files are also copied into WASM memory each time.Proposal
The #440 shape for dungeons:
Dungeonhandle (wasm class, opaque FFIDm2Dungeon *, Python class), built once from the bytes.GraphicsArchive:toJson()dungeon_to_jsonskprojectJson()dungeon_skproject_jsonmapLayout(map)/levelLayout(level)dungeon_map_layout_json/dungeon_level_layout_jsonmapPng(map, graphics)/levelPng(level, graphics)scale(1),creatures(true),fill(true)dungeon_map_png/dungeon_level_pngmapChips(map, graphics)/levelChips(level, graphics)fill(true),language(en)dungeon_map_chips_json/dungeon_level_chips_jsonGraphicsArchive, not bytes, so neither file is parsed per call.dungeon_from_jsonstays free: it builds bytes from JSON and parses no dungeon.Acceptance
Dungeonand oneGraphicsArchiveis measurably faster than through the free functions in wasm (numbers in the PR).Out of scope
The save editor functions (
save_to_json_full,save_from_json_full,save_inventory_json,save_container_*,save_item_*,item_catalog_json,skill_title_json) also re-parsegraphics.dat(anddungeon.dat) per call; taking these handles instead is a separate issue.https://claude.ai/code/session_01SnENBXnZbhNNrojZT5jbJ7