Random dungeons generation

posted in ProjectW for project ProjectW
Published September 07, 2020
Advertisement

Hey everyone !

Following my preceding work on random worlds generation (see here, here and here), I decided to experiment with random dungeons generation. There exist different approachs for this in the wild, depending on the type of results you are looking for. You can either go for something with a lot of long halls/corridors connecting various rooms, like dungeon generators for tabletop RPG (see for example here). Or you could go for something that put rooms side by side, giving something more in the vein of DunGen for example.

I wanted an old-school feel, so I decided to go with something closer to the first solution. The good news is that it also kind of fit really well within my framework. Indeed, all I had to do was to distribute rooms as Points of interest using a Poisson disk sampler (see here). Then, I can generate paths between them using A* as before, but switching from Euclidean distance to Manhattan distance for generating my heuristic weight. This allows me to get straight corridors. Using my modified Kruskal algorithm, I can control the density of corridors, always having at least all rooms connected. Moreover, it was easy to add the possibility to my ground generating algorithm to generate also meshes in addition to the ground sprites, so that I get walls.

Here is the result:

I like the fact that some rooms are actually bigger than the minimal distance between spawn points, so that sometimes you get multiple rooms merged together. Also note that I spawn some path connection points, giving nice crossings between corridors. All this could of course be tweaked depending on the results you want. For example, I can replace the poisson disk distribution with a regular one, giving aligned rooms:

Or we could go for something in-between, by using the regular distribution with a bit of jittering:

In addition, I added to possibility to put spawn points within point of interests, so that I can distribute entities within the rooms. For example, in the room below, I have a spawn point of type “monstersRoom1” which can spawn different amounts of monsters (that I killed already) or even a mini-boss. I also have multiple spawn points of type “smallFurnitures” which can spawn either a barrel, a chest or some bags, and two spawn points of type "floorFurnitures” to spawn rugs:

Finally, I took advantage of my random ground generation to also add some cool “destroyed” parts:

And here is a video of the result (with the Poisson disk distribution):

I still need to create a lot of assets to fill the rooms, and I think the result will be cool. I'll also try to experiment with a notion of distance from the entrance the generates more dangerous rooms (like a boss room). I think that since I use a cellular automata for ground generation, I'll be able to generate cool looking caves (with the path generation ensuring all my points of interest are connected :D).

PS: grounds and wall textures are from SzadiArt.

0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement
Advertisement