Search Unity

Need help with connecting points in procedurally generated dungeons

Discussion in 'World Building' started by Roldo, Jul 23, 2019.

  1. Roldo

    Roldo

    Joined:
    Oct 25, 2014
    Posts:
    41
    I am currently making a dungeon generator for my game.
    The system is room-based. Rooms have doors and volume nodes. When generation starts, a start room is generated, then it chooses a new random room according to a few rules(the closer it comes to reaching target room amount, the higher the chance of single-door rooms)
    Then it connects the two rooms at fitting doors(it checks door sizes, whether the space is occupied and so on)
    Then it chooses a random door from global open door list and proceeds to generate next room.
    What it can do now is creating tree like dungeons.

    What im struggling to do is to create loops. I am currently redesigning the generator to work with chunks. Somewhat like this: it creates a grid-like pattern with chunks(cube shaped spaces), then creates doors between the chunks(doors are on the grid, doors can be generated randomly or in fixed places(depends on the chunk)), then it proceeds to generate local dungeons inside of the chunks.
    What i want it to do is to create loops(connecting 2 or more doors when i need it). The problem is that although the rooms are on the grid, their sizes and shapes are not defined and though i am struggling to think of an algorith that would connect specified doors.

    How can i go about doing it and are there any resources that would help me with it?