Random zone generation
Posted: Sun Nov 14, 2010 7:09 pm
This post is sort of an outline for the beginnings of a random zone generator. We start with some new zone layouts to be used when generating perpendicular dungeons:
a) Castle: stacked arrangement, all depths. Almost all space used, rooms weighted towards alignment with each other, hallways always straight, doors generated between room and hallway.
b) Tight tunnels: Stacked or adjacent arrangement, subterranean only. Width-one tunnels that tightly curl and have occasional organically-shaped rooms. Going for a giant ant nest feel.
c) Lost city: adjacent arrangement, all depths. layout as I describe in the vault submission thread.
d) Forest city: adjacent arrangement, ground level only. Think Lothlorien from T2. Buildings among trees, streams, foresty stuff.
e) Tower: stacked arrangement, always ascending, all depths. Circular cross-section. Area of floor n is less than or equal to area of floor n-1, but most often equal, resulting in a big cylinder. Almost all space used, as with castles. Lots of radial walls.
f) Pyramid, inverted pyramid: basically towers as above, only with square cross-sections. For inverted pyramids, the area of a floor n is strictly greater than the area of floor n-1. The difference in size should be uniform between levels.
g) Graveyard: Adjacent arrangement, all depths. Lots of open space and crypts that have their own down stairs which lead to a basement level. Multiple crypt stairs all lead to the same basement level, which looks like a bunch of disconnected vaults.
h) Cliffs: stacked or adjacent arrangement, ground level and above only. Movable terrain is just a path along the cliff face with some wide spots and caves leading into the rock. Empty space on the other side of the path. In a stacked arrangement, the player ascends or descends in a switchback pattern. In an adjacent arrangement, it's one long traverse. Lots of visible but inaccessible spots along the cliff only accessible through teleportation.
Now a list of themes that get (somewhat) randomly applied to zones in the generator:
1) settlement: npcs fairly homogenous and structured. For example, a castle full of humans with maybe some trained wolves, lots of guards and peons, a few commanders and magic users, one lord.
2) flooded: aquatic enemies, terrain modified as ruined below, needs water breathing. Subterranean only.
3) ruined: lots of rubble, missing walls, broken doors, randomized inhabitants.
4) claimed by bandits: thief-type enemies. Force generaton of some stone rooms with doors when layout doesn't otherwise have them. Additional traps.
5) cursed: lots of undead and demons, often ruined as above.
6) Gigantic: all dimensions doubled.
7) dragon-infested: Lots of dragons. Often ruined as above.
8) cult stronghold: Lots of magic-users of a particular flavor. Force generaton of some stone rooms with doors when layout doesn't otherwise have them.
9) disgusting: Often ruined. Lots of slimes and jellies and grossness.
10) horrific: Often ruined. Lots of horrors.
11) illusory: Lots of insubstantial solid-looking terrain and enemies that screw with your mind.
12) vaulttastic: Heavily weight rooms towards vaults. Remember that 'all rooms are special' option in T2?
13) Manastorming: magic has gone haywire. Huge boost to mana regen, but spells act unpredictably X% of the time (wrong target, fizzling, wrong spell, etc.)
You could come up with a theme for any subset of monsters X: 'infested by X'. This isn't all that interesting, so I quit after the couple like that I did above. If anybody has ones to add, please do so! Just make them more interesting than a monster theme. A monster theme with some appropriate accompanying gameplay elements is good.
Here's a table that lists layouts appropriate for zones perpendicular to the given zone.
Most themes can go with most layouts, but some don't make sense. Here's a table listing what's NOT allowed as a theme for the listed layout.
Here's an outline of the algorithm that generates a random zone. I'll go into more detail on the various steps later.
Randomly generated dungeons will use several layouts.
1) Check orientation and elevation of current zone A.
2) Pick elevation-appropriate perpendicular layout B.
3) Generate appropriate intersection between A and B.
4) Generate 2-4 levels of layout B after intersection
5) Pick elevation-appropriate layout C perpendicular to B
6) Generate appropriate intersection between B and C
7) Generate 2-4 levels of layout C after intersection
8) Generate random unique appropriate to theme in special room on final level of layout C.
What we're going for here is the feel of a custom-designed zone. For example, a random zone might be generated that branches off the Old Forest. It has the 'forest city' layout with the 'ruined' theme. The player discovers it when exploring the Old Forest and finds the edge of a ruin intruding on an Old Forest level, complete with a tempting >. Investigating, the player fights his way through three ruined forest city levels, and on the third, finds the edge of a massive castle partially covering the level. There's yet another tempting >. The player enters the castle, which turns out to have the 'cult stronghold' theme. On the fourth floor of the castle, the player fights some gnarly cultist-type unique and gets a nice random artifact.
Fighting your way through a ruined forest city to confront the cult holed up in the city's palace? Sounds custom-built to me, but it's just a random pick from the above tables. Try some more random picks and see how they feel.
a) Castle: stacked arrangement, all depths. Almost all space used, rooms weighted towards alignment with each other, hallways always straight, doors generated between room and hallway.
b) Tight tunnels: Stacked or adjacent arrangement, subterranean only. Width-one tunnels that tightly curl and have occasional organically-shaped rooms. Going for a giant ant nest feel.
c) Lost city: adjacent arrangement, all depths. layout as I describe in the vault submission thread.
d) Forest city: adjacent arrangement, ground level only. Think Lothlorien from T2. Buildings among trees, streams, foresty stuff.
e) Tower: stacked arrangement, always ascending, all depths. Circular cross-section. Area of floor n is less than or equal to area of floor n-1, but most often equal, resulting in a big cylinder. Almost all space used, as with castles. Lots of radial walls.
f) Pyramid, inverted pyramid: basically towers as above, only with square cross-sections. For inverted pyramids, the area of a floor n is strictly greater than the area of floor n-1. The difference in size should be uniform between levels.
g) Graveyard: Adjacent arrangement, all depths. Lots of open space and crypts that have their own down stairs which lead to a basement level. Multiple crypt stairs all lead to the same basement level, which looks like a bunch of disconnected vaults.
h) Cliffs: stacked or adjacent arrangement, ground level and above only. Movable terrain is just a path along the cliff face with some wide spots and caves leading into the rock. Empty space on the other side of the path. In a stacked arrangement, the player ascends or descends in a switchback pattern. In an adjacent arrangement, it's one long traverse. Lots of visible but inaccessible spots along the cliff only accessible through teleportation.
Now a list of themes that get (somewhat) randomly applied to zones in the generator:
1) settlement: npcs fairly homogenous and structured. For example, a castle full of humans with maybe some trained wolves, lots of guards and peons, a few commanders and magic users, one lord.
2) flooded: aquatic enemies, terrain modified as ruined below, needs water breathing. Subterranean only.
3) ruined: lots of rubble, missing walls, broken doors, randomized inhabitants.
4) claimed by bandits: thief-type enemies. Force generaton of some stone rooms with doors when layout doesn't otherwise have them. Additional traps.
5) cursed: lots of undead and demons, often ruined as above.
6) Gigantic: all dimensions doubled.
7) dragon-infested: Lots of dragons. Often ruined as above.
8) cult stronghold: Lots of magic-users of a particular flavor. Force generaton of some stone rooms with doors when layout doesn't otherwise have them.
9) disgusting: Often ruined. Lots of slimes and jellies and grossness.
10) horrific: Often ruined. Lots of horrors.
11) illusory: Lots of insubstantial solid-looking terrain and enemies that screw with your mind.
12) vaulttastic: Heavily weight rooms towards vaults. Remember that 'all rooms are special' option in T2?
13) Manastorming: magic has gone haywire. Huge boost to mana regen, but spells act unpredictably X% of the time (wrong target, fizzling, wrong spell, etc.)
You could come up with a theme for any subset of monsters X: 'infested by X'. This isn't all that interesting, so I quit after the couple like that I did above. If anybody has ones to add, please do so! Just make them more interesting than a monster theme. A monster theme with some appropriate accompanying gameplay elements is good.
Here's a table that lists layouts appropriate for zones perpendicular to the given zone.
Code: Select all
Zone Layout
Daikara abcefgh
Eruan adefg
Old forest adefg
Trollshaws adefg
Ancient Elven Ruins abcefg
Ardhungol abcefgh
Flooded cave abcefg
Grushnak abcefgh
High Peak abcdefgh
Reknor abcefg
Kor Pul abcefg
Sandworm lair abcefg
Tol Falas abcefg
Valley Moon Caverns abcefgh
Vor Armory abcefgh
Code: Select all
Layout Themes NOT allowed
a none
b 3
c none
d 2
e none
f none
g none
h 2, 3, 6
Randomly generated dungeons will use several layouts.
1) Check orientation and elevation of current zone A.
2) Pick elevation-appropriate perpendicular layout B.
3) Generate appropriate intersection between A and B.
4) Generate 2-4 levels of layout B after intersection
5) Pick elevation-appropriate layout C perpendicular to B
6) Generate appropriate intersection between B and C
7) Generate 2-4 levels of layout C after intersection
8) Generate random unique appropriate to theme in special room on final level of layout C.
What we're going for here is the feel of a custom-designed zone. For example, a random zone might be generated that branches off the Old Forest. It has the 'forest city' layout with the 'ruined' theme. The player discovers it when exploring the Old Forest and finds the edge of a ruin intruding on an Old Forest level, complete with a tempting >. Investigating, the player fights his way through three ruined forest city levels, and on the third, finds the edge of a massive castle partially covering the level. There's yet another tempting >. The player enters the castle, which turns out to have the 'cult stronghold' theme. On the fourth floor of the castle, the player fights some gnarly cultist-type unique and gets a nice random artifact.
Fighting your way through a ruined forest city to confront the cult holed up in the city's palace? Sounds custom-built to me, but it's just a random pick from the above tables. Try some more random picks and see how they feel.