Tiled.read / Tiled.read_tsx (runtime/native/tiled.ludic): map the native
XML formats (TMX/TSX/TX) onto the SAME intermediate the JSON path produces
— a Value tree in Tiled's JSON schema — so one format-independent core
(P1) consumes either reader.
- tmx_to_value walks 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 .tmx and a base64 .tmj of the same map read
structurally identically.
- External tilesets keep the {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.
- Object layers, shapes (rect/ellipse/point/polygon/polyline/text),
image/group layers and custom properties are parsed into the tree now so
P2/P4/P5 just read it.
- tmj_normalize decodes base64 `data` strings in a parsed .tmj so the JSON
path matches the XML path.
Proven by library/tiled_p05.ludic (30 assertions) incl. the in-repo Kenney
sampleMap.tmx + external sampleSheet.tsx and TMX-vs-TMJ structural
identity. Docs + inventory added; x test: 91 passed.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| desert.tmx | ||
| desert.tsx | ||
| handmade.tmj | ||
| handmade.tmx | ||
| handmade.tsx | ||
| hexagonal-mini.tmx | ||
| isometric_grass_and_water.tmx | ||
| orthogonal-outside.tmx | ||
| perspective_walls.tsx | ||
| README.md | ||
| sewers.tmx | ||
Tiled golden fixtures
The curated, version-pinned corpus for the Ludic Tiled reader (design record:
Design: Tiled maps,
issues #67–#74). No single Tiled file covers the format surface, so this is a
subset of the official mapeditor/tiled
examples/ tree plus a few hand-authored files for the gaps the official
examples miss.
Vendored from mapeditor/tiled (examples/)
Fetched from https://raw.githubusercontent.com/mapeditor/tiled/master/examples/.
Tiled's example assets carry their own licenses (see the upstream repo's
per-folder *.license/README); vendored here with attribution for testing only.
| File | Exercises |
|---|---|
desert.tmx + desert.tsx |
orthogonal, external .tsx, base64+zlib (P0/P1) |
sewers.tmx |
orthogonal, base64+zlib, embedded tileset, opacity (P0) |
orthogonal-outside.tmx |
object layers, shapes, custom properties (P4) |
perspective_walls.tsx |
per-tile bool properties, <tileoffset> (P4) |
isometric_grass_and_water.tmx |
isometric orientation, Wang set (P5) |
hexagonal-mini.tmx |
hexagonal orientation (P5) |
Hand-authored (CC0 / public domain)
| File | Exercises |
|---|---|
handmade.tmx + handmade.tsx |
a 4×4 orthogonal map whose four layers carry the same GID array in CSV, base64-uncompressed, base64+gzip and base64+zlib — so every encoding path must decode identically. The last tile is GID 1 with the horizontal-flip flag (0x80000001), forcing real GID decode. handmade.tsx also carries a solid bool property and a per-tile <objectgroup> collision shape for P2. |