Wednesday, January 16, 2013

Leaks Like A Sieve

Suppose we start with the following proposal.

A group of monsters roaming around the outside of your world stumbles across a "dungeon" that is completely empty of treasure-hoarding creatures.  Oh, there are probably beasties there already, but let's say nothing intelligent.  If you like, this is hundreds and hundreds of years ago, long before your party shows up to plunder the place.

Let's further imagine that these monsters are carrying only 100 g.p. with them.  We can envision them as a few orcs, goblins, whatever you like - but not some enormous band.  They settle down into the top level of the dungeon, near the surface, and for a year they do little or nothing.

Now, these creatures don't have much purpose for the coin they have; they're not going out to the local market or anything.  But they like the coin, its shiny and it has pretty pictures on it.  They give it to their children to play with.  And now and then, some of it is dropped, some of it is stolen by the little beasties in the dungeon, and so on.  Call it 'spoilage.'

At the same time, these creatures are occasionally going out into the world and snatching more treasure from other things, but not much - just enough to say that in a year, they steal about 100 g.p. worth of hard, valuable, endurable treasure.

Now, I'm a great fan of the 1% per month maintenance rule in the DMG, and I've argued in the past that this could be read as general loss.  So for the purpose of our proposal, let's say that 12% of whatever treasure our 1st Level dungeon creatures have is lost ... it drifts down deeper into the caverns, where it is picked up by gelatinous cubes, wandering troglodytes, giant rats and so on.

Suppose that once every three years, a group of somebodies - a party, a local constabulary, what you will - comes along and clears out the upper level of the dungeon, taking all the treasure that is there.  And still, the caves are comfortable, so let's say that something else moves in, and in the process brings in some of a hundred gold pieces, depending on how long they've been there that first year.  We can roll a hundred sided die to see how much precisely.  And the new creatures go on accumulating a hundred gold a year.  For centuries.

And let's add that of whatever drifts into the 2nd Level, 12% of that drifts into the 3rd Level ... and 12% of that drifts into the 4th Level, and so on.  Only the 2nd Level is only plundered 1 in 9 years.  The 3rd Level, only 1 in 27.  And the 4th Level, only 1 in 81.  And so on.

Now what would that look like?

Here's what you do.

On Row A of your excel sheet, in Box B1, Write "Year".

In boxes A3 going down, write "Level 1" "Level 2" "Level 3" and so on.

In box B2, write "1"

In box B3, write "100"

In box B4 going down, write "0" for as many levels as you want.

In box C3 going down, write "=RANDBETWEEN(1,3)".    You might want to make this column a different color, so that you know these are random numbers and NOT your results.

In box D2 write "=B2+1".  This will serve to duplicate itself and count the years for you.

In box D3 write "=IF(C3=1,RANDBETWEEN(1,100),(B3*0.88)+100)".  All that says is that if the random number generated is a 1, the first level of the dungeon was cleaned out.  If it wasn't cleaned out, then 12% is gone (spoilage) and the rest is added to the 100 g.p. the creatures on that level gathered that year.  It also says that if the dungeon was plundered, 1 to 100 g.p. is accumulated in on the first level AFTER the plundering.

In box D4 write "=IF(C4+C3=2,0,(B3*0.12)+(B4*0.88))".  Which says that if the dungeon above was cleared out, and the roll for this level was also a 1, then this level was cleaned out too.  Spoilage from Level 1 pours into Level 2, and we minus the spoilage from Level 2 into Level 3.

In box D5 write "=IF(SUM(C3:C5)=3,0,(B4*0.12)+(B5*0.88))".  Level 3 is only cleaned out if the two levels above it are, so the sum of all three random numbers must be 1 x3 = 3.

In box D6 write "=IF(SUM(C3:C6)=4,0,(B5*0.12)+(B6*0.88))"

In box D7 write "=IF(SUM(C3:C7)=5,0,(B6*0.12)+(B7*0.88))"

And so on, remembering to adjust the sum for each number.

Now, you can copy everything in column C and D into columns E and F.  That will give you the results for year 3.

In fact, you can now copy as far into the future as you wish.  The numbers get quite interesting as you get past 80 years or so.

If you've done it right, you should have something that looks like this:

I've colored the random numbers in coral, so that the actual results in g.p. are in white. 

