- Image layers: <imagelayer> renders with parallax + optional repeatx/repeaty tiling across the view; the image loads relative to the map file. Group layers flatten at build (children render in file order); layer offset/opacity/tint are queryable (Tiled.layer_kind / layer_offsetx / layer_offsety / layer_opacity / layer_tint), a group's tint applying recursively. - Orientation transforms: Tiled.cell_x / Tiled.cell_y compute a tile cell's screen position for orthogonal, isometric ((x-y)*tw/2, (x+y)*th/2), staggered, and hexagonal (rows step by (tileh+hexsidelength)/2, alternate rows shoved per staggerindex) — the tile draw now places cells through them. - Wang: exported Wang-set GIDs are ordinary GIDs and resolve through the standard GID resolver; the terrain-corner authoring concept is editor-side (design cut). Proven by library/tiled_p5.ludic (14 assertions) over the real isometric_grass_and_water.tmx (iso + Wang) and hexagonal-mini.tmx, plus a hand-authored image+group fixture. x test: 96 passed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
3.8 KiB
3.8 KiB
bump: minor type: feat
Tiled map support (#67–#74) — load and draw Tiled maps (TMX/TSX/TX and TMJ/TSJ/TJ), the design record from #66.
- P0 parsing primitives (#67) — a minimal pure-Ludic XML reader (
Xml.*) for the element/attribute/CDATA subset TMX/TSX/TX use; standard base64 decode/encode (Base64.*, RFC 4648), whose decoder ignores the whitespace Tiled wraps into<data>; and gzip framing (z_gunzip, RFC 1952) wrapping the existing DEFLATE inflater. zlib and the JSON reader already shipped. A curated, attributed golden corpus lands underassets/tiled-fixtures/. - P0.5 TMX/TSX reader (#68) —
Tiled.read/Tiled.read_tsxmap the native XML formats onto the same intermediate the JSON path produces — aValuetree in Tiled's JSON schema, with every tile layer's data decoded to a dense GID list (CSV, base64, base64+zlib, base64+gzip). A CSV.tmxand a base64+zlib.tmjof the same map read structurally identically; the in-repo KenneysampleMap.tmx+ externalsampleSheet.tsxload with no manual JSON re-export. - P1 core load + render (#69) — the runtime
rt_tmapmodel (heap-allocated tow·h, lifting the old96×64cap), the GID resolver (Tiled.resolve→ tileset / local id / H·V·D flips), image-backed rendering (Tiled.draw, flips applied at blit), and the legacy-tilemap compatibility projection soGrid.*/Path.*/esys_movekeep working.Tiled.loadreads either format, resolves external tilesets + images, and auto-projects acollisionlayer. The Kenney sample loads and renders pixel-identically from.tmxand.tmj; thegridandphysics_tilesdemos now run off a loaded map. - P2 collision & grid (#70) — normalise three collision sources into the byte tilemap
esys_move/Grid.*/Path.*read, in the design's priority order: per-tile<objectgroup>hitboxes, thesolid/oneway/triggerproperty convention (Tiled.collision_kind/Tiled.tile_shapes), and the designated collision layer (Tiled.project, any non-zero GID solid) — or drive collision from a visual layer's per-tile metadata alone (Tiled.collide). The property convention and the collision-layer fallback produce the same feed;Path.a_starover a loaded map matches the hand-authored baseline. - P3 animated tiles + tile objects (#71) — a tileset
<animation>advances deterministically as a pure function of the fixed 60/s engine frame clock (Tiled.frame_gid/Tiled.animated), so an animated GID resolves at draw to the current frame's GID with its flip flags preserved and reproduces frame-for-frame across runs;Tiled.draw_animdraws a map with animations advanced. Object-layer entries with agidrender the tile image (with their own flips), bottom-anchored, as placeable sprites. - P4 objects, properties, templates, spawning (#72) — all object shapes (rectangle / ellipse / point / polygon / polyline / text) and custom properties parse and are queryable (
Tiled.object,Tiled.object_shape,Tiled.prop/Tiled.prop_int/Tiled.prop_type); class properties resolve their defaults against a project custom-type table (Tiled.load_typesoverobjecttypes.xml); template instances inherit their.tx/.tjtemplate's fields; and an object maps onto Ludic components on demand (Tiled.spawn/Tiled.spawn_layer, off by default, via the reflection ABI). - P5 breadth (#73) — image layers (parallax + repeat) and group layers (flattened, with recursive offset/opacity/tint/visible;
Tiled.layer_kind/Tiled.layer_offsetx/Tiled.layer_tint); the isometric / staggered / hexagonal orientation coordinate transforms (Tiled.cell_x/Tiled.cell_y, driving the tile draw so cells land at the correct screen coords); and Wang-set GID resolution through the standard resolver (the terrain-corner authoring concept is editor-side and ignored).