Randomly-Generated Dungeons
Weezil_Of_Mods
28 Sept 2013, 19:26Well, I'm planning on creating a traditional dungeon-crawling game, in which the map will randomly generate itself, choosing randomly from a list of pre-built rooms. Now, here's my plan for doing this:
I make a series of rooms, each with between 2-4 exits. Since I know that making it randomly choose a room when going through an exit can attach a north and an east exit, or something equally disorienting, I figure that I micro-manage each room so that each individual exit chooses from a list of rooms that have an exit that is in line with it, i.e. east lines with west, north with south. In my mind, by doing this, it will build a coherent and easily-followed path in which backtracking won't become a pain for the player.
There will be seven floors, with a boss guarding the exit to the next floor. Now, in order to make sure that the first floor doesn't exit to the fifth, which exits to the second, and so on, I figure that I would make several copies of the list of rooms, each one for a specific floor, and with a bit more tweaking, make it so only floor-one rooms seek floor-one rooms, and et cetera.
Now, I am fairly certain that I know how to do this. It would involve making the rooms first, with the exits that run if-then scripts to randomly select a room (i.e. 50% chance to enter a hallway, 50% chance to enter a boss fight).
But here's my dilemma. If there's only one room of each type per floor list (i.e. one floor-one hallway, one floor-one corner, etc...), and the game randomly chooses a room already in use, it will modify the exits of that room, and therefore make backtracking hell, which is not what I want. Now, I figure making several copies of the same room for each floor, while not very convenient, might work. Also, making each if-then script check for a boolean attribute that each room has which defines the room as "in-use" may help so that it doesn't use a room currently in use.
But another dilemma is the backtracking itself. What is stopping the game from randomly choosing another room when I go through the exit I just came through. I don't want it so that I enter an intersection from a hallway, turn around, go through the same exit and then enter the final boss room. I want a definite build so that the player can backtrack and follow alternate paths. This is where I am at a loss for ideas.
So how to I keep the rooms from constantly shifting behind the player? Any help would be appreciated.
I make a series of rooms, each with between 2-4 exits. Since I know that making it randomly choose a room when going through an exit can attach a north and an east exit, or something equally disorienting, I figure that I micro-manage each room so that each individual exit chooses from a list of rooms that have an exit that is in line with it, i.e. east lines with west, north with south. In my mind, by doing this, it will build a coherent and easily-followed path in which backtracking won't become a pain for the player.
There will be seven floors, with a boss guarding the exit to the next floor. Now, in order to make sure that the first floor doesn't exit to the fifth, which exits to the second, and so on, I figure that I would make several copies of the list of rooms, each one for a specific floor, and with a bit more tweaking, make it so only floor-one rooms seek floor-one rooms, and et cetera.
Now, I am fairly certain that I know how to do this. It would involve making the rooms first, with the exits that run if-then scripts to randomly select a room (i.e. 50% chance to enter a hallway, 50% chance to enter a boss fight).
But here's my dilemma. If there's only one room of each type per floor list (i.e. one floor-one hallway, one floor-one corner, etc...), and the game randomly chooses a room already in use, it will modify the exits of that room, and therefore make backtracking hell, which is not what I want. Now, I figure making several copies of the same room for each floor, while not very convenient, might work. Also, making each if-then script check for a boolean attribute that each room has which defines the room as "in-use" may help so that it doesn't use a room currently in use.
But another dilemma is the backtracking itself. What is stopping the game from randomly choosing another room when I go through the exit I just came through. I don't want it so that I enter an intersection from a hallway, turn around, go through the same exit and then enter the final boss room. I want a definite build so that the player can backtrack and follow alternate paths. This is where I am at a loss for ideas.
So how to I keep the rooms from constantly shifting behind the player? Any help would be appreciated.
The Pixie
28 Sept 2013, 19:45If I was doing it, I would generate all the rooms on a level as the player hits that level. Once they are created, they exist like any other location in Quest, so back-tracking should be no problem. I would have a grid, with a room potentially at each point on the grid, and a random chance of there being a connection between two adjacent rooms (i.e., a pair of exits between them). Should be possible to have a map too, using the Quest map facility.
Randomly generate the description and contents of a room too. The shape of the grid can be random too (square, T, L, etc.).
Randomly generate the description and contents of a room too. The shape of the grid can be random too (square, T, L, etc.).
HegemonKhan
28 Sept 2013, 20:27here's some links (basically just ask Jayna, about or for help on, map designing+coding, lol):
(Jayna has coded, and can code, random generation of 3D grids~maps!)
(see the links below of Jayna's work)
(HK isn't ready yet to even attempt to understand this yet, sighs)
(I tried, but it's too much for me, I'll have to gradually learn this)
viewtopic.php?f=10&t=3852
viewtopic.php?f=10&t=3832
viewtopic.php?f=10&t=3885
viewtopic.php?f=18&t=3886
viewtopic.php?f=18&t=3214
viewtopic.php?f=18&t=3546
basically, using an "if" (conditional script+expression) the "flag=true" (boolean attribute), and~or "firsttime~otherwise" (conditional script+expression).
http://quest5.net/wiki/Firsttime
http://quest5.net/wiki/Otherwise
http://quest5.net/wiki/OnEnterRoom
(Jayna has coded, and can code, random generation of 3D grids~maps!)
(see the links below of Jayna's work)
(HK isn't ready yet to even attempt to understand this yet, sighs)
(I tried, but it's too much for me, I'll have to gradually learn this)
viewtopic.php?f=10&t=3852
viewtopic.php?f=10&t=3832
viewtopic.php?f=10&t=3885
viewtopic.php?f=18&t=3886
viewtopic.php?f=18&t=3214
viewtopic.php?f=18&t=3546
weezil wrote:So how to I keep the rooms from constantly shifting behind the player? Any help would be appreciated.
basically, using an "if" (conditional script+expression) the "flag=true" (boolean attribute), and~or "firsttime~otherwise" (conditional script+expression).
http://quest5.net/wiki/Firsttime
http://quest5.net/wiki/Otherwise
http://quest5.net/wiki/OnEnterRoom
Weezil_Of_Mods
29 Sept 2013, 00:21The Pixie wrote:If I was doing it, I would generate all the rooms on a level as the player hits that level. Once they are created, they exist like any other location in Quest, so back-tracking should be no problem. I would have a grid, with a room potentially at each point on the grid, and a random chance of there being a connection between two adjacent rooms (i.e., a pair of exits between them). Should be possible to have a map too, using the Quest map facility.
Randomly generate the description and contents of a room too. The shape of the grid can be random too (square, T, L, etc.).
What that sounds like to me, though, is that the room layout is fixed, but the exits are randomly generated. Albeit not exactly what I was looking for, that sounds like a working method.
Now if only I understood maps, hehe.