I've been thinking a lot on how to best write the dungeon generation for pyrel. In keeping with the spirit, the goal would be to improve on how the generation algorithm handles certain things so that the client (i.e. programmer) has more flexibility in determining the dungeon style.
My basic ideas is that each dungeon feature should have an associated power rating and an associated rarity (or strangeness) rating. A greater vault would have both a high power and rarity rating, while a bizarre empty room might have a large rarity rating but a low power. Conversely, a OoD monster or a unique could have a high power but a low rarity. Bog-standard features like normal rooms, corridors and doors have 0 for both.
At the beginning of each level, the RNG rolls for both rarity and power and those rolls determine the features. This gives the client the capability of tweaking the dungeon in fundamental ways with very simple changes. I envision the power rating to be very highly tied to dungeon levels and the rarity rating to have a much weaker dependence. I could also envision the capability of gradually reducing the power of a level each time it's visited to encourage deeper exploration, but that's an entirely different conversation. The point is that the capability would be there.
The basic algorithm goes like this.
For 1. currently the dungeon templates are town, normal, cavern and labyrinth. I plan to subsume caverns and labyrinths as large scale sub-features of a level as opposed to their own type. However, this step is useful for differentiating the town from the dungeon in V and for differentiating different types of dungeon maps (overland, mountain, different dungeons) in variants. Since the rarity rolls could conceivably depend on dungeon templates, I move the rolls to the second step.
2 has been explained already.
One of the current drawbacks of dungeon generation is that features are often limited by whether or not they fit. In step 3 we place the largest features as the first features in the dungeon. This way we can ensure that you get a GV if one is called for. The main advantage is not to make GVs more common, but to give the client the capability of setting their frequency in a very transparent manner. I'm envisioning High rarity, low power levels to get a cavern. High rarity, medium power levels to get a labyrinth and High rarity, high power levels to get a GV.
For 4, I lumped a lot of thing together but you can imagine further stratification. You can first check for MVs, then LVs, then pits and nests if you want. I'm not sure this stratification is necessary right now, but it would be useful if you have some features that are much larger than others.
5 is how you get somewhat interesting dungeons with low power levels. This way the first 10 levels can still have interesting features instead of the current boring situation. These would be the rooms in room_template.txt as well as the moated rooms, the cross rooms, the circle rooms, the double rooms, the pillared rooms and all the other non-standard rooms.
6 is how you satisfy a high power low rarity dungeon. Basically this looks like a normal dungeon except it's chock full of dangerous monsters and awesome loot.
7,8,9 finish out dungeon generation similar to what's done in V.
I was going to go into more details about how to pick features based on the rolls, but my lunch break is over. Maybe later tonight.
My basic ideas is that each dungeon feature should have an associated power rating and an associated rarity (or strangeness) rating. A greater vault would have both a high power and rarity rating, while a bizarre empty room might have a large rarity rating but a low power. Conversely, a OoD monster or a unique could have a high power but a low rarity. Bog-standard features like normal rooms, corridors and doors have 0 for both.
At the beginning of each level, the RNG rolls for both rarity and power and those rolls determine the features. This gives the client the capability of tweaking the dungeon in fundamental ways with very simple changes. I envision the power rating to be very highly tied to dungeon levels and the rarity rating to have a much weaker dependence. I could also envision the capability of gradually reducing the power of a level each time it's visited to encourage deeper exploration, but that's an entirely different conversation. The point is that the capability would be there.
The basic algorithm goes like this.
- Choose dungeon template (see below)
- Roll for power/rarity
- Place large features (GVs, labyrinths, caverns) if justified by rolls.
- Place smaller features (MVs, LVs, pits nests) if justified by rolls.
- Fill up remaining allotment for strangeness with abnormal rooms.
- Fill up remaining allotment for power with OoD monsters and items.
- Make remaining normal rooms
- Make corridors for connection, magma and quartz streamers.
- Place random monsters and items
For 1. currently the dungeon templates are town, normal, cavern and labyrinth. I plan to subsume caverns and labyrinths as large scale sub-features of a level as opposed to their own type. However, this step is useful for differentiating the town from the dungeon in V and for differentiating different types of dungeon maps (overland, mountain, different dungeons) in variants. Since the rarity rolls could conceivably depend on dungeon templates, I move the rolls to the second step.
2 has been explained already.
One of the current drawbacks of dungeon generation is that features are often limited by whether or not they fit. In step 3 we place the largest features as the first features in the dungeon. This way we can ensure that you get a GV if one is called for. The main advantage is not to make GVs more common, but to give the client the capability of setting their frequency in a very transparent manner. I'm envisioning High rarity, low power levels to get a cavern. High rarity, medium power levels to get a labyrinth and High rarity, high power levels to get a GV.
For 4, I lumped a lot of thing together but you can imagine further stratification. You can first check for MVs, then LVs, then pits and nests if you want. I'm not sure this stratification is necessary right now, but it would be useful if you have some features that are much larger than others.
5 is how you get somewhat interesting dungeons with low power levels. This way the first 10 levels can still have interesting features instead of the current boring situation. These would be the rooms in room_template.txt as well as the moated rooms, the cross rooms, the circle rooms, the double rooms, the pillared rooms and all the other non-standard rooms.
6 is how you satisfy a high power low rarity dungeon. Basically this looks like a normal dungeon except it's chock full of dangerous monsters and awesome loot.
7,8,9 finish out dungeon generation similar to what's done in V.
I was going to go into more details about how to pick features based on the rolls, but my lunch break is over. Maybe later tonight.
Comment