tiledjs
Headless Tiled 1.12+ JavaScript API runner for custom formats and validators.
Headless wrapper around Tiled's built-in scripting engine that loads a project's custom JS extensions, executes map scripts or validators without opening a window, and exports custom map formats.
git clone https://github.com/BestRoiMedia/bestroi-game-tools.gitWhy we built it
Tiled's stock CLI does not load a project's extensionsPath, preventing custom map formats and validators from running in CI or agent workflows. tiledjs bridges that gap without disturbing any open Tiled editor window.
Architecture & how it works
tiledjs.py invokes Tiled with --new-instance in headless mode, evaluates all .js extensions in the project's extensionsPath (plus any --ext files) before running the target script, passes trailing CLI arguments via ARGS, and captures RESULT and tiled.log lines into a single JSON verdict on stdout.
Key capabilities
- Executes Tiled's full JavaScript API headlessly with --new-instance isolation
- Automatically loads and evals project custom format and validator .js extensions
- Exports .tmx and .tmj maps to built-in or custom-registered formats
- Captures script RESULT objects, tiled.log output, and stack traces as JSON
Usage example
python3 tiledjs/tiledjs.py run ./tools/check_rooms.js --project ./game.tiled-project -- ./maps/room1.tmj
python3 tiledjs/tiledjs.py export ./maps/room1.tmj ./out/room1.lvl --format mygame --project ./game.tiled-project