Out of 1 000 000 dungeons, 748 850 had Ludios, about 74.9%.
Corroborating evidence: a couple of years back I posted a formula
which will give the chance of Ludios if you can tell it the chance
that a normal level has a vault (see
for this). Of the 12 233 838 normal levels I created, 4 281 342 had
vaults. That's ever so slightly under 35%, leading to a calculated
Ludios chance of 74.87% or so.
These percentages are lower than I expected. In particular, I had
always thought that almost every level that has the chance to get a
vault, gets one, which is to say almost half. That would lead to a
Ludios chance of closer to 85%. Instead, it seems like the other
requirements for getting a vault fail considerably often. I wonder if
it's coincidental that my experimental vault percentage is so close to
exactly 35%; I find the mklev.c code too hard to know for sure.)
I have taken a look at your old post and I think that you forgot
something, that Ludios caon only appear once per game. For example, if
Ludios have 35% chance to appear on level 1 and 40% chance to appear on
level 2, the actual chance that it will appear in this game is:
35% + 40% * (1 - 35%)
that is, the chance that the portal appear on level 2 is also affected by
level 1, to have the portal appear ob level 2, it must not appear on level
1, so for level 2: [chance that it appear on level 2] * [chance that it
doesn't appear on previous levels].
I don't fully understand your old post but that might explain why the
actual result is lower than you expected...
- Great Erdrick
In fact, I measure the chance that Ludios *doesn't* exist, so no such
problem. (For example, in your example the chance of no Ludios on the
first two levels is 65%*60%.)
> I don't fully understand your old post but that might explain why the
> actual result is lower than you expected...
It's the experimental results that are surprisingly low. The
theoretical result agrees with experiment. (As far as it goes: I have
no theoretical result on the chance of a level getting a vault.)
Well, the hard code is in rect.c (split_rect()) and sp_lev.c
(create_room()); makerooms() in mklev.c is straightforward enough.
Rooms are created until the rectangle code says "sorry mate, no more
space"; each room created after the sixth has a 50% chance of being
made a vault instead, unless a vault has already been created.
Just _how_ the rectangle code decides what slices of levelspace to
allocate or not is the tricky part :-)
: Dylan O'Donnell http://www.spod-central.org/~psmith/ :
: "It is pitch black. You are likely to be eaten by a grue." :
: -- Dave Lebling and Marc Blank, "Zork" :
It's not quite so simple. Once a room passes the 50% chance, the call
to create_vault() still might fail; and even then, there's a later
call (in makelevel()) to check_room() which might fail before it
becomes a vault. Moreover, if the call to check_room() fails, there's a
last-ditch attempt to get a different vault with new calls to
rnd_rect(), create_vault(), and check_room().
I did another million levels.
On 35695 there were too few rooms for a vault;
on 170627 none of the 50% chance checks passed;
on 143455 create_vault() failed;
on 299852 check_room() failed;
but on 618 of those levels, the last-ditch effort yielded a vault.
(For a total of 350371+618=350989 vaults.)
Aha. I'd assumed that create_vault() wouldn't be failing under normal
circumstances, and the check for success was just the standard
defensive coding for gracefully handling it if it ever did; clearly
it's more complicated than that (as noted, create_room() is the hard
> I did another million levels.
> (For a total of 350371+618=350989 vaults.)
So, the proportion of "normal" Dungeon levels with vaults is pretty
firmly empirically established at about 35%; I'll amend room-340.txt
accordingly. Thanks for running these trials.
I wonder if the original poster would be willing to generate a few million
copies of DL2 to determine how often a shop is actually created:
a. If there are the stairs to the Mines on the level.
b. If there are not stairs to the Mines on the level.
Also it would be interesting to know:
c. How many item spaces the average shop has.
d. How often a wand store or a book store gets turned into a general store
"Sometimes I stand by the door and look into the darkness. Then I
am reminded how dearly I cherish my boredom, and what a precious
commodity is so much misery." -- Jack Vance
I was surprised to find that it (almost) doesn't matter. In fact, the
mines stairs are placed *after* the shop is made. There's even a
non-zero chance that the stairs end up inside the shop (but the chance
is somewhat less than one in 10^60... so don't hold your breath).
There's only about a 45.3% chance of getting a shop. This is lower than
I expected. Another 44.9% of the time there's no room with one door;
the remaining 9.8% of the time there are stairs in all such rooms. The
"almost" from the preceding paragraph is that, if you are at the mines
branch level, the chance of having too few rooms is greater, but I saw
it on only 365 in a million levels (as opposed to 0 in a million on
(A slightly related oddity: it looks like there's a buglet in the
[normal] stairs placement so that the upstairs is very rarely in the
rightmost room, and only if the downstairs is in the
second-to-rightmost. This means that the rightmost room is more often
free to be a shop; and if not, then the leftmost is free.)
> Also it would be interesting to know:
> c. How many item spaces the average shop has.
> d. How often a wand store or a book store gets turned into a general store
d. 52% of the time.
Here's some more data, if you're interested in shop sizes:
Levels: 1000000 (No mines)
Shops by size of room:
4:563 6:8871 8:6366 9:31297 10:5272
12:48518 14:2947 15:37118 16:18461 18:29876 20:28369
21:15460 22:861 24:34515 25:11384 26:748 27:12134 28:11138 30:27534
32:9040 33:3803 35:8674 36:18158 39:3692 40:14883
42:10360 44:2939 45:7082 48:8159 50:6097
52:3473 54:4482 55:2583 56:5878 60:7666
Shops by size of shop:
2:563 3:3697 4:7651 5:2288 6:37199 7:1346 8:25042 9:24805 10:22076
11:493 12:51260 13:444 14:8385 15:26905 16:19452 18:27154 20:25719
21:11989 22:2116 24:27889 25:7918 26:2162 27:8948 28:10700 30:17599
32:7310 33:3330 35:5860 36:14263 39:3994 40:9439
42:6591 44:2561 45:4557 48:6082 50:2548
52:4321 54:2916 55:2625 60:3237
Total: 453434 Av. room size: 25.001469 Av. shop size: 19.879914
Wand and book: 27228, with 14078 made general
Too few rooms: 0
No room with one door: 448526
Stairs in all such rooms: 98040
Levels: 1000000 (Mines)
Shops by size of room:
4:573 6:8939 8:6519 9:30948 10:5153
12:49002 14:2982 15:37116 16:18295 18:29826 20:28724
21:15575 22:846 24:33918 25:11482 26:790 27:12146 28:11131 30:27440
32:9080 33:3749 35:8542 36:18367 39:3669 40:14699
42:10197 44:2821 45:6896 48:8405 50:6262
52:3406 54:4640 55:2581 56:5969 60:7498
Shops by size of shop:
2:573 3:3744 4:7801 5:2245 6:36835 7:1376 8:25316 9:24939 10:21941
11:484 12:50844 13:488 14:8409 15:27351 16:19583 18:27187 20:25594
21:11926 22:2135 24:27769 25:7748 26:2156 27:9170 28:10651 30:17540
32:7039 33:3296 35:5792 36:14223 39:3999 40:9435
42:6667 44:2648 45:4561 48:6246 50:2496
52:4393 54:2796 55:2549 60:3152
Total: 453097 Av. room size: 24.979269 Av. shop size: 19.861275
Wand and book: 27282, with 14107 made general
Too few rooms: 365
No room with one door: 448833
Stairs in all such rooms: 97705
> There's only about a 45.3% chance of getting a shop.
So can we say that for lower levels, the actual chance of a shop is about
.151 * DL ?
> This is lower than I expected.
Fits in with my experiences.
> Another 44.9% of the time there's no room with one door;
> the remaining 9.8% of the time there are stairs in all such rooms.
I don't understand this. You said stairs are placed after the shop is
chosen? Or just the Mines stairs?
> > c. How many item spaces the average shop has.
> c. 19.9.
-snip data- And the median shop size is 16.
> > d. How often a wand store or a book store gets turned into a general store
> > instead.
> d. 52% of the time.
Hmm, so those shops are twice as rare as the spoiler would indicate...
By the way, is the number and size of rooms on a level at all dependant on
DL? I'd imagine not, but just checking.
Hey, when you generate these levels, does it generate items too? If so,
what's the chance of finding the following on DL2...
One or more /oW? /oDeath? /oPoly?
" " " speed boots?
" " " power gloves?
" " " magic whistle?
" " " bag of holding?
Magicbane or a cloak of magic resistance?
An amulet or shield of reflection?
A good artifact weapon? (Grayswandir, *brand, Magicbane, Mojo, Stormbringer)
Any artifact weapon at all?
One magic lamp?
Two magic lamps?
Three or more magic lamps? (yeah right)
Altars of two different alignments?
Altars of all three alignments?
Just the mines stairs. Ordinary up & down stairs are placed first.
> By the way, is the number and size of rooms on a level at all dependant on
> DL? I'd imagine not, but just checking.
As far as I can tell, no.
> Hey, when you generate these levels, does it generate items too? If so,
> what's the chance of finding the following on DL2...
It does generate items (and monsters... in fact, I have to reset the
born counter to avoid extinction-related problems). I think the more
interesting question is DL1, myself. I will probably try to answer
your question, but not for a few days (I do have to do productive work
too). I think item-related probabilities can be obtained directly
from analysis of the code, given a probability distribution for the
number of rooms. (Though it's probably easier just to run the
The important stages of level creation, picked out from mklev() and
makelevel(); Rogue levels skip some of these.
Assign level-dependent object probabilities (at present, just the
range of possible gems).
If this is a predefined level or a maze level, make that instead and
skip down to "Mineralise"; otherwise, carry on through this list.
Place the rooms. Chance of a vault being made here.
Place the normal up and down stairs, in different rooms if possible.
Lay out the corridors.
Add niches and closets.
If makerooms() didn't give us a vault, possibly create one now.
Make a shop or special room(s), if wizmode SHOPTYPE or the dieroll call
for one it.
Place branch stairs or portal.
For each ordinary room, put things inside (varying chances of each):
Monster or monster group.
Traps and mimics.
Dungeon furniture: fountains, sinks, altars, graves.
Mineralise the rock with gold and gems, add kelp to water.
: Dylan O'Donnell http://www.spod-central.org/~psmith/ :
: "Go not to Usenet for counsel, for they will say both :
: 'No' and 'Yes' and 'Try another newsgroup'." :
: -- Usenet Rule 17. :
>For each ordinary room, put things inside (varying chances of each):
> Monster or monster group.
Does this mean that monsters are never generated in corridors? What
about monster generation that occurs after the level has been visited?
What about areas that have been dug out of stone?
I actually think this second stage takes the pre-vault created by
makerooms(), and uses check_room() to decide if it actually *is* a
vault. (Maybe because corridors could have gotten in the way?) Only
at this stage is add_room() called (create_room() usually calls it,
but not when it's create_vault()), and zorkmids appear.
Not at level-generation time. Wizmode-confirming this is easy; wish for
and quaff a blessed potion of monster detection, then ^V and ^F down
the dungeon. All in rooms.
(Strictly speaking, this isn't quite true; while the seed monster of a
group is always inside a room, the subsequently-created members can
straggle out into the corridor. Also, mimics can be created in
doorways, but that's a special case.)
> What about monster generation that occurs after the level has been
That can be in any viable-for-a-monster-to-be-in space, with a
significant effort made to have it be out of sight if possible.
> What about areas that have been dug out of stone?
Once you've dug it, monsters can appear in it.
>> What about monster generation that occurs after the level has been
> That can be in any viable-for-a-monster-to-be-in space, with a
> significant effort made to have it be out of sight if possible.
"Out of sight" meaning out of eye-sight, I guess.
I was just strodding around blinded, with telepathy, and a group of orcs was
created next to me in the same room...
I am fairly sure that they were *not* created in, say, a corridor behind the
room's wall, but I could be mistaken.
Boudewijn Waijers (bwaijers at tiscali.nl).
"Xander, stop reading Latin in front of the books!"
- Rupert Giles, in "Buffy, the Vampire Slayer".
It looks at whether you can see the location, not a monster there. So,
ESP doesn't count as "sight", but astral vision from the Eyes does.
> I was just strodding around blinded, with telepathy, and a group of
> orcs was created next to me in the same room...
("strodding"?) Be careful with using group monsters as examples; creation
restrictions often only apply to the initial seed monster, and the other
members of the group get placed where another monster might not.