Gridwright Start for $1

Dungeon Map Generator: Rooms, Caves and Game-Ready Maps

Generate dungeon, cave and overworld maps from a seed, with doors, a start, an exit and a boss room, then load them in Godot or Tiled with collision set.

Dungeon & Map Generator at work
Dungeon & Map Generator at work: Dungeon, cave and overworld maps.

You need levels. Not one, but twenty, or a new one every run because your game is a roguelike. So you open your map editor and start painting rooms by hand. The first dungeon is fun. By the fifth, every map has the same long corridor and the same square room in the corner, and you are still not sure the treasure room in the far left can even be reached.

So you look for a dungeon map generator. Most of them give you a nice picture. Then the real work starts: you trace it tile by tile into your engine, add collision to every wall, place the start, the exit and the enemies by hand, and do it all again for the next map.

This guide covers what makes a generated map usable, how the three common methods work, how seeds and tags control the result, and how to get the map into Godot 4 or Tiled with collision and spawn points already there.

What a game needs from a generated map

A picture of a dungeon is a start. A map a game can load needs all of this:

Dungeon & Map Generator in use
Dungeon & Map Generator in use. Every tool runs in your browser, nothing to install.
  • Everything reachable. Every floor tile can be walked to from the start, and no barrel or statue cuts a corridor in half.
  • A start, an exit and a goal. Stairs in, stairs out, and a boss room the player meets before the exit, not in a side branch.
  • Doors where rooms meet corridors, so the map reads as rooms and halls, not one big blob.
  • Rewards in the right places. Chests in dead ends give players a reason to explore the branches.
  • Collision. Walls and solid props must block the player in the engine, not only look solid.
  • Spawn points as data. The start, exit, boss, traps and treasure as positions your code can read.
  • The same seed, the same map. So you can keep a level you like, share it, or rebuild it after a change.

Miss one of these and you are back to fixing maps by hand.

Three ways to generate a map

Different places need different methods. Built rooms, natural caves and open land each have their own.

Dungeon & Map Generator in use
Dungeon & Map Generator in use. Every tool runs in your browser, nothing to install.

Dungeons: split the space, then fill it with rooms

The classic method is binary space partitioning (BSP). The map is cut in two, each half is cut again, and so on until the areas are room-sized. Each area gets one room, and corridors join neighbouring areas back up the tree. The result always has rooms of sensible sizes with no overlaps, and every room is connected.

A plain BSP dungeon can feel like a tree of dead ends. Adding a few extra connections, so players can walk in a loop instead of always backtracking, makes it play much better. Rooms don't have to be rectangles either: round rooms, cross-shaped rooms and halls with pillars break up the grid.

Caves: let the rock grow

Caves use cellular automata. Start with random noise, about half rock and half floor, then repeat one rule: a cell becomes rock if most of its neighbours are rock, and floor if most are floor. After a few rounds the noise settles into smooth, organic caverns.

The catch is that cellular automata leave small pockets cut off from the rest. A cave for a game has to fill those pockets or join them with tunnels, so the whole cave is one walkable space. For long, snaking caves, a different method works better: a "walker" that wanders and digs a tunnel as it goes.

Overworlds: height from noise

For open land, a noise function gives every tile a height. Low means deep sea, then shallow water, beach, grass, forest, hills and snowy peaks as the height rises. Rivers run downhill to the sea, and towns are joined by roads that cross rivers on bridges.

Seeds and tags: control without drawing

A seed is a word or number that fixes the random choices. The same seed always gives the same map, so a seed is a level you can save in one line of text. That is useful in more ways than it seems:

Dungeon & Map Generator in use
Dungeon & Map Generator in use. Every tool runs in your browser, nothing to install.
  • Keep the seeds of the maps you like as your game's handmade levels.
  • Give players a daily seed so everyone runs the same dungeon.
  • Ask a tester for the seed when they report a bug, and get the exact map back.

Tags push the generator in a direction without drawing anything. Typical ones are compact (tight, dense rooms), winding (long, twisting paths), water (lakes, pools or rivers), loops (extra connections), treasure (more chests) and traps (more spike traps). Change a tag, press for a new map, and the level's character changes with it.

Getting the map into your engine

This is where most generators stop and where the real time goes. A map file your engine already reads saves you the tracing.

Godot Starter - Top-Down RPG
Godot Starter - Top-Down RPG: A small Godot 4 action RPG to build on: sword, slimes, skeletons, chests, a key and a crypt. One of the 150 packs in Gridwright.

