How to Make AI Build a Complete Scene From a Tileset: Connected Roads, Reachable Areas, and Godot-Ready Prompts

Prompts for making AI assemble complete scenes from an existing tileset, covering image generation, character-grid layouts, and Codex-generated Godot TileMapLayer maps.

Godot Series Navigation

If you want to learn in order, start with the collection page, then jump to the topic you need:

To make AI assemble a complete and reasonable scene from an existing tileset, do not just write “make a beautiful map.” That is too vague. AI will often chase visual richness first, then produce broken roads, blocked paths, wrong water edges, or unreachable areas.

A better prompt should specify:

  1. Scene purpose: village, forest, level, or presentation image.
  2. Walkability rules: roads must connect, and the spawn point must not be blocked.
  3. Tile usage rules: only use terrain and decorations from the reference tileset.
  4. Spatial structure: entrance, main road, branches, pond, walls, points of interest.
  5. Decoration density: fewer decorations on roads, more around edges.
  6. Output format: rendered image, character grid, JSON, or Godot TileMapLayer code.

The key point is: ordinary image generation models often “redraw based on the tileset” instead of reusing the original tiles pixel by pixel.

If you only want concept art, an image model can reference the tileset and generate a scene preview. If you need every tile pixel to remain unchanged, ask AI to generate layout data first, then let Godot, a script, or Codex assemble the scene using real tile coordinates.

Prompt for Image Generation AI

This is suitable for concept images or visual previews. Upload your tileset as a reference image first, then use this prompt.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Strictly reference the tileset image I provided. Use only the existing ground, road, water, stone wall, and decoration elements from the tileset to assemble a complete, reasonable forest village scene suitable for a top-down RPG.

Scene specifications:

Strict top-down view.
Do not use perspective or isometric view.
Logical map size: 24×18 tiles.
Logical tile size: 32×32.
Preserve the original art style, colors, textures, lighting direction, and proportions of the reference tileset.
Do not redesign the tiles.
Do not add buildings, characters, or large objects that are not present in the reference image.
Do not generate UI, text, borders, or grid lines.
Output a complete scene, not a tileset atlas.

Map structure:

Use normal grass as the main base layer, mixed with a small amount of dark grass and sparse grass to avoid large fully repetitive areas.
Place a clear entrance at the bottom center of the map.
Build a vertical main road from the entrance to the center of the map.
At the center, split the main road into left and right branches. All roads must connect. Do not create broken roads or meaningless road fragments.
Place a natural-looking small pond in the upper-right area.
The pond must be assembled correctly from water center tiles, top/bottom/left/right edges, and corners. Do not create abruptly cut water or shorelines facing the wrong direction.
Place a connected stone wall area in the upper-left region.
Wall edges and corners must connect correctly.
Keep at least one walkable tile between the pond, walls, and the map border.
Leave a relatively open activity area in the center for character movement.
Do not let the pond or walls completely block the main road.

Decoration rules:

Small flowers mainly appear on grass, not on roads or water.
Small stones may appear sparingly on dirt, road edges, or sparse grass.
Grass bushes are concentrated near map edges, the pond, and wall corners.
Tree stumps should appear only sparingly as visual points of interest, and must not block the main road.
Ground cracks appear only on dirt or dry areas.
Fallen leaves are concentrated near map corners and walls.
Keep the middle of roads clean. Put most decorations on both sides of roads.
Use fewer decorations near the map center and denser decorations near the edges.
Do not decorate every cell. Leave natural empty space.

Reasonableness requirements:

All roads must have a clear purpose and connect to each other.
All walkable areas must be reachable from the entrance.
Water, walls, and roads must connect in the correct direction.
Do not create isolated single water tiles, isolated wall tiles, or incorrect corners.
Do not create tiny enclosed spaces that cannot be entered.
The map should feel like a deliberately designed game level, not random tile placement.
The composition needs hierarchy: the entrance guides the player in, the main road leads to the center, and the pond and wall area act as secondary visual focal points.

