Tile Based Level Map - UQcsse3200/2026-studio-1 GitHub Wiki
The Tile-Based Level Map provides the spatial foundation for a level: a grid of typed tiles, arranged across one or more layers, that is loaded from a structured JSON file rather than generated in code. It builds on the existing TerrainComponent / TerrainFactory renderer, extending them to support typed tiles, multiple layers, and data-driven spawn points.
Levels are stored as JSON under core/assets/maps/. A file has four sections: a legend mapping single characters to tile definitions, an ordered set of character-grid layers, a tileSize, and spawns for the player, enemies, and loot. JSON was chosen over TMX so a level can be hand-edited in any text editor and the loader stays dependency-free.
Every tile carries a TileType, which maps to a CollisionType used by the collision layer.
| Tile type | Collision | Behaviour |
|---|---|---|
FLOOR |
SOLID |
Solid ground the player stands on. |
WALL |
SOLID |
Blocks movement. |
PLATFORM |
PLATFORM |
Standable support surface. |
HAZARD |
HAZARD |
Passable, but damages the player on contact. |
DECORATIVE |
NONE |
Visual only — no collision. |
A level is drawn back-to-front from an ordered set of named layers:
| Layer | Purpose |
|---|---|
background |
Scenery drawn behind the player. |
terrain |
The main gameplay tiles (walls, platforms, hazards). |
foreground |
Objects drawn over the player. |
collision |
Optional explicit source of collision tiles. |
The collision system reads the collision layer if present, otherwise the terrain layer.
- Tile-Based Level Map — Technical Reference — classes, API, and code examples.