# Talk:Random vault (UnNetHack)
Intro
Sorry, I don't understand the third introduction paragraph at all. Does unnethack convert ordinary rooms to random special rooms with a 1/(2000+1) chance per room? --Tjr (talk) 18:55, 8 September 2013 (UTC)

Yeah, that wasn't super clear. What happens is that every room that is a random room is a random vault. The probability that any given random vault is vaultgen (that rndvault) / vaultgen (total for all rndvaults).
The random vault that is simply and ordinary room has vaultgen=2000. All other random vaults have vaultgen=1.
That is when vaults show up and what vault is selected. After that happens, some vaults are flagged with "ordinary" instead of "normal".
The vaults that are flagged with "ordinary", which includes the vault, "normal room", are eligible to be converted into a special room, according to the formula that determine special room selection.
In practice, what this means is that you can have random rooms shaped like "L-shaped room" or "4-leaf clover".
The vaults that are already special (like "massacre" or "temple of the gods") are not eligible for further conversion into special rooms, because they are already "special".
I hope that clears it up.
--Ozymandias (talk) 19:38, 8 September 2013 (UTC)

Random vaults (not to be confused with Vaults)

this suggests that the two uses of "vault" are entirely different. that is, "vault" is being used to mean two different things. the rest of the text suggests this is not true, and you are using "vault" to mean "room not connected to the rest of the level by corridors" in the first case as well as the second. this has taken me several re-reads to work out, and i'm not entirely certain i understand even now. perhaps you should explain what a vault is. is it a room that is 2x2? is it a guarded room? is it a room to which you mostly must be teleported and will then be lead from by a badass mob? is it just a room? --194.116.198.185 12:24, 9 September 2013 (UTC)

Vault does mean two different things - I apologize for that, it was not my decision.
Gold vaults are what you are used to from vanilla - unconnected rooms full of gold, with the guard and the possible Ludios portal, and all that.
Then, there are Random Vaults. (we really should change the name - I agree it is confusing)
Putting this in caps for emphasis&nbsp;: ALL ROOMS IN THE MAIN DUNGEON BRANCH THAT AREN'T PART OF SPECIAL LEVELS (and aren't gold vaults) ARE RANDOM VAULTS
The name is confusing, but these actually are just rooms - they connect like normal.
When deciding what random vault to place, each vault has a (vaultgen)/(totalvaultgen) chance of being selected.
"Normal random room" has vaultgen=2000
the rest of the vaults described in the article have vaultgen=1
What this means is that when UnNetHack creates a room, it has a ~1/2050 chance of being a "temple of the gods", a ~1/2050 chance of being a "massacre", a ~1/2050 chance of being a "4-leaf clover", and a ~2000/2050 chance of being a "random normal room".
Some of the vaults, once placed, can additionally be transformed into a special room - like a beehive or a throne room. When this transformation happens, all regular floor is replaced by the type of floor the special level formula suggests and any items/features/monsters are added in addition to whatever was already in the vault, if any.
For instance, look at the "buried treasure" vault - that can show up as any room - normal room, leprechaun hall, treasure zoo, etc. but in addition to normal contents, there is a buried chest filled with objects.
Let me know if you are still confused. 
--Ozymandias (talk) 16:39, 9 September 2013 (UTC)

thanks for the clarification. so "random vault" simply means "room that is not created because it is part of a special level." which is precise and concise. --194.116.198.185 12:11, 10 September 2013 (UTC)
Technically, it is any level *in the main dungeon branch* that isn't created as part of a special level - other branches have separately defined algorithms for generating filler levels between the various preset ones, and Gehennom uses a modified version of Heck^2...
--Ozymandias (talk) 13:03, 10 September 2013 (UTC)

symmetry
the page seems to be a little unsure of the meaning of the word "possible" with respect to rotational symmetry. 

how do rooms s and z differ when rotated?
why do rooms u and c differ when rotated?
perhaps there needs to be a description of why it makes the statements it does. --194.116.198.185 12:34, 15 October 2013 (UTC)

# S-shaped
LEVEL:"vlt-%04i"
FLAGS:rndvault
GEOMETRY:random
MAP
-----xxx
|...|xxx
|...|xxx
|...----
|......|
|......|
|......|
----...|
xxx|...|
xxx|...|
xxx-----
ENDMAP
REGION:(5,5,5,5),random,"ordinary",unfilled,irregular { }

# S-shaped, r2
LEVEL:"vlt-%04i"
FLAGS:rndvault
GEOMETRY:random
MAP
xxx--------
xxx|......|
xxx|......|
----......|
|......----
|......|xxx
|......|xxx
--------xxx
ENDMAP
REGION:(5,5,5,5),random,"ordinary",unfilled,irregular { }

# Z-shaped
LEVEL:"vlt-%04i"
FLAGS:rndvault
GEOMETRY:random
MAP
xxx-----
xxx|...|
xxx|...|
----...|
|......|
|......|
|......|
|...----
|...|xxx
|...|xxx
-----xxx
ENDMAP
REGION:(5,5,5,5),random,"ordinary",unfilled,irregular { }

# Z-shaped, r2
LEVEL:"vlt-%04i"
FLAGS:rndvault
GEOMETRY:random
MAP
--------xxx
|......|xxx
|......|xxx
|......----
----......|
xxx|......|
xxx|......|
xxx--------
ENDMAP
REGION:(5,5,5,5),random,"ordinary",unfilled,irregular { }

They are rotated, not reflected. S is a reflection of Z, and each can be oriented either vertically or horizontally.
--Ozymandias (talk) 13:56, 15 October 2013 (UTC)

aha, i see now. i was missing the whole 9x6 thing. sorry about that. and c? --194.116.198.185 12:17, 16 October 2013 (UTC)

One thing that might serve as the general case explanation: random vaults will always appear in the same orientation (they never flip across either axis). For the procedurally generated rooms, this is a mostly invisible fact, basically only noticeable if the room isn't square, for the room can be randomly generated with the specified features in any orientation. However, for the vaults with the predefined maps, they will always appear exactly as stated in the map - for instance a 2x10 hallway will never appear as a 10x2 hallway - thus, if you want both to appear, they have to be added as separate vaults. Thus, these:

# U-shaped
LEVEL:"vlt-%04i"
FLAGS:rndvault
GEOMETRY:random
MAP
-----xxx-----
|...|xxx|...|
|...|xxx|...|
|...-----...|
|...........|
|...........|
|...........|
-------------
ENDMAP
REGION:(5,5,5,5),random,"ordinary",unfilled,irregular { }

# U-shaped, reversed
LEVEL:"vlt-%04i"
FLAGS:rndvault
GEOMETRY:random
MAP
-------------
|...........|
|...........|
|...........|
|...-----...|
|...|xxx|...|
|...|xxx|...|
-----xxx-----
ENDMAP
REGION:(1,1,1,1),random,"ordinary",unfilled,irregular { }

must be added as two separate vaults, otherwise you would always just get the one orientation specified.
In UnNetHack even predefined special levels may flip across the x axis, y axis, or both, such that levels such as the Castle can feel a bit different between games, while still using a predefined map. However, due to technical limitations, random vaults cannot be automatically flipped - the alternate orientations must be hardcoded, or else will be omitted.
--Ozymandias