Only generate one complete top-down map scene.

This prompt pushes the image model to think about structure first instead of pure decoration. But even if you write “strictly reference the tileset,” an image model may still redraw tile details. It cannot guarantee pixel-perfect reuse.

If you need a map that can be imported into a game, do not rely only on the generated image.

Ask AI to Output the Map Layout First

This is better for map reasonableness. Ask AI to avoid drawing and output a 24×18 character map first. After that, let Codex or a script convert the characters into TileMapLayer.set_cell() calls.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Design a 24×18 top-down RPG forest map layout using the rules below.

Map symbols:
G = normal grass
D = dark grass
S = sparse grass
R = road
W = water
A = stone wall
F = small flower
K = small stone
B = grass bush
U = tree stump
C = ground crack
L = fallen leaves
P = player entrance

Design requirements:

P is located at the bottom center of the map.
There must be a road starting from P and leading to the center of the map.
The road splits into left and right branches near the center. All roads must connect.
Place a natural-looking pond of about 4×5 tiles in the upper-right area.
Place a reasonably connected stone wall segment in the upper-left area.
Keep at least a 7×5 open activity area in the center.
Keep at least one walkable tile between the pond, walls, and map border.
The player must be able to reach all main roads and open areas from P.
Do not create enclosed single-tile grass areas.
Do not create meaningless single-tile fragments of roads, water, or walls.
Decorations must not block main roads.
Use more decorations near the map edges and fewer near the center.
Small flowers can only appear on grass.
Ground cracks can only appear on dirt or sparse grass.
Fallen leaves mainly appear near corners and walls.
Keep the overall map natural, not perfectly symmetrical, but structurally clear.

Output requirements:

First section: output only the complete 24×18 character grid.
Each row must contain exactly 24 characters.
There must be exactly 18 rows.
Second section: list the entrance coordinate, road nodes, pond range, and wall range.
Third section: check whether the map has broken roads, enclosed areas, or unreachable areas.
Do not generate an image.

After getting the layout, ask AI to self-check it:

1
2
3
4
5
6
7
8
9
Check the character map above:
1. Whether P can reach all R road tiles;
2. Whether there are isolated W water tiles;
3. Whether there are isolated A wall tiles;
4. Whether any walkable area is blocked by water or walls;
5. Whether every row contains exactly 24 characters;
6. Whether the map has exactly 18 rows.

If you find problems, output a corrected complete 24×18 map.

This workflow is closer to level design than direct image generation. Validate structure first, then add visual detail.

Make Codex Strictly Use the Tileset in Godot

This is the most reliable approach because it actually uses tile coordinates from the atlas instead of redrawing.

Use the following prompt in the Codex panel in VS Code. It assumes your Godot project already has TileMapLayer nodes and an imported TileSet.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
This is a Godot 4.x project. I need to create a complete map using the existing TileSet.

Scene structure:

World: Node2D
├─ Ground: TileMapLayer
├─ Roads: TileMapLayer
├─ Water: TileMapLayer
├─ Walls: TileMapLayer
├─ Decorations: TileMapLayer
└─ PlayerSpawn: Marker2D

The tileset atlas has 6 columns × 5 rows. Coordinates are defined as:

First row:
(0,0) normal grass
(1,0) dark grass
(2,0) sparse grass
(3,0) dirt ground
(4,0) stone floor
(5,0) sand ground

Second row:
(0,1) horizontal road
(1,1) vertical road
(2,1) upper-left road corner
(3,1) upper-right road corner
(4,1) lower-left road corner
(5,1) lower-right road corner

Third row:
(0,2) water center
(1,2) water top edge
(2,2) water bottom edge
(3,2) water left edge
(4,2) water right edge
(5,2) water outer corner

Fourth row:
(0,3) stone wall center
(1,3) stone wall top
(2,3) stone wall bottom
(3,3) stone wall left side
(4,3) stone wall right side
(5,3) stone wall corner

