TileMap → TileMapLayer converter v1 — whole project, from the command line
TileMap is deprecated since Godot 4.3. The editor converts one scene at a
time, by hand, and only scenes it can open. This is the same job for a whole
project, from the command line.
Two Node scripts, zero dependencies, no install, no network, no engine needed.
Unzip and run — node docs/convert_tilemap_to_tilemaplayer.js /path/to/project.
convert_tilemap_to_tilemaplayer.js — every TileMap becomes a Node2D
with one TileMapLayer child per layer, layer_N/tile_data re-encoded into
tile_map_data, and every block it does not own returned byte for byte. It
writes nothing without --write, keeps a .tscn.bak when it does, and
refuses rather than guesses: a script on the node, an unknown layer_N/
key, a duplicate layer name, an unchecked format.
scan_tilemap_script.js — the scripts it refuses. A script that
extends TileMap cannot extend the Node2D the node becomes, so the scene
converter stops; this ports it call by call. Given the scene, the layer index
becomes the actual layer node: set_cell(0, …) comes back as
$Ground.set_cell(…), and clear_layer(0) as $Ground.clear() — there is no
clear_layer on TileMapLayer. Anything needing a human decision comes back
as a question instead of a silent rewrite.
Both take --json. Exit code is 1 while anything still needs a human, so they
drop into a build script.
What was measured
- Over Godot's own demo projects at branch
4.2(298 scenes): 14 nodes and
3 427 cells converted, 3 refused — all three carrying scripts. 1 real
TileMapin 6 has no automatic conversion; that is what the second script is
for. - The engine reads the scene back cell by cell before and after:
640 checks green across 4.3, 4.4, 4.7 and a 4.2 → 4.7 cross-version pass
(docs/verify_tilemap_convert.sh). - The replacement table is dumped from
ClassDBon 4.2, 4.3, 4.4 and 4.7
rather than typed from the docs: 31 checks green on each engine that has
TileMapLayer, plus a round trip where a scripted scene is ported end to end
— 22 rewrites, 0 left for a human — and the engine confirms the ported script
reads the converted scene exactly as the original read the original
(docs/verify_tilemap_script_api.sh, which re-runs it against your build).
None of that is a promise about your project. It is why --write keeps a
.tscn.bak and why the refusals exist.
No terminal?
The same files run in the browser, nothing uploaded:
scenes ·
scripts
MIT. Every byte in the zip is already in docs/ in this repository — the
release is a shortcut and a stable link, not a different build.