Goal
Add engine support for loading level/tile data from the Tiled JSON map format (format reference), or at least a useful subset of it. Tiled is a free, widely-used tilemap editor - supporting its JSON export would let a game built on this engine author levels visually instead of hand-writing tile data in code.
Context
examples/platformer (issue #62) deliberately authors its level as a plain array-of-strings literal in LevelData.bs - no tilemap format or editor, by design, to keep that example minimal and dependency-free. That's the right call for a reference example, but it leaves an obvious gap for anyone building a real game with this engine: there's currently no way to load a level authored in an actual map editor.
Suggested scope
A reasonable partial subset, not full Tiled fidelity:
- Parse a Tiled JSON map's
layers (at minimum one visible tile layer), tilesets (external or embedded), width/height/tilewidth/tileheight.
- Map Tiled's tile GIDs to something game code can use to spawn
GameEntity/Collider/Drawable instances per cell - likely following the same "static geometry lives on one shared entity with many named colliders/drawables" pattern examples/platformer's Level entity established (see examples/platformer/src/source/Entities/Level.bs), generalized to read from a parsed Tiled map instead of a hand-authored string array.
- Object layers (
objectgroup) for spawn points (player start, enemies, items, triggers) - Tiled's normal way to place these - would make this genuinely useful beyond just tile geometry.
- Tiled custom properties on tiles/objects, since that's the standard way level designers attach gameplay metadata (e.g. "solid", "oneWay", "damage") without inventing a parallel legend system.
Out of scope initially: infinite maps, non-orthogonal (isometric/hexagonal) orientations, animated tiles, Tiled's Wang/terrain sets, external Tiled Automapping rules.
Prior art in this codebase
OBJParser/STLParser (src/source/utils/) are the existing precedent for "parse a third-party file format into engine primitives" (see Game.load3dModel) - a TiledMapParser following the same shape (parse into a small intermediate data structure, then a TiledMapOps-style function that materializes it into colliders/drawables) would fit this codebase's existing conventions.
Notes
- Should be designed/prototyped against a real level exported from Tiled, not synthetic JSON - the same "verify against reality, not just the spec doc" principle this repo applies elsewhere (e.g. device-capability caps in
Camera3d.maxDrawDistance).
- Once this lands,
examples/platformer (or a follow-up example) is the natural place to demonstrate it, since it already has the Level-entity-shaped consumer this would feed into.
Goal
Add engine support for loading level/tile data from the Tiled JSON map format (format reference), or at least a useful subset of it. Tiled is a free, widely-used tilemap editor - supporting its JSON export would let a game built on this engine author levels visually instead of hand-writing tile data in code.
Context
examples/platformer(issue #62) deliberately authors its level as a plain array-of-strings literal inLevelData.bs- no tilemap format or editor, by design, to keep that example minimal and dependency-free. That's the right call for a reference example, but it leaves an obvious gap for anyone building a real game with this engine: there's currently no way to load a level authored in an actual map editor.Suggested scope
A reasonable partial subset, not full Tiled fidelity:
layers(at minimum one visible tile layer),tilesets(external or embedded),width/height/tilewidth/tileheight.GameEntity/Collider/Drawableinstances per cell - likely following the same "static geometry lives on one shared entity with many named colliders/drawables" patternexamples/platformer'sLevelentity established (seeexamples/platformer/src/source/Entities/Level.bs), generalized to read from a parsed Tiled map instead of a hand-authored string array.objectgroup) for spawn points (player start, enemies, items, triggers) - Tiled's normal way to place these - would make this genuinely useful beyond just tile geometry.Out of scope initially: infinite maps, non-orthogonal (isometric/hexagonal) orientations, animated tiles, Tiled's Wang/terrain sets, external Tiled Automapping rules.
Prior art in this codebase
OBJParser/STLParser(src/source/utils/) are the existing precedent for "parse a third-party file format into engine primitives" (seeGame.load3dModel) - aTiledMapParserfollowing the same shape (parse into a small intermediate data structure, then aTiledMapOps-style function that materializes it into colliders/drawables) would fit this codebase's existing conventions.Notes
Camera3d.maxDrawDistance).examples/platformer(or a follow-up example) is the natural place to demonstrate it, since it already has theLevel-entity-shaped consumer this would feed into.