Angband Forums

Angband Forums (http://angband.oook.cz/forum/index.php)
-   Sil (http://angband.oook.cz/forum/forumdisplay.php?f=12)
-   -   Sil mod: probability to die (http://angband.oook.cz/forum/showthread.php?t=6411)

fph November 14, 2013 23:45

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 (https://en.wikipedia.org/wiki/Micromort). 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 https://github.com/fph/mortsil/archive/master.zip, or browse the repo at https://github.com/fph/mortsil. 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).

half November 15, 2013 09:44

This is fascinating. I'd be interested in somehow incorporating this into the game (perhaps as a cheat/debug feature, perhaps something else).

taptap November 15, 2013 10:25

It is fascinating that this seems to make perfect sense in Sil, but I fail to understand how this is supposed to work in real life. Good enough for an insurance company for sure, but that wine can be calculated into an uniform liver cirrhosis risk equal for the first glass and the last is almost certainly bogus.

fph November 15, 2013 11:27

Quote:

Originally Posted by half (Post 86733)
This is fascinating. I'd be interested in somehow incorporating this into the game (perhaps as a cheat/debug feature, perhaps something else).

I'd love to see it included, too. I can easily provide a diff/patch file that you can apply to the Sil source.

There are some opportunities for refactoring the existing code while including this part; for instance, in Sil there are
* a function that makes a protection roll and returns the result
* two functions that compute min and max protection (for displaying)
I added
* a function that computes the probability distribution of the protection roll.
The four are independent, but probably they should be merged not to duplicate the logic. I can work on it and similar issues.

fph November 15, 2013 11:30

Quote:

Originally Posted by taptap (Post 86734)
It is fascinating that this seems to make perfect sense in Sil, but I fail to understand how this is supposed to work in real life. Good enough for an insurance company for sure, but that wine can be calculated into an uniform liver cirrhosis risk equal for the first glass and the last is almost certainly bogus.

I totally agree. For this project "millimort" is just a fancy name for "take the probability of dying and multiply it by 1000"; I am very skeptical that this measure works also as a quantitative tool in real life.

half November 15, 2013 12:52

Quote:

Originally Posted by fph (Post 86735)
I can work on it and similar issues.

That would be great.

Maybe there should be some extra character sheet for people who want additional stats such as:

1) Real time spent in the game (with pauses between turns capped at 1 minute to avoid counting times when you are away from the computer)

2) Missed artefacts.

3) This milimort thing.

4) Possibly some other things, like the probability that the blow that killed you was going to kill you.

My thinking is that these are all things that I wouldn't want in the standard game -- the first two because they can be frustrating. However, they are pretty cool for the people who do want them. I could thus bury them a bit in the options or something.

kryft November 15, 2013 12:55

Wow! I bet Sil is the only roguelike with two simulators written for it. :) It would certainly be interesting to see this included in the game.

Originally I also computed exact distributions instead of sampling, but I ran into some Haskell-specific performance issues that I couldn't solve due to my inexperience with the language.

debo November 15, 2013 12:57

I already added 2) to mpa-sil for deathdumps, but I don't think it should be in the core game either. Maybe if it was some sort of spoilers file you could generate on death (I think Vanilla does this?)

kryft November 15, 2013 13:07

Quote:

Originally Posted by half (Post 86739)
That would be great.

Maybe there should be some extra character sheet for people who want additional stats such as:

1) Real time spent in the game (with pauses between turns capped at 1 minute to avoid counting times when you are away from the computer)

2) Missed artefacts.

3) This milimort thing.

4) Possibly some other things, like the probability that the blow that killed you was going to kill you.

My thinking is that these are all things that I wouldn't want in the standard game -- the first two because they can be frustrating. However, they are pretty cool for the people who do want them. I could thus bury them a bit in the options or something.

One small detail that I've been thinking of is that for fsil it would be nice if item weights were listed on char dumps. Currently it's impossible to determine the protection bonus from Heavy Armour Use without resorting to a silly hack, and even the hack won't help if you want to know how the bonus changes if you wear some other armor or how large the bonus would be for a character who doesn't have the ability yet. (The hack is to look at the listed maximum protection and subtract all other contributions to protection, which can be determined.)

I didn't request this before because it felt silly to ask you to clutter your char dumps to make my pedantic simulations easier, but perhaps this too could be buried in the options somewhere. I suppose I could even try to write a patch for this myself if that helps. I do understand if you don't want to do this anyway!

kryft November 15, 2013 13:10

Quote:

Originally Posted by debo (Post 86742)
I already added 2) to mpa-sil for deathdumps, but I don't think it should be in the core game either.

It would be a great way to troll people who hate forced descent, though!


All times are GMT +1. The time now is 05:44.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.