View Single Post
Old November 14, 2013, 23:45   #1
Join Date: Apr 2009
Location: Pisa / DL0
Posts: 970
fph is on a distinguished road
Sil mod: probability to die

I have written a small modification to Sil in which after every attack, trap or probability that the player takes damage the following two things are computed:
1 - distribution of the dealt damage (as in: probability of taking $n$ damage points for each $n$)
2 - probability of being dead as a result of all the risks taken during the game, in millimort ( 1000 millimort equals probability 1 of being dead (note that they cannot be simply added).

I think it's interesting because it quantifies exactly how many risks you are taking. By being aware that the last turn raised your probability of dying to from 0.05 to 0.1, you can be more conscious and avoid taking the same action, even if it does not immediately result in death.
This allows also to compare risk-taking and playing style: for instance, at which level does your mortality score normally leave its original value of 0?

The odds are written on stdout for now; probably I should work on a better display, but this is just a proof-of-concept for now.
I encourage you to try it and tell me your opinions. I'd be happy to know that the added knowledge makes you more attentive to risks and tradeoffs.

You can download the source from, or browse the repo at It is based on the current version 1.1.1 of Sil.
There is no Windows executable as I only develop on Linux and I have no Windows toolchain abailable; I'd be happy if one of the Windows users could compile a Windows version.

Some technical details:

I check for damage probabilities after every action that can damage the player (attack, trap, and so on). Of course it's impossible to quantify longer-term probabilities, such as the probability of being confused by a brown mold and thrown into a pack of white wolves that just came down the stairs. So the probabilities are underestimated a bit, but I think they are still reasonable and indicative. The only situation when I don't find this very realistic is when a big breather could decide to breathe or not at the next turn. I'm working on doing something better in this case.

Probabilities are not simulated with a Montecarlo approach, they are computed exactly. Some care is taken to avoid instabilities and rounding errors. This is not always trivial; for instance, we need expm1().

I did this for Sil because I think the damage-dealing system is slightly easier to handle. If this is interesting, I can consider porting it to vanilla and/or other variants.

The code will probably contain lots of bug -- don't depend on it for anything mission-critical such as running a nuclear power plant (a use case in which Sil normally shines instead).
Dive fast, die young, leave a high-CHA corpse.
You read a scroll labeled 'lol gtfo' of Teleport Level.
fph is offline   Reply With Quote