Problem description:
Making a procedural level generator, I keep running into the same roadblock if I try to make it less random and more specific.
Basically, if I pick a point on the map, I want to figure out how much space is available for a new feature - Or, at the very least, the largest rectangular area available without overlapping an existing room/hall. I've tried a few methods; the best two were sending out "Probes" in all 8 directions, and inflating a search "bubble" that fills the space (Up to a specified max room size). Nothing has really worked well for irregular spaces though.
Any thoughts on where to start going about this? Is there a library that covers a situation like this?
Copyright © 2025 BYOND Software.
All rights reserved.
For doing this quickly, I'd come up with a way of tracking rectangles of certain minimum sizes and keeping a list of those, then altering that list as new features were added.
For instance, say your entire level starts out as one big rectangle. After placing a room, you'd end up splitting that rectangle into four smaller overlapping rectangles around it. Every time you placed a new feature, you'd look at your existing rectangles and, if there was an overlap, split them up into smaller units. If any rectangles fall below the minimum width/height, you just remove them from the list.