Been building a roguelike in Godot 4 and went with classic BSP partitioning for dungeon gen because every tutorial points you at it. And yeah it works: no overlapping rooms, everything connects, reproducible from a seed. Technically correct.
But every dungeon layout feels kind of grid-brained. The recursive splits betray themselves in the final result. You get these obvious rectangular zones where rooms cluster together, connected by long corridors to the next partition. After a few runs the shape of the algorithm is completely legible in the output. Players probably can't articulate it but the layouts read as samey fast.
func _split(region: Rect2, depth: int) -> Array:
if depth == 0 or region.size.x < MIN_SIZE * 2 or region.size.y < MIN_SIZE * 2:
return [region]
var split_vertical = randf() > 0.5
var results = []
if split_vertical:
var split_x = randi_range(int(region.position.x + MIN_SIZE), int(region.end.x - MIN_SIZE))
results.append_array(_split(Rect2(region.position, Vector2(split_x - region.position.x, region.size.y)), depth - 1))
results.append_array(_split(Rect2(Vector2(split_x, region.position.y), Vector2(region.end.x - split_x, region.size.y)), depth - 1))
else:
var split_y = randi_range(int(region.position.y + MIN_SIZE), int(region.end.y - MIN_SIZE))
results.append_array(_split(Rect2(region.position, Vector2(region.size.x, split_y - region.position.y)), depth - 1))
results.append_array(_split(Rect2(Vector2(region.position.x, split_y), Vector2(region.end.x - region.position.x, region.end.y - split_y)), depth - 1))
return results
I've looked at alternatives. WFC seems like overkill for a simple room-and-corridor dungeon. Hand-designed prefab rooms with a connection graph sounds more interesting but I don't have the art pipeline to support it yet. There's also the approach of treating rooms as graph nodes first and generating corridors as edges after placement. Might avoid the 'everything is rectangles on top of rectangles' problem.
Has anyone actually switched away from BSP and felt like it changed how the dungeons played? Or is the real fix just adding more room shape variety and heavier decoration to mask the algorithmic structure?