Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We want to generate a map with connected free space and "interesting" terrain such as multiple paths and challenging routing. However, none of the methods so far was perfect.
Now we introduce yet another map generation mode called "Rooms".
The algorithm
It is named "Rooms" because the objective is to produce rooms connected with corridors.
First, we generate a set of room "seeds" in a grid pattern. Note that each room is colored by different label in the visualization below because they are disconnected.
Second, we generate connection between rooms.
There are many ways to do this, but in our case, we start from the center and explore ramdonly outwards, similar to Dijkstra algorhtm.
Third, expand some of the rooms to introduce some variation of space.
Fourth, modulate the room positions randomly to add some variation.
Finally, add some Perlin noise to add even more variety and natural looking style.
It can auto-scale as the map resolution increases, but there is a practical limit where the map gets too big that the game won't finish in reasonable time. That said, it's cool to see many agents can navigate this huge maps in real time.