GenerateRandomSearch

Dungeon Layout Generator

Binary space partitioning splits the map in two, splits each half again, and keeps going until the pieces are room-sized. Then, as the recursion unwinds, it joins the two halves of every split with a corridor — which means every room is reachable by construction, not by a repair pass afterwards. The rooms come out pleasantly uneven, because an even split would just look like a grid.

What this generator does

Splits the map recursively, places a room in each final piece, and joins the two halves of every split with an L-shaped corridor as the recursion unwinds. It reports the room count, the corridor count and the range of room sizes.

How to use this tool

  1. Choose the map size and how many times to split.
  2. Read how many rooms and corridors came out.
  3. Look at the smallest and largest room to see how uneven the split was.
  4. Copy the map as text for a virtual tabletop.

Understanding the controls

Map size
Between 12 and 48 cells across. Larger maps give the splits more room before the pieces get too small to hold a room.
Split depth
Between 1 and 4. Each level roughly doubles the room count, and the generator stops splitting a piece that has become too small regardless.
Seed
Reproduces exactly the same layout, which is what a prepared session needs.

Common use cases

  • Dungeon floors for a tabletop session, guaranteed fully reachable
  • Showing how binary space partitioning produces layouts
  • Test maps for pathfinding or room-graph code
  • Battle maps with distinct rooms rather than open caves
  • Reproducing the same dungeon from a seed

How this generator works

Each split cuts between 35% and 65% of the way across, which keeps the pieces uneven without producing slivers. Corridors join the centres of the two halves at every level, so connectivity follows from the recursion. The check confirms every room is actually carved into the grid and that a flood fill reaches every open cell.

Randomness and fairness

The split positions and the room placements are random; connectivity is structural. Seeded dungeons reproduce exactly and are therefore explicitly not cryptographically secure, and unseeded ones use the browser's cryptographically secure generator.

For how randomness is produced across the whole site, see how Generate Random works.

Limitations and good to know

  • Corridors are L-shaped and can pass through other rooms, which makes some layouts more open than intended.
  • No doors, secret passages, stairs or multi-level structure.
  • Rooms are always rectangular — irregular rooms are the cave generator's territory.
  • Content is not placed; this generates the layout only.
  • Layouts are not stored between visits.

Privacy and your data

The dungeon is generated in your browser. Nothing about the layout or your seed leaves the page.