Tiled P1 — core orthogonal load: rt_tmap model, GID resolver, render #69
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#69
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 P1 of the Tiled design (#66). Design record: Design: Tiled maps §2.
Scope — core orthogonal load + render
The heart of the feature. Introduce the richer model and draw it.
rt_tmapmodel (design §2): map header + ordered layers (denseint32GID arrays) + tilesets. Heap-allocated tow·h; lifts the96×64cap.gid → (tileset, localId, flipH, flipV, flipD); flip flags (0x80000000/0x40000000/0x20000000) masked off before local-id lookup, returned alongside (design §3.3).gid==0= empty.rt_map/rt_tilebyte grid soGrid.*/Path.*/esys_movekeep working unchanged; old code stays byte-identical.Tiled.*namespace (Tiled.load,Tiled.gid,Tiled.resolve,Tiled.draw), spliced on demand likeRegex.*/Grid.*.gridandphysics_tilesdemos with a loaded map.Golden fixtures
Kenney
sampleMap.tmx(via #68) and its TMJ export (via #67 JSON path).Acceptance
.tmxand.tmj.grid/physics_tilesdemos run off the loaded map with unchangedGrid.*/esys_movebehaviour.Depends on #67, #68. Blocks P2/P3.
P1 landed in
main(bc301c8) — the heart of the feature: load a map and draw it.rt_tmapmodel (Tmap/TmLayer/TmTileset): map header + ordered layers (denseint32GID arrays, heap-allocated tow·h, lifting the old96×64cap) + tilesets. Built from the P0.5 intermediate tree, so TMX and TMJ both feed it.Tiled.resolve):gid → (tileset, localId, fh/fv/fd); the three flip flags (0x80000000/0x40000000/0x20000000) masked off before the local-id lookup and returned alongside.gid==0= empty.Tiled.draw): every visible tile layer in file order, blitting each tile from its tileset image with flips applied at draw.Tiled.project, auto on load): a designated collision layer projects to the legacy byte tilemap —'#'solid,'='one-way (via theonewayproperty), space empty — soGrid.*/Path.*/esys_moveare byte-identical.Tiled.loadreads either format, resolves external tilesets + images relative to the map file, and auto-projects acollision/solids/wallslayer.Acceptance
.tmxand.tmj—tiled_p1.ludicdraws each to the framebuffer and hashes it: byte-identical.grid/physics_tilesdemos run off the loaded map with unchangedGrid.*/esys_movebehaviour — both converted toTiled.load(grid_maze.tmx,physics_map.tmx), output byte-identical.Two compiler fixes fell out of this:
emit_index_addrsetg_addr_tybefore evaluating the index, soslice[obj.field]came back mis-typed (fixed: set it last, like the raw-pointer branches); and@strcmpwas declared by both the world table and the fs prelude (centralised in the head prelude) so a game usingFs/Pathlinks.x test: 92 passed; self-host bootstrap fixpoint intact. Unblocks P2/P3. Proven byexamples/library/tiled_p1.ludic(14 assertions).