maps
Tiled-centered 2D map generator, linter, renderer, and headless automapper.
End-to-end 2D map toolkit centered on Tiled (.tmj) files: converts ASCII sketches to/from Tiled, lints collision and reachability, generates BSP/cave/WFC/chunk maps, runs Tiled automapping rules headlessly, and tunes level difficulty.
Planned repo: BestRoiMedia/bestroi-game-tools (MIT)Why we built it
Tiled's CLI cannot run AutoMapping headlessly, and AI agents need a fast text-and-PNG loop to draft, lint, and verify 2D maps without breaking hand-authored .tmj files.
Architecture & how it works
maps.py wraps tmjlib.py, sketch.py, lint.py, gen.py, automap.py, render.py, iso/, and levels/tune.py. Game profiles define walkable terrain, object types, and traversal rules (top-down, platformer, crossings, leaps). It supports exact round-tripping between ASCII sketches and .tmj, native execution of Tiled automapping rules and Wang sets, and bisection-based difficulty dial tuning.
Key capabilities
- Exact lossless round-trip between ASCII text sketches and Tiled .tmj maps
- Profile-driven map linter checking missing tilesets, solid overlaps, spawns, and unreachable regions
- Seeded procedural generators for BSP dungeons, cellular caves, WFC, and stitched chunks
- Native headless runner for Tiled automap rules (input/output/regions) and Wang autotiling
- Isometric/3-4 room projection helpers and simulator-backed difficulty-dial tuner
Usage example
python3 maps/maps.py sketch2tmj ./maps/src/prologue.txt --out ./maps/prologue.tmj
python3 maps/maps.py lint ./maps/prologue.tmj --profile default --eyes ./out/lint.png
python3 maps/maps.py automap ./maps/prologue.tmj --out ./maps/auto.tmj --wang