Self-Expanding Dungeon

Generate an interconnected maze of dark stone rooms, carpeted floors, and soul lantern lighting that branches outward from a glowing central core.

Java EditionComplex Contraptions & CinematicsHard20 commandsTested on a real 26.2 & 26.3 server
An overhead view of a self-expanding dungeon with dark stone walls, glass roofs, and cyan interiors. Download the GIF Video & GIF © www.9minecraft.net

Self-building StructuresDarkMedievalCyanBlackBuilding ToolAdventure MapMap MakingBlock displaysBlock building (fill/setblock/clone)13-20 commands

The Self-Expanding Dungeon uses invisible marker entities to automatically generate an interconnected maze of dark stone rooms, cyan carpeted floors, and hanging soul lanterns. Starting from a glowing central core, builder nodes branch out along a 5-block grid in all four cardinal directions, carving archways between adjacent chambers and leaving the ceiling coated in glass so you can watch the interior maze take shape.

Each newly spawned room bursts with soul fire and glowing cyan particles while floating builder nodes pulse above the chambers, turning a flat platform into a full dungeon layout in seconds.

1. Setup - type these once 6 commands

  1. /scoreboard objectives add c9_t dummy
  2. /fill ~-17 ~ ~-17 ~17 ~8 ~17 air
  3. /fill ~-17 ~-1 ~-17 ~17 ~-1 ~17 polished_deepslate
  4. /summon marker ~ ~ ~ {Tags:["c9_core"]}
  5. /summon marker ~ ~ ~ {Tags:["c9_b"]}
  6. /summon block_display ~-0.5 ~2.5 ~-0.5 {Tags:["c9_d"],Glowing:1b,glow_color_override:5636095,block_state:{Name:"minecraft:sea_lantern"}}

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

  1. /scoreboard players add @e[tag=c9_core] c9_t 1
  2. /execute if score @e[tag=c9_core,limit=1] c9_t matches 15.. run scoreboard players set @e[tag=c9_core] c9_t 0
  3. /execute as @e[tag=c9_b] at @s run particle dust{color:[0.0,0.95,1.0],scale:1.6} ~ ~2.2 ~ 0.6 0.4 0.6 0 4 force
  4. /execute if score @e[tag=c9_core,limit=1] c9_t matches 1 as @e[tag=c9_b] at @s run fill ~-2 ~-1 ~-2 ~2 ~3 ~2 deepslate_bricks hollow
  5. /execute if score @e[tag=c9_core,limit=1] c9_t matches 1 as @e[tag=c9_b] at @s run fill ~-1 ~3 ~-1 ~1 ~3 ~1 cyan_stained_glass
  6. /execute if score @e[tag=c9_core,limit=1] c9_t matches 1 as @e[tag=c9_b] at @s run fill ~-1 ~ ~-1 ~1 ~ ~1 cyan_carpet
  7. /execute if score @e[tag=c9_core,limit=1] c9_t matches 1 as @e[tag=c9_b] at @s run setblock ~ ~2 ~ soul_lantern[hanging=true]
  8. /execute if score @e[tag=c9_core,limit=1] c9_t matches 1 as @e[tag=c9_b] at @s run particle soul_fire_flame ~ ~1.5 ~ 1.2 0.8 1.2 0.05 35 force
  9. /execute if score @e[tag=c9_core,limit=1] c9_t matches 2 as @e[tag=c9_b] at @s if block ~ ~ ~4 cyan_carpet run fill ~-1 ~ ~2 ~1 ~2 ~3 air
  10. /execute if score @e[tag=c9_core,limit=1] c9_t matches 2 as @e[tag=c9_b] at @s if block ~4 ~ ~ cyan_carpet run fill ~2 ~ ~-1 ~3 ~2 ~1 air
  11. /execute if score @e[tag=c9_core,limit=1] c9_t matches 3 as @e[tag=c9_b,limit=2,sort=random] at @s positioned ~5 ~ ~ if entity @e[tag=c9_core,distance=..15] unless entity @e[tag=c9_b,distance=..2] run summon marker ~ ~ ~ {Tags:["c9_b"]}
  12. /execute if score @e[tag=c9_core,limit=1] c9_t matches 3 as @e[tag=c9_b,limit=2,sort=random] at @s positioned ~-5 ~ ~ if entity @e[tag=c9_core,distance=..15] unless entity @e[tag=c9_b,distance=..2] run summon marker ~ ~ ~ {Tags:["c9_b"]}
  13. /execute if score @e[tag=c9_core,limit=1] c9_t matches 3 as @e[tag=c9_b,limit=2,sort=random] at @s positioned ~ ~ ~5 if entity @e[tag=c9_core,distance=..15] unless entity @e[tag=c9_b,distance=..2] run summon marker ~ ~ ~ {Tags:["c9_b"]}
  14. /execute if score @e[tag=c9_core,limit=1] c9_t matches 3 as @e[tag=c9_b,limit=2,sort=random] at @s positioned ~ ~ ~-5 if entity @e[tag=c9_core,distance=..15] unless entity @e[tag=c9_b,distance=..2] run summon marker ~ ~ ~ {Tags:["c9_b"]}

How it works

Frames from the test run

Self-Expanding Dungeon - frame 1Self-Expanding Dungeon - frame 2Self-Expanding Dungeon - frame 3

Recorded on our own test server: 59 frames at about 9.7 fps. Our image check saw: A grid of dark stone rooms with glass ceilings and cyan floors automatically expands across a stone platform.

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. Clear a flat 35x35 area and stand in the exact centre where you want the dungeon core to begin.
  2. Run the 6 setup commands in chat or in an impulse command block to create the scoreboard timer, base floor, central core marker, and initial builder marker.
  3. Place 14 repeating command blocks in a chain or cluster nearby, set them all to Always Active, and paste one loop command into each block.
  4. Watch the dungeon rooms automatically branch out every 0.75 seconds, laying carpets, hanging lanterns, and carving doorways between adjacent chambers.
  5. When the maze fills the 30x30 perimeter around the core, it automatically stops expanding so entity counts stay low.

Use it with real players

To let a player trigger a dungeon expansion wherever they throw an item or stand, summon the c9_core and initial c9_b markers at @p instead of ~ ~ ~. You can also increase the distance=..15 check on the last four loop commands to distance=..35 for a much larger labyrinth.

Remove it again 6 commands

  1. /kill @e[tag=c9_core]
  2. /kill @e[tag=c9_b]
  3. /kill @e[tag=c9_d]
  4. /scoreboard objectives remove c9_t
  5. /fill ~-17 ~ ~-17 ~17 ~8 ~17 air
  6. /fill ~-17 ~-1 ~-17 ~17 ~-1 ~17 grass_block

FAQ

Why doesn't the dungeon expand forever and lag the server?

The four branching commands check if entity @e[tag=c9_core,distance=..15] before summoning a new node, capping the dungeon at a 7x7 grid of rooms (at most 49 lightweight marker entities).

Can I change the room size or block palette?

Yes! Change deepslate_bricks, cyan_carpet, and cyan_stained_glass in the loop commands to any blocks you prefer, as long as the doorway check in commands 9 and 10 matches the new floor carpet block.

Commands used

/execute/fill/particle/scoreboard/setblock/summon

Similar creations

Join 9Minecraft News & Guides