This could be due to cringe-worthy original statistics; the vanilla implementation could very well be 1% per hour, compounded by multiplying hoursToWait by 0.01 to get the probability of interruption, with 24% at 24 hours. Admittedly, not a bad approximation for a 1% probability. For 25% at 24 hours, the true hourly rate is not much different--about 1.2% (taking 1 - 0.75^(1/24)).wareya wrote:It's around 25% on 24 hours. It's less likely at 1 hour, but can still happen.
Resting outside is nearly always interrupted
Re: Resting outside is nearly always interrupted
Re: Resting outside is nearly always interrupted
Or one could just reverse engineer the game like they have been.
The existing implementation wasn't pulled out of thin air.
The existing implementation wasn't pulled out of thin air.
Re: Resting outside is nearly always interrupted
Let’s apply the scientific method.
We have the following hypothesises about Vanilla behaviour
Answer, we need to measure the probability for different lengths of time sleeping.
If we assume that item 3 is true, and the deviation is due to quantization/truncation, then it will be most noticeable for small values number of hours of sleep, and get less as the number increases.
Assume that at 24 hours, probability of being disturbed is 25%.
If distribution is uniform (i.e. first hypothesis), at 12 hours, probability should also be 25%.
If distribution is exponential (second hypothesis) then probability should be 1 - (1-0.25)^0.5 = 13.4%
At 6 hours, uniform probability will still be 25%, but exponential will be 6.9%.
At 3 hours, uniform probability will still be 25%, but exponential will be 3.5%.
If we measure the probability at 24 and 12 hours of sleep we can hopefully minimize the uncertainty/error due to quantization/truncation and so decide if it’s more likely to be uniform or exponential. And as time gets shorter, if there are quantum effects, the measured values should deviate further and further from the expected ones.
Next step is to gather data and compare with the predictions.
We have the following hypothesises about Vanilla behaviour
- The probability of being interrupted when sleeping was supposed to be constant {either fSleepRandMod or (1 – fSleepRandMod)} regardless of how long you slept.
- The probability of being interrupted when sleeping {either fSleepRandMod or (1 – fSleepRandMod)} is checked each hour. i.e. Each hour you sleep the dice are rolled to see if you are interrupted.
- While one of the two was the intended behaviour, there are quantization/truncation effects that cause the implementation to not match the above intended behaviours.
Answer, we need to measure the probability for different lengths of time sleeping.
If we assume that item 3 is true, and the deviation is due to quantization/truncation, then it will be most noticeable for small values number of hours of sleep, and get less as the number increases.
Assume that at 24 hours, probability of being disturbed is 25%.
If distribution is uniform (i.e. first hypothesis), at 12 hours, probability should also be 25%.
If distribution is exponential (second hypothesis) then probability should be 1 - (1-0.25)^0.5 = 13.4%
At 6 hours, uniform probability will still be 25%, but exponential will be 6.9%.
At 3 hours, uniform probability will still be 25%, but exponential will be 3.5%.
If we measure the probability at 24 and 12 hours of sleep we can hopefully minimize the uncertainty/error due to quantization/truncation and so decide if it’s more likely to be uniform or exponential. And as time gets shorter, if there are quantum effects, the measured values should deviate further and further from the expected ones.
Next step is to gather data and compare with the predictions.
Re: Resting outside is nearly always interrupted
The existing implementation (as provided by Scrawl's PR) is wrong in at least three places.wareya wrote:Or one could just reverse engineer the game like they have been.
The existing implementation wasn't pulled out of thin air.
1. If will NEVER be interrupted if you sleep for 1 hour.
2. You have a 50/50 change of being interrupted if you sleep for 2 hours.
3. As the time you sleep for increases, the probability of being interrupted approaches 71%.
Re: Resting outside is nearly always interrupted
How wrong it behaves has nothing to do with wherever the algorithm came from. It's hard (as in strictly speaking) reverse engineering. It's not bullshit. It has its form for a reason, even if it's not right. The fact that it's wrong doesn't mean that we need to come up with anything that seems to be close to vanilla; it just means that more reverse engineering work has to be done, and we should treat it like we don't have any implementation at all. This isn't difficult.
Re: Resting outside is nearly always interrupted
If you rest until healed, you can rest for far more than 24 hours. I rested for 51 hours last time I played.
Re: Resting outside is nearly always interrupted
Hrnchamd updated the wiki. The comparison should have been < instead of >. Other than that, everything's correct.
Re: Resting outside is nearly always interrupted
Just wondering if this has been fixed since I'm active in that area of the code. I can resolve this issue as well.
Re: Resting outside is nearly always interrupted
Thanks for the heads-up, scrawl.
Re: Resting outside is nearly always interrupted
I did some testing of Vanilla, here's my results.
I slept 50 times for a varying number of hours. (1, 2, 3, 4, 5, 6, 12 and 24), counting the number of times I was interupted.
Assuming that the probability of being interupted was purely a function of time sleeping, I think I can regard the data as a Binomial distribution for each time period.
with p = probability of being disturbed, and (1 - p) probability of not being disturbed.
Then, I use http://en.wikipedia.org/wiki/Binomial_p ... e_interval to estimate the 95% probability for the value of p for different hours.
Giving the following table.
Hours Slept Interruptions estimated p error Min(p) Max(p)
1 0 0 0
2 0 0 0
3 0 0 0
4 8 0.16 0.10 0.06 0.26
5 17 0.34 0.13 0.21 0.47
6 18 0.36 0.13 0.23 0.49
12 8 0.16 0.10 0.06 0.26
24 9 0.18 0.11 0.07 0.29
I slept 50 times for a varying number of hours. (1, 2, 3, 4, 5, 6, 12 and 24), counting the number of times I was interupted.
Assuming that the probability of being interupted was purely a function of time sleeping, I think I can regard the data as a Binomial distribution for each time period.
with p = probability of being disturbed, and (1 - p) probability of not being disturbed.
Then, I use http://en.wikipedia.org/wiki/Binomial_p ... e_interval to estimate the 95% probability for the value of p for different hours.
Giving the following table.
Hours Slept Interruptions estimated p error Min(p) Max(p)
1 0 0 0
2 0 0 0
3 0 0 0
4 8 0.16 0.10 0.06 0.26
5 17 0.34 0.13 0.21 0.47
6 18 0.36 0.13 0.23 0.49
12 8 0.16 0.10 0.06 0.26
24 9 0.18 0.11 0.07 0.29