One more DevLog! Two months after the last one, but I guess new entries will keep coming from now on… with more frequency! (Yep, no joke).
Today’s topic is an improved feature that I’ve been working on for a week: a brand new level generator for RogueCube.
We will start explaining the very essence of the problem. Our old generator worked with a kind of object that we called Wanderer, and its behaviour is quite easy to understand and also to implement.
One or multiple wanderers would be placed in the level, which is originally a grid filled with “Wall” cells. As they move in a random direction, they eat the content in the cell they are in, so it automatically becomes a “Floor” cell. When all wanderers end their moving loop, the level is ready to be drawn.
This system lets us create levels with to important characteristics: randomness and reachability (you can always go from any point A to other point B in the whole floor map). Also, it is very fast at execution.
However, it still has some problems, like our capability as developers to introduce manual features in a level, like hidden rooms, locked doors or handcrafted spaces like wide rooms or maze zones.
The solution for this problem is as simple as just repeating the process at a different scale: a metagrid is created, containing in each cell several cells of the normal level map grid.
At this point, a special wanderer will spawn in the same zone as the player does. ´While moving through its random path, “Room” metacells will be placed. The last metacell of the path will be used as the gate room for the next level.
In order to get a more organic look, “Near Room” cells will be placed randomly, which will contain sort of small rooms with rewards or weapons.
Finally, we set the connectivity map (white lines in the picture), which will guide the normal wanderers through their way to build the level. Any time a wanderer enters a different metagrid region, it will act in a different way to accomplish the level demands.
And that’s all. After the normal wanderers die, the level will be drawn and filled with enemies, weapons, loots, etc.
I cannot show you more screen captures yet, but RogueCube is looking better every day, I promise!
As always, thanks for reading. See you!
PJ – game designer and programmer.