GoRogue icon indicating copy to clipboard operation
GoRogue copied to clipboard

Rooms generator can allow only 1 room in tight spaces

Open Chris3606 opened this issue 6 years ago • 2 comments

In somewhat size constrained maps compared to the number of rooms, the current rooms generators allow a situation to occur where only 1 room of potentially many are placed, because the other rooms are generated in positions that overlap with existing ones up to max retries. Generally this is not a significant issue, however on size-constrained maps this can occur more often than it should, so some safeties should be put in place to attempt to prevent situations like this from occuring.

Chris3606 avatar Sep 26 '19 00:09 Chris3606

The issue here is ultimately it's impossible to eliminate this case entirely without what is technically the potential for an infinite loop of retrying. Ultimately, I'd like to add a few more layers of retrying, where if a percent of the rooms fail to place it scraps the map and starts over a time or two, then ultimately throws an exception or returns some sort of warning, however the last part of that would produce frustratingly compatibility breaking changes, as previously valid maps would start producing exceptions.

A current workaround for this is to simply increase the number of retries and use a MapAreaFinder to verify that there is a sufficient number of distinct areas. Given such a workaround exists, I'm thinking its best to wait for a more permanent fix until 3.0, when the breaking interface changes would be less of an issue.

Chris3606 avatar Dec 07 '19 16:12 Chris3606

Note: in 3.0, the class for room generation being referenced here is MapGeneration.Steps.RoomsGeneration.

This can now be solved by throwing RegenerateMapException if the overall placement result failed to place at least the minimum number of rooms.

Chris3606 avatar May 28 '22 14:05 Chris3606