BSP Procgen

Back to Welcome screen

Primarily inspired by Rogue Basin BSP article. Demonstrates procedural dungeon generation within a random Binary Space Partitioning.

  • the current scheme runs a BSP over the viewport bounds
  • with a random chance (that increases with BSP tree depth) to place a room within a region; rooms may be no smaller than 4 units in either dimension, must have at least a 25-tile area, and at most 108-tile area
  • all of those constraint dimensions are wall-inclusive, so the minimum width/height of 4 means at least 2 floor tiles
  • adjacent rooms have their shared walls simplified, granting more space to the smaller dimension, and placing a door randomly weighted towards the center
  • (adjacent blocks of) rooms then have connective hallways added; this mostly works, but sometimes disconnected components still remain...

Press @ to play through the level; press it again to toggle back to demo mode.

Press * to teleport to a different room randomly; useful in case you get stuck in a disconnected world.

Press <Backspace> to spin the RNG again and build a new world.

Press ^ to toggle an overlay that shows the chosen binary tree regions.