Tilemap — grid worlds
tilemapis a level as a grid of tiles — aw × harray of tile ids over a tileset — rendered as a layer and queried for tile collision. Its point is cheapness: a grid world tests a moving target against cells (an O(1) lookup) instead of against thousands of per-tile collision objects. The world geometry for platformers and top-down 2D; collision stays for the moving actors.
Status: design. Not built yet.
What it is
A tilemap is a level held as data: a grid of tile ids, a tileset (id → appearance + flags such as solid), and one or more layers (background, collision, foreground). It renders through the compositor as a layer, and answers the one question a grid world asks constantly — is this cell solid?
Tile collision — the cheap part
A tile world can be thousands of tiles; making each a collision target would be absurd. Instead a moving target tests against the grid: from its position, look up the cells it covers and check their solid flag — O(1) per cell, no N-pair broad phase. tilemap is a specialised collider for static grid geometry, complementing collision's target-vs-target for the moving entities. Use tilemap for the world, collision for the actors.
On the stage
tilemap participates in Detect: a target-vs-grid test emits the same enter / exit contact events collision does, so a script handles a wall-hit and a monster-hit through one path. It renders as a layer through either graphics backend — the FireStorm hardware chipset or the software chipset (which can lay a tile world over an emulated machine) — and, being static, is trivially deterministic; the grid is just read.
Clients
- Luau —
require("tilemap"): load a map, read/write tiles, test solidity, query a region. - AntBASIC —
TILEMAPto load a level andSOLID(x, y)to test a cell, for a first platformer.
Related
- collision — target-vs-target, for the actors · sprite / camera — how the world is drawn and framed · stage — the Detect phase
- luau_tilemap — the Luau API