Dungeon Generation Methods

I studied a good dungeon algorithm, but I ran into several problems. I am trying to make a mixture between the Kingdom of the Mad God and the caterpillar of the dungeon. My design was corridors that are separated from each other with added rooms, in which monsters are added. So far I have created a dungeon generator based on this algorithm: http://www.roguebasin.com/index.php?title=Dungeon-Building_Algorithm . My first problem is that since my corridors do not have a width of 1 time, they are often cut off from each other, which is not the intended effect.

You can see what I'm talking about here .

I was thinking that I could have changed the generation so that he stored the fragments in the list of arrays so that he could use it to find how each pass should connect, I also thought about trying to use a different algorithm, but I hesitate because it would be wasteful not to try to fix it first. Any tips are helpful as I'm relatively new to this!

Take a note. There must be a special room in which the player appears and the boss's room. In terms of this, I'm not sure how to always be sure that these rooms are connected together, maybe the last generation after everything else is done?

+5
source share
2 answers

Perhaps a simpler (but not complete) solution would be to store some metadas of each "room / function" that you created. If you choose a wall at the end of the corridor, since placing any new function excludes the β€œcorridor” as a real function.

This will not solve every inconsistency of the map, and if you have two different corridors (wider and narrower), you will never see the corridor getting wider or narrower, but this is a simple fix and a fairly quick fix.

Of course, there are ways to better solutions, but I would need to get more detailed information about this algorithm. For what I see in the link, you sent what it does is to select the wall plate as the placement and put a function on it. Maybe when choosing a placement you do not need to look only at the wall tile, which is chosen randomly, but for the entire solid wall around it:

  • Choose a random function (corridor in the example for assembly)
  • Choose a random wall tile somewhere
  • You will learn from each function how great its discovery is.
  • Compare if there are enough tiles for the tile (or to the right) to accurately place your hole, if not, select the wall up / to the right of the original selections and try again. You can get into a scenario where this is not possible, you can start all from point 1 and try again.

This is just above my head, of course, there are other solutions. But it may be good enough to get you started.

0
source

I was thinking about using a pseudo-random number generator, like mersenne twister, to search for random directions and then create rooms from a central point. If there are no collisions, you can create a room and then randomly choose a different direction. When you build your center point, the result will not be a direct connection.

0
source

Source: https://habr.com/ru/post/1202895/


All Articles