Tiled P0.5 — TMX/TSX/TX reader over the P0 XML reader #68
Labels
No labels
area:ci
area:docs
area:input
area:net
area:rendering
area:repo
area:stdlib
area:tooling
area:types
cleanup
dx
priority:high
priority:low
priority:medium
proposal
status:in-progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: workshopsoft/ludic#68
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 P0.5 of the Tiled design (#66). Design record: Design: Tiled maps.
Scope — TMX/TSX reader
Build the native-format reader on top of the P0 XML reader (#67): map
.tmx, external/embedded tileset.tsx, and.txtemplate files into the same intermediate the JSON path produces. This is what lets the in-repo KenneysampleMap.tmxload without a manual JSON re-export.Per the format-order decision (design §1), JSON (TMJ) is v1's first path because
Json.parsealready exists; this issue adds the XML path as the fast follow so both native Tiled formats work.Golden fixtures
in-repo
assets/kenney/tiny-dungeon/Tiled/sampleMap.tmx+sampleSheet.tsx(orthogonal, external.tsx, CSV, flip-flagged GIDs) — kept as the orthogonal-CSV smoke test.Acceptance
sampleMap.tmx+ externalsampleSheet.tsxparse into the intermediate model with correctfirstgid, geometry, and raw CSV GID array.Depends on #67. Feeds P1 (#PLACEHOLDER).
P0.5 landed in
main(071c268).Tiled.read/Tiled.read_tsx(runtime/native/tiled.ludic) map the native XML formats onto the same intermediate the JSON path produces — aValuetree in Tiled's JSON schema — so one format-independent core (P1, #69) will consume either reader.tmx_to_valuewalks a<map>into{orientation, width/height, tilewidth/height, tilesets[], layers[]}. Every tile layer's<data>is decoded to a dense GID int list — CSV split, or base64 → zlib/gzip inflate → little-endian u32s — so a CSV.tmxand a base64.tmjof the same map read structurally identically.{firstgid, source}reference (as TMJ does); embedded tilesets and standalone.tsx(tsx_to_value) inline full geometry + per-tile metadata (animation frames, collision<objectgroup>, class, properties) for later phases.tmj_normalizedecodes base64datastrings in a parsed.tmj, so the JSON path matches the XML path exactly.Acceptance
sampleMap.tmx+ externalsampleSheet.tsxparse into the intermediate model with correctfirstgid, geometry, and raw CSV GID array — verified against the in-repo Kenney fixture (32×20,firstgid=1→sampleSheet.tsx, 640 GIDs incl. flip-flagged1610612787; sheettilecount=132,columns=12).handmade.tmx(four layers: CSV / base64 / base64+gzip / base64+zlib) andhandmade.tmj(CSV array + base64+zlib) all normalise to the same 16-GID array.Proven by
examples/library/tiled_p05.ludic(30 assertions) inx test(91 passed). Feeds P1 (#69).