Fifth row:
(0,4) small flower
(1,4) small stone
(2,4) grass bush
(3,4) tree stump
(4,4) ground crack
(5,4) fallen leaves

Task:

Create a 24×18 forest village map.
Place the player entrance at the bottom center.
Create a main road from the entrance to the center, then split it into left and right branches.
Create a reasonably connected small pond in the upper-right.
Create a reasonably connected stone wall segment in the upper-left.
Keep the center open.
All roads must connect.
Water and walls must not block the path.
Place decorations mainly near map edges, the pond, and wall corners.
Do not place decorations in the middle of roads.
Do not create isolated water tiles, isolated wall tiles, or wrong-direction corners.
Use @export for source_id.
Use Godot 4 TileMapLayer.set_cell().
Use static types.
Separate map data from drawing logic.
Add map size checks and reachability checks in code.
If the existing tileset is missing tiles required for a connection, do not guess or use wrong tiles. Clearly report what is missing.

First read the current project, scene, and TileSet resource. Confirm the real source_id and atlas coordinates before editing code. Do not assume source_id equals 0.

The most important line is:

1
First read the current project, scene, and TileSet resource. Confirm the real source_id and atlas coordinates before editing code. Do not assume source_id equals 0.

Godot source_id, atlas coordinates, and TileSet Source order may differ from what you expect. If AI guesses, it can write code that runs but paints the wrong tiles.

A Two-Stage Prompt Better Suited for Codex

If the project is already complex, do not ask Codex to do everything in one pass. First ask it to analyze and check without modifying files:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
This is a Godot 4.x project.

Do not modify any files yet.

Please perform these checks:

1. Read the current scene structure;
2. Find all TileMapLayer nodes;
3. Find the TileSet used by each layer;
4. Confirm the real source_id;
5. List which tile each atlas coordinate represents;
6. Decide whether the tileset is sufficient for a 24×18 forest village map;
7. If road, water, or wall connection tiles are missing, list them clearly;
8. Propose the map data structure;
9. Propose the reachability check approach;
10. Do not write code yet.

After confirming the analysis, ask it to implement:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
Now implement the map generation script.

Requirements:

1. Only modify the World script;
2. Do not modify the TileSet;
3. Do not rename scene nodes;
4. Map size is 24×18;
5. Store map data in arrays or dictionaries;
6. Draw with TileMapLayer.set_cell();
7. Use @export for source_id and key atlas coordinates;
8. Add map size checks;
9. Add road connectivity checks;
10. Add reachability checks from PlayerSpawn to major areas;
11. If a check fails, use push_error() to output the reason;
12. After editing, explain how to test it in Godot.

This two-stage method is steadier: first let AI understand the project, then let it edit.

The Most Important Lines

For any generated scene, add these rules:

1
2
3
4
5
6
All roads must connect to each other and have a clear purpose.
Do not create isolated single water, wall, or road tiles.
Keep the map center readable and increase decoration density near the edges.
Every major area must be reachable from the player entrance.
Decorations must not block the main traversal route.
Design the map structure first, then add decorations.

The last line matters most:

1
Structure first, decoration second.

Without it, AI often tries to make the scene “look rich” first, then produces messy roads, blocked decorations, and unreachable areas.

The safest workflow is:

  1. Generate or organize the tileset first.
  2. Create the TileSet in Godot and confirm each tile’s atlas coordinates.
  3. Ask AI to output a character map or JSON layout first.
  4. Check road connectivity, entrance reachability, water, and walls.
  5. Ask Codex to convert the layout into TileMapLayer.set_cell().
  6. Run it in Godot with collision and debug views enabled.
  7. Adjust decoration density last.

In one sentence:

Do not ask AI to “draw a beautiful scene” first. Ask it to design the structure first, then let code assemble the map using real tileset coordinates. That way, the result is much more likely to become a usable Godot map instead of just a nice concept image.

记录并分享
Built with Hugo
Theme Stack designed by Jimmy