What you need
- Godot 4.3 or newer (for the
TileMapLayernode). - Your tileset PNG, the same file you painted with in TileMap Studio.
- A map from TileMap Studio. If you don't have a tileset yet, grab a free one.
Option 1: import the .tmx through a Tiled importer
The quickest route if you already use Tiled add-ons.
- In TileMap Studio choose File → Export → Tiled map (.tmx).
- Save your tileset PNG next to the .tmx, named exactly like the tileset in the editor (the .tmx refers to
<tileset name>.png). Rename the tileset in the editor first if you want a shorter file name. - In Godot, install a Tiled importer from the Asset Library. YATI ("Yet Another Tiled Importer") supports Godot 4.
- Drop the .tmx and PNG into your project. The importer turns them into a scene with one
TileMapLayerper layer.
Option 2: load the JSON project with GDScript
No add-ons. TileMap Studio's project file stores every cell as atlas coordinates (tileX, tileY),
which is exactly what TileMapLayer.set_cell() takes.
- Export File → Export → TileMap Studio project (.json) into your Godot project, for example
res://maps/level1.tilemap.json. - Add a
TileMapLayernode. Create a newTileSetwith your tile size, and add the tileset PNG as an atlas source (it gets source id 0). - Attach this script, set the layer name, and run.
extends TileMapLayer
## Loads one layer of a TileMap Studio project (.tilemap.json).
@export_file("*.json") var project_path := "res://maps/level1.tilemap.json"
@export var layer_name := "Ground"
@export var source_id := 0 # the atlas source in this node's TileSet
func _ready() -> void:
var project: Dictionary = JSON.parse_string(FileAccess.get_file_as_string(project_path))
for layer in project["layers"]:
if layer["name"] != layer_name:
continue
var rows: Array = layer["data"]
for y in range(rows.size()):
for x in range(rows[y].size()):
var cell = rows[y][x]
if cell != null:
set_cell(Vector2i(x, y), source_id, Vector2i(int(cell["tileX"]), int(cell["tileY"])))
Use one TileMapLayer per TileMap Studio layer, each with its own layer_name.
If one layer mixes tiles from several tilesets, add each PNG as its own atlas source and map
cell["tilesetId"] to the matching source id.
Lining up autotiled terrain
Terrain painted with the Terrain brush uses a dual grid: each tile sits on the corner between four cells.
In Godot, move the terrain layer half a tile up and left, so with 32 px tiles set its position to (-16, -16).
Everything else stays at (0, 0).
Keep pixel art crisp
Set Project Settings → Rendering → Textures → Default Texture Filter to Nearest, and use integer scaling for your viewport (Display → Window → Stretch, scale mode integer) so tiles don't blur or shimmer.
Questions
Can Godot 4 open .tmx files?
Not on its own. Install a Tiled importer add-on from the Asset Library (YATI, "Yet Another Tiled Importer", is a popular one), or load TileMap Studio's JSON export with the script on this page.
Should I use TileMap or TileMapLayer in Godot?
Use TileMapLayer. Since Godot 4.3 each layer is its own TileMapLayer node and the old multi-layer TileMap node is deprecated. The script on this page targets TileMapLayer.
Do autotiled terrain layers work in Godot?
Yes. The terrain is exported as ordinary tiles, so it looks exactly as it did in the editor. Offset the terrain TileMapLayer by half a tile up and left (for 32 px tiles, position -16, -16) so it lines up with your other layers.
What tile size should I use for a Godot pixel art game?
16×16 and 32×32 are the most common. Pick one, make your TileSet use it, and enable nearest-neighbour filtering (Project Settings, Rendering, Textures, Default Texture Filter: Nearest) so pixels stay crisp.