feat(stdlib): Tiled P6 — infinite/chunked maps, .world stitching, base64+zstd (#74)
All checks were successful
bootstrap / cfree-fixpoint (push) Successful in 22s
ci / build-and-test (push) Successful in 2m4s
commit-lint / conventional-commits (push) Successful in 4s
docs / build-and-deploy (push) Successful in 28s

- Infinite/chunked maps: <chunk x y width height> (TMX) and JSON chunks[]
  (default 16x16) decode and flatten into the dense layer array, sized to the
  chunk union; the map's 0/0 header dimensions fall back to the flattened bounds.
- .world stitching: Tiled.world / Tiled.world_count / Tiled.world_map read a
  .world (JSON, reusing Json.parse) and list its member maps at their offsets.
- base64+zstd: a self-contained pure-Ludic Zstandard decompressor
  (runtime/native/zstd.ludic, RFC 8878) — the design's "largest single item,
  explicitly last". Frame header + raw/RLE/compressed blocks; raw/RLE and
  direct-weight Huffman literals; the full FSE sequence path (predefined,
  transcribed exactly from zstd's hardcoded tables since they're not rebuildable
  from the default distributions; RLE; FSE-described) with repeat offsets and
  execution. Decodes the low-entropy GID streams a tilemap produces; a high-
  entropy FSE-compressed-Huffman-weights block fails cleanly with -1 rather than
  emitting wrong bytes (documented scope).

Proven by library/tiled_p6.ludic (12 assertions): TMX + TMJ chunk flattening,
.world offsets, and a real zstd-compressed tile layer decoding byte-exactly to
its CSV baseline. x test: 97 passed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-01 16:07:10 +03:00
parent 78a5719fae
commit 764a0296ce
16 changed files with 18356 additions and 17205 deletions

View file

@ -0,0 +1,14 @@
---
id: tiled-world
name: Tiled.world
category: tiled
kind: namespace-method
tokens: Tiled.world
sig: Tiled.world(path: string) -> value
tip: Read a .world file.
order: 37
ns: Tiled
member: world
---
Reads a Tiled <code>.world</code> file (JSON) — a set of member maps stitched at world offsets — and returns its <a href="value"><code>Value</code></a> tree (<code>maps</code>, <code>patterns</code>, <code>onlyShowAdjacentMaps</code>). Reuses the JSON reader.

View file

@ -0,0 +1,14 @@
---
id: tiled-world_count
name: Tiled.world_count
category: tiled
kind: namespace-method
tokens: Tiled.world_count
sig: Tiled.world_count(world) -> int
tip: How many maps a world stitches.
order: 38
ns: Tiled
member: world_count
---
Returns the number of member maps in a loaded <code>.world</code>.

View file

@ -0,0 +1,14 @@
---
id: tiled-world_map
name: Tiled.world_map
category: tiled
kind: namespace-method
tokens: Tiled.world_map
sig: Tiled.world_map(world, index: int) -> value
tip: A world member map by index.
order: 39
ns: Tiled
member: world_map
---
Returns member map <code>index</code> of a world as a <a href="value"><code>Value</code></a> object — its <code>fileName</code> and world <code>x</code>/<code>y</code> offset — so the caller can load each map and draw it at its place.