# tilemap

> Talos 0.7 · Since 0.6

Use it in a scene entity's `components` list as `{ "type": "tilemap", … }`. The contract writes the fields flat and refuses unknown keys.

## Fields

| Field | Type | Required | Default | Allowed values | Description |
|---|---|---|---|---|---|
| `tileset` | `TilemapTileset` | yes |  |  |  |
| `legend` | `object` | yes |  |  | Which tile each character of the rows draws: one character (not "." or " ", which are empty) to a tile index of the tileset, a whole number from 0. A row character that is not a key is `tilemap-tile-unknown`. |
| `layers` | `TilemapLayer[]` | yes |  |  | At least one, at most 16, drawn in `sortLayer` / `order`. Layers may differ in size; all share the entity's origin and `cellSize`. At most 1,048,576 cells over all layers (`tilemap-too-large`). |
| `cellSize` | `Vec2` | no |  |  | [width, height] of one cell in metres, above zero; the entity's scale multiplies it. Default: the tile's pixels at 100 pixels a metre, a sprite's default `pixelsPerMetre` (16 px tiles are 0.16 m). |
| `alphaCutoff` | `number` | no |  |  | 0..1, default 0.5: a tile pixel whose alpha is below it is not drawn. |
| `filter` | `SpriteFilter` | no |  | `nearest`, `linear` | "nearest" (hard pixel edges) or "linear". Absent: the scene's `meta.render.filter`, as for sprites. |

## Rules that can refuse it

- `tilemap-invalid`
- `tilemap-layer-unknown`
- `tilemap-tile-unknown`
- `tilemap-too-large`
