Tilemap — grid worlds

tilemap is a level as a grid of tiles — a w × h array 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

Tilemap data model

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

Testing a target against a tile grid

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

  • Luaurequire("tilemap"): load a map, read/write tiles, test solidity, query a region.
  • AntBASICTILEMAP to load a level and SOLID(x, y) to test a cell, for a first platformer.

Related

Important: The Ant64 family of home computers are at early design/prototype stage, everything you see here is subject to change.