Procedural Dungeon Generator

Turn a flat stage into an automated dungeon factory where a glowing conduit drone carves out random multi-room stone brick layouts in real time.

Java EditionComplex Contraptions & CinematicsExpert24 commandsTested on a real 26.2 & 26.3 server
A glowing drone sits inside the initial stone brick room on a dark slate platform. Download the GIF Video & GIF © www.9minecraft.net

Self-building StructuresMedievalTechnologyDarkCyanBlueBlackBuilding ToolMap MakingAdventure MapItem displaysSmooth animation (interpolation)Block building (fill/setblock/clone)21+ commands

Building dungeons by hand takes hours, so why not let an algorithm do the heavy lifting? This command creation turns a flat platform into an automated dungeon factory. Every few seconds, the stage wipes clean onto a dark slate floor and deploys a glowing architectural drone at the center.

The drone rapidly steps across a grid in random directions, building stone brick chambers, punching doorways between connected rooms, and dropping sea lanterns and spawners along its path. Because the rooms have an open-roof cutaway design, you can watch the entire labyrinth assemble itself from above.

1. Setup - type these once 8 commands

  1. /scoreboard objectives add c9_t dummy
  2. /summon marker ~ ~ ~ {Tags:["c9_gen","c9_ctrl"]}
  3. /scoreboard players set @e[tag=c9_ctrl] c9_t 0
  4. /summon marker ~5 ~ ~ {Tags:["c9_gen","c9_dir"]}
  5. /summon marker ~-5 ~ ~ {Tags:["c9_gen","c9_dir"]}
  6. /summon marker ~ ~ ~5 {Tags:["c9_gen","c9_dir"]}
  7. /summon marker ~ ~ ~-5 {Tags:["c9_gen","c9_dir"]}
  8. /summon item_display ~ ~2.5 ~ {Tags:["c9_gen","c9_orb"],Glowing:1b,glow_color_override:65535,item:{id:"minecraft:conduit",count:1},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[2.0f,2.0f,2.0f],translation:[0f,0f,0f]},teleport_duration:2}

2. Loop - one repeating command block each (Always Active) 16 commands

  1. /scoreboard players add @e[tag=c9_ctrl] c9_t 1
  2. /execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 1 run fill ~-16 ~ ~-16 ~16 ~5 ~16 air
  3. /execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 1 run fill ~-16 ~-1 ~-16 ~16 ~-1 ~16 deepslate_tiles
  4. /execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 2 run tp @e[tag=c9_orb] ~ ~2.5 ~
  5. /execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 2 run fill ~-3 ~-1 ~-3 ~3 ~2 ~3 stone_bricks
  6. /execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 2 run fill ~-2 ~ ~-2 ~2 ~2 ~2 air
  7. /execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 2 run setblock ~ ~-1 ~ sea_lantern
  8. /execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 5..85 run tag @e[tag=c9_dir,sort=random,limit=1] add c9_pick
  9. /execute at @e[tag=c9_orb] at @e[tag=c9_pick,limit=1] run summon marker ~ ~ ~ {Tags:["c9_gen","c9_step"]}
  10. /execute at @e[tag=c9_step] if block ~ ~-3 ~ deepslate_tiles run fill ~-3 ~-3 ~-3 ~3 ~ ~3 stone_bricks
  11. /execute at @e[tag=c9_step] if block ~ ~-3 ~ stone_bricks positioned ~ ~-2.5 ~ run fill ~-2 ~ ~-2 ~2 ~2 ~2 air
  12. /execute at @e[tag=c9_step] if block ~ ~-3 ~ stone_bricks run tp @e[tag=c9_orb] ~ ~ ~
  13. /execute at @e[tag=c9_orb] run particle soul_fire_flame ~ ~ ~ 0.6 0.6 0.6 0.05 4 force
  14. /tag @e[tag=c9_pick] remove c9_pick
  15. /kill @e[tag=c9_step]
  16. /execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 115 run scoreboard players set @e[tag=c9_ctrl] c9_t 0

How it works

Frames from the test run

Procedural Dungeon Generator - frame 1Procedural Dungeon Generator - frame 2Procedural Dungeon Generator - frame 3

Recorded on our own test server: 57 frames at about 9.4 fps. Our image check saw: A dark slate platform with a single stone brick room in the center containing a glowing cyan drone emitting blue flame particles.

Commands, video and screenshots: tested and recorded by www.9minecraft.net © 9Minecraft. Sharing a video or screenshot? Please credit www.9minecraft.net.

Build it in your world

  1. Find or build a flat area at least 35x35 blocks wide.
  2. Stand in the exact center of the area and run each of the 8 setup commands in chat.
  3. Place a repeating command block below the stage and set it to Always Active.
  4. Chain 15 chain command blocks (Always Active, Unconditional) onto the repeating block.
  5. Paste the 16 loop commands in order into the repeating and chain command blocks. Note: make sure the command blocks execute positioned at the stage center!
  6. Watch the glowing drone carve out a new procedural dungeon every 6 seconds.

Use it with real players

To trigger a dungeon build manually whenever a player drops a compass instead of looping forever, remove the last loop command (which resets c9_t at 115) and replace it with: /execute as @e[type=item,nbt={Item:{id:"minecraft:compass"}}] run scoreboard players set @e[tag=c9_ctrl] c9_t 0 followed by killing the dropped compass item.

Remove it again 4 commands

  1. /kill @e[tag=c9_gen]
  2. /scoreboard objectives remove c9_t
  3. /fill ~-16 ~ ~-16 ~16 ~5 ~16 air
  4. /fill ~-16 ~-1 ~-16 ~16 ~-1 ~16 grass_block

FAQ

Why do the rooms have no roofs?

The generator builds cutaway walls 3 blocks high so you can easily look down inside the dungeon rooms as they generate. You can add a ceiling by increasing the Y height in loop command 10 and keeping the top layer intact in command 11.

How does the drone stay inside the platform without using coordinate math?

Before building a room or moving the drone, loop command 10 checks if there is a deepslate_tiles block directly underneath the target step. Since the deepslate floor is only 33x33 blocks wide, the drone naturally refuses to step off the edge.

Commands used

/execute/fill/kill/particle/scoreboard/setblock/summon/tag/tp

Similar creations

Join 9Minecraft News & Guides