Dungeon Generator: Random Seeded Dungeon Maps
Pick a map size, a layout algorithm and a seed, and get a tile-based dungeon with a start, an exit, chests and enemy spawn points, every floor tile reachable. The same seed and settings always rebuild the same map, and you can download it as a PNG, as JSON or CSV for any engine, or as a GDScript file that paints it into a Godot TileMapLayer.
How to use it
- Choose Small, Medium or Large and a density of Sparse, Balanced or Dense, then press Next.
- Choose Rooms and corridors, BSP rooms or Caves, then press Next.
- Type a seed or press Random seed (leave it empty for a new map every time), tick Chests and Enemies if you want them, and press Generate dungeon.
- Press New seed to roll another map with the same settings, or Copy seed to keep this one.
- Download the PNG, Godot script (.gd), JSON or CSV, or press Copy Ziva prompt to turn the map into a playable level.
Rooms and corridors vs BSP vs cellular automata
Rooms and corridors drops rectangles at random spots and throws away any that overlap. The room centers are then joined with a minimum spanning tree, the shortest set of corridors that links every room, using L-shaped corridors. A tree has no loops, so the generator adds a few extra short corridors to give players more than one route and fewer long backtracks.
BSP (binary space partitioning) cuts the map in two, then cuts each half again until the pieces reach a minimum size. Each piece gets one room, and each pair of sibling pieces is joined by a corridor. Rooms never overlap and spread evenly over the map, which suits structured places like castles, prisons and offices.
Cellular automata start from random noise and smooth it a few times: a tile becomes rock when 5 or more of its 8 neighbors are rock and opens up when 3 or fewer are. Isolated pockets are filled in so only the largest cave remains. The result is organic caverns with no rooms or doors, good for mines, sewers and natural caves. In this generator, density sets how much rock the noise starts with.
Why dungeon seeds matter
A seed is the starting number for a pseudo-random number generator. This tool uses mulberry32, a small 32-bit generator, so a seed from 0 to 4294967295 with the same size, density and layout always produces the same rooms, corridors and markers. Chests and enemies use their own random stream, so switching them off never changes the map.
Seeds are how roguelikes offer daily challenges and shareable runs: players swap a number instead of a level file. They also make bugs reproducible, because a tester can report the seed of the map that broke. If your own game regenerates levels at runtime, it needs the same algorithm, not just the same seed, which is why this tool exports the finished tiles instead of only the number.
How to use the dungeon in Godot
The .gd export targets TileMapLayer, which was added in Godot 4.3; the older TileMap node is deprecated in favor of TileMapLayer nodes. Add a TileMapLayer to your scene, give it a TileSet with an atlas of your floor, wall and door tiles, and attach the downloaded dungeon_<seed>.gd script to it.
In the Inspector, set source_id to the ID of your atlas in the TileSet panel and set floor_atlas_coords, wall_atlas_coords and door_atlas_coords to the column and row of each tile in the atlas, counting from 0 at the top left. When the scene runs, the script calls set_cell(coords, source_id, atlas_coords) for every floor, wall and door tile in the embedded map.
The script also holds START, EXIT, CHESTS and ENEMIES as cell coordinates. TileMapLayer.map_to_local(START) returns the center of the start cell in the layer's local space, which is where to put your player. Empty tiles are left unset, so the area outside the walls stays clear.
Frequently asked questions
Is the dungeon generator free?
How do I get the same dungeon again?
Can I use the dungeon in Godot, Unity or Unreal?
Which layout is best for a roguelike?
Can every room be reached?
More free game dev tools
- Boss Name Generator: Boss names with a title, an arena and a fight mechanic.
- Game Idea Generator: Random game ideas from a genre, setting, mechanic, goal and twist.
- Sprite Sheet Generator: Pack animation frames into one sprite sheet PNG with JSON and a Godot SpriteFrames file.