Problem with procedurally generated map


The main problem of this week's development process apparently is generating random map. When I was testing on the procedural map generation, I faced a problem of how to connect rooms with each other. The easiest solution I can think of is using a 2d array to generate the map, and make each room a perfect sqaure shape. But this approach makes the map looks too neat, and I don't really likes it. Here are some generated result:

Another approach I attempted is to make different room prefabs, and each of them has one ore more doors, and after I recorded each door's position, I can connect them by simply using the position of the doors. The result looks like this:

However as showed above simply choose a room prefab from the list can cause the rooms overlap with each other. So what I did is that I combined the 2D array version with this one to make the rooms only generate towards forward direction to make them separate as much as possible. The result looks like this:

They now look better but still there are chances of overlapping. But it can be easily solve that by making room prefabs take similar spaces. There are much more advanced and better random room generating algorthems, but this one is the easiest I can think of.

Author: Zeyuan Song

Posted on 04/12/2024

Get Suits of the Abyss

Leave a comment

Log in with itch.io to leave a comment.