Godot 4

A generated Godot 4 scene can hold one TileMapLayer per layer (floor, water, walls, decoration), a TileSet with the walls on one physics layer and the water on another, and Marker2D nodes for the spawn points. Drop the scene into your level and the walls already collide.

Reading the spawns then takes a few lines. In our generator's scenes every marker sits under a Spawns node and carries a kind in its metadata (start, exit, boss, trap, treasure), so placing the player is:

func _ready() -> void:
	for marker in $Map/Spawns.get_children():
		if marker.get_meta("kind", "") == "start":
			$Player.global_position = marker.global_position

The same loop can put an enemy on every trap marker or a chest scene on every treasure marker.

Tiled

For Tiled, a generated map can come as a .tmx (XML) or .tmj (JSON) file with its tileset. Good Tiled output keeps the tile layers in drawing order, puts collision boxes on the solid tiles, and adds object layers for spawns, rooms and doors, so you can open the map, adjust a room by hand and keep painting with the same terrain sets.

A room graph for your game logic

Many roguelike rules need to know the structure, not only the tiles: which room is the start, how deep each room is, which corridor joins which rooms, and the critical path from the start to the exit. A JSON room graph gives you that. With it you can lock a door on the critical path and hide its key in a side room, scale enemies with depth, or put the shop one room off the main path.

Make a dungeon in seconds with the Dungeon & Map Generator

The Dungeon & Map Generator does every step above in one page:

Dungeon Tileset
Dungeon Tileset: 16x16 top-down pixel art dungeon tileset: wall autotiles, pits, doors, traps, animated torches. One of the 150 packs in Gridwright.
  1. Pick a mode (dungeon, cave or overworld) and a size, or type a seed.
  2. Press Enter for a new map. Shift+Enter gives the same seed again, Backspace goes back to the previous map.
  3. Turn tags on or off until the layout feels right. G shows the grid, R the room graph.
  4. Pick a tile theme and save the map.

Every map is checked before you see it: in dungeons and caves all floor is reachable from the start and no blocking prop cuts a path, and in overworlds the roads join every place on the main land. Dungeons get doors, stairs at the start and the exit, the boss room right before the exit, chests in the dead ends and spike traps, with corridors routed around rooms, never through them.

The free demo makes dungeons up to 64x64 and saves them as PNG, so you can test the layouts with your own eyes first: try it here. The full tool adds cave and overworld mode, maps up to 256x256, Tiled, Godot 4 and JSON export, your own tileset, and batches of up to 50 maps in one ZIP.

Your game, looking finished

Every Gridwright asset pack, made to fit together, and all 44 tools for the fiddly work, with every new release, for $17 a month. Try it in your own game first: 3 days for $1 with every tool and up to 10 packs. Cancel any time.

Start: 3 days for $1 See everything it includes

Use your own tiles

A generator's built-in tiles are fine for prototyping, but your game has its own look. Save the tileset template: it is the atlas of the current mode with every tile numbered and a list of what each tile is. Paint over it in your editor, keep the layout (16 tiles wide, any tile size from 8 to 64 pixels), and load it back. Every view and every export then uses your tiles at your tile size.

Autotile Builder: Complete autotile sets from a small template
Autotile Builder: Complete autotile sets from a small template. Included in Gridwright.

Walls and water use autotiles: 47 tiles per terrain, one for each pattern of neighbours, so corners and edges join on their own. If you haven't drawn a 47-tile set before, the Autotile Builder makes one from a small template.

Common problems

  • The cave has rooms you can't reach. The pockets weren't filled or joined. Use a generator that checks reachability, or flood-fill from the start and remove what it doesn't touch.
  • Every dungeon looks the same. Change the size and the tags, not only the seed. Loops and winding change how a level plays more than room count does.
  • The player starts inside a wall in the engine. Your tile size and the map's tile size differ. Export at your game's tile size, or scale the map node by whole numbers only.

Build your next level today

Open the Dungeon & Map Generator, press Enter a few times, and keep the seed of the first map you like. In a few minutes you have a level with its doors, spawns and collision, ready for your engine instead of a picture to trace.

Your game, looking finished

Every Gridwright asset pack, made to fit together, and all 44 tools for the fiddly work, with every new release, for $17 a month. Try it in your own game first: 3 days for $1 with every tool and up to 10 packs. Cancel any time.

Start: 3 days for $1 See everything it includes