Yes, I know, it does not look very impressive for Level 5.  What is particularly interesting about this generator is that no matter how you fool with the numbers, you're going to find your dungeon pouring out its gold into the bottom.  You have to define one of the levels as THE bottom level ... and that one level will pile up gold impressively ... but none of the ones between the top and the bottom will.

You can reduce the number of times a level is plundered, but that only makes it drain more gold through.  You can reduce the amount of "spoilage" ... but that only makes it harder for the bottom levels to accumulate gold.  Reducing the likelihood of plunder down to 1 in 6, and decreasing the spoilage to only 2%, it generally took more than a hundred years of dungeon just to get the gold on the 5th Level up to 100.

In other words, I'm saying that if anyone else in the world is plundering dungeons, the idea that the space between the top of the dungeon and the bottom are filled with treasure just doesn't fit mathematically.  And if no one is plundering these dungeons, then they must be very remote - which begs the question, where are they getting the gold from?

Please, don't argue that the people below are robbing the people above - that just makes the dungeon sieve move faster.

I'm not saying I'd run a dungeon differently ... but one has to recognize that, economically, the process CAN'T work like you think it works.


Butch said...

Ah, but let's say more often than not the party of local do-gooders get slaughtered, dumping all the gold they brought (and all the gold they took from the upper levels).

JDJarvis said...

It is an interesting analysis of the top loading dungeon.

What keeps the 1st level baddies from moving on down deeper into the dungeon and taking their loot with them? Or using it to rent muscle or spend it on bribes/tribute so they don't get murdered by lower dwelling baddies (moving the gold deeper, quicker I suppose) ?

Alexis said...


If slaughtered in the dungeon, then that treasure is just going to sink to the bottom.


If the lower levels are empty, nothing ... but just as the coin moves down, so should the most dangerous creatures - at least, that's the myth.

Maybe that needs a rethink too?

Butch said...

What if they make it all the way down to the bottom -- but are killed on the way back up, say on level 3? They have redistributed the wealth from the bottom to the middle.

Alexis said...

What if there were coin fountains on every level that spewed forth gold from other planes of existence?

Noncanonical said...

Here, you're making the assumption that the giant rats and gelatenoous cubes living on level two only know how to steal from people living above them. One might instead assume that they can siphon wealth from both the levels immediately above and below, so on the intermediate levels, 6% of the loss moves up and 6% move down. This introduces a "random walk" aspect to the computation that I believe will more evenly balance the loadout of the treasure.

Alexis said...

Except that D&D dungeons are based on the notion that things deeper down are deadlier than things higher up. I'm not saying the gelatinous cubes will "steal"--they're non-intelligent. But things WILL be lost, consistently, as they have through human history ... and while the goblins on level one will have trouble killing the cubes, the ogres on level three won't.

If the tougher things hang out in the deepness, no matter how people might suggest moments when entropy would not play, those WOULD NOT BE THE NORM.

Statistics, people. Statistics.

Jonathon said...

I can't dispute your conclusions based on the starting point you give, but your argument moved from 'start with this premise' and ended with 'dungeons cannot work X way mathematically' while kind of sliding past the fact that some assumptions are built in. I am not sure, for example, that the premise that gold only enters at the top can be taken for granted in all cases. The 100-gp goblins (or whoever) might indeed move in on the top level and stay there, but a reclusive sorcerer with a cartload of valuables might have moved directly to (say) level 4 and set up shop there specifically because he wanted a buffer between his research projects and the annoyances of the outside world. His furniture, lab equipment, rare books, and so on are worth a lot more than the goblin's goods.

Adding a random 'gets repopulated' factor to the lower levels would change the math quite a bit, especially if the lower levels assume a wealthier tenant 'moves in.' Level 1 automatically fills, which is sensible enough, but perhaps level 2 should have a 1-in-3 chance of being 'restocked' immediately after being plundered, or some such? Unless I'm missing the point (which is certainly possible.)

Alexis said...

I'm curious, Jonathan, if you ran those propositions through a simulator to see if an inflow of money on any level produced any change in the sieve? Because I found, mucking around with it, that even if you pump money slowly in at several levels, you just get the same effect. There are moments of "anti-entropy," but in the long run it just flows down. Unless you want to argue that these injections of coin into the various levels are huge and constant. In which case, how do you argue that so much wealth from civilization is being injected under the surface of the earth, when historically we've never done that?

