I am not overly worried about performance for that exact reason. Nevertheless, it's probably a good idea to keep it to a reasonable speed (say under 5s for a normal computer) anymore than that and it becomes very annoying to wait.
The main performance kick to number 2 is determining whether you've intersected something (and possibly adjusting values so that you don't)
The methodology would be when creating a room, check every other (every third?) square one beyond the perimeter, making sure to check all convex corners. If nothing is on those squares, then you're good to go. Then check every third grid in a matrix inside the room to make sure you haven't completely covered up a room. (assume 3 blocks is the minimum size for a room feature.)
If checking is a major pain, some improvement can be made by first sorting by size and then you only need to check the center point and the perimeter.
An alternative would be to figure out how big a space any randomly chosen location can handle, but I think I'd rather start out picking the room first and then trying to place it.
The main performance kick to number 2 is determining whether you've intersected something (and possibly adjusting values so that you don't)
The methodology would be when creating a room, check every other (every third?) square one beyond the perimeter, making sure to check all convex corners. If nothing is on those squares, then you're good to go. Then check every third grid in a matrix inside the room to make sure you haven't completely covered up a room. (assume 3 blocks is the minimum size for a room feature.)
If checking is a major pain, some improvement can be made by first sorting by size and then you only need to check the center point and the perimeter.
An alternative would be to figure out how big a space any randomly chosen location can handle, but I think I'd rather start out picking the room first and then trying to place it.
Comment