Regarding things not coming from the top down, I do discuss that in the next post; but I think you must realize that injecting something in level 4 is mathematically no different than injected it into level 1. You're just changing the starting point.

Noncanonical said...

I don't think the assumption that cash can flow upward has much to do with who can kill who. Due to extinction events, your model's flow amounts to a handful of coins moving down a level every month. This is easily and plausibly explained by the scavengers -- rats, for example -- stealing away with something without being noticed by the residents. Indeed, this is a clear means of motion in your "money has no value to the residents" setup, moreso than the major residents of the next level being directly involved in the process at all. Under such assumptions, it's reasonable that the money can move back upwards a level. An ogre is no more likely to notice a rodent going through some rubbish and wandering off with a shiny thing than a goblin is.

If you want to make the assumption that small amounts of coinage can only flow downward because more dangerous things live below, that's fine, but that's not statistics or the fundamental nature of the game so much as your personal conception of it, to which you are certainly welcome but which does not a rock-solid mathematical argument make.

snowlantern said...

Valid analysis, but what about other types of dungeons? For example, if the dungeon would be a tomb, and someone is buried at the lowest level with treasure, should the treasure drift upwards?

James C. said...

The essay above assumes gold is actively accumulating in the dungeon vs. the gold having been buried with the dungeon. I don't know how explicit D&D really is with this, but I've always implied that the gold and treasure in dungeons is very, very old left overs of the previous civilization... the treasure is trickling up and out, not down and in. In this manner almost all dungeons should be interpreted as tombs or vaults, I suppose, and the monsters therein as nuisances and the remnants of security systems... not accumulators and not some spoke on a subterranean economic wheel.

efferousjames said...

You can produce results similar to usual D&D treasure by incorporating an upwards flow of treasure in addition to the downwards flow of treasure (as you've called it, spoilage). An upwards flow of treasure is a reasonable assumption in a dungeon where higher-level denizens will raid deeper-level denizens (despite the risks) for their treasure. In a similar sense, a downwards flow of treasure may incorporate deeper-to-higher raiding as well as spoilage.

I written a C program to demonstrate this. In it, the terms inflow, upflow, and downflow are used to mean the treasure taken from the surface into level 1, the percentage of treasure taken from a deeper level into an upper level, and the percentage of taken from an upper level into a deeper level, respectively. I've neglected to take into account the dungeon being raided from the surface and randomness.

#include "stdio.h" // this comment form devours angle-brackets; replace the quotes with angle-brackets

#define DEPTH 8
#define YEARS 1000000
#define INFLOW 100 // the amount raided from the surface by the first level, as a gold piece value
#define DOWNFLOW .5 // the amount raided from the level below by the level above, as a percentage
#define UPFLOW .2 // the amount raided from the level above by the level below, as a percentage

int main ()

int x, y;
float z;
float depth [DEPTH];

for (x = 0; x < DEPTH; x++) {
depth [x] = 0;

for (x = 0; x < YEARS; x++) {

depth [0] += INFLOW; // the first level raids the surface

for (y = 1; y < DEPTH; y++) {
z = DOWNFLOW * depth[y-1];
depth [y-1] -= z;
depth [y] += z;

z = UPFLOW * depth[y];
depth [y-1] += z;
depth [y] -= z;

/* Output; for those compiling on systems other than Linux, you will need to alter \n to something more appropriate. */

for (x = 0; x < DEPTH; x++) {
printf ("Depth %i: %.0f\n", x+1, depth [x]);

printf ("\n");

return 0;

In this program, I've defined UPFLOW and DOWNFLOW to take the values of .2 and .5, respectively. For large values of YEARS, the ratio of the treasure on a level divided by the treasure on a level that is one level higher is 2, which is somewhat similar to the ratio of treasure between levels in the older versions of D&D (specifically, I am using the unprotected treasure tables in Labyrinth Lord). You could use your rate of spoilage, .12, with an upflow value of .0566 to produce a ratio of 2 between levels.

The ratio approaches DOWNFLOW / UPFLOW - DOWNFLOW for large values (1,000,000 works well) of YEARS, though for smaller values of YEARS the ratios increase for each level deeper.

Please excuse the length of this post and, if it isn't useable or clear, the code.