Dice roll tracker

Is it possible down the road to enable Vassal to record all dice rolls by player side and dice roll type (either number of dice or game-specific named dice rolls), and then generate a summary report at the end of a game or given gaming session? Thanks

Why would you want this? VASSAL’s pseudo-random number generator uses an industry-standard algorithm, so I can assure that its results are going to be indistinguishable from true random numbers.

I’m making this request on behalf of someone else. One of the game developers I’m supporting thinks such a report would provide information on whether a particular game session outcome is affected by unusually high or low dice rolls for particular turns, providing information on overall scenario balance. He says that he saw such a feature on VASL…I wouldn’t know, as I don’t play Advanced Squad Leader (yet).

If the players record a log (.vlog), then one can process that to get the die-rolls. For example, to get the die rolls in the tutorial log (Tutorial.vlog) of Battle for Moscow, one can do

$ vsavdump.py Tutorial.vlog | grep "CHAT\*\*\* 1d6"
LOG	CHAT*** 1d6 = 4 *** <a>;\\\\
LOG	CHAT*** 1d6 = 6 *** <a>;\\\\
LOG	CHAT*** 1d6 = 2 *** <a>;\\\\
...

(vsavdump.py is a utility in pywargame)

One can then filter out the die rolls and player with for example

$ vsavdump.py Tutorial.vlog | grep "CHAT\*\*\* 1d6" | sed 's/.*= \([0-9][0-9]*\) .*<\(.*\)>.*/\2,\1/'  > die-rolls.csv
$ cat die-rolls.csv
a,4
a,6
a,2
...

One can then use a Χ-square test against a discrete uniform distribution to check if rolls are not uniform (within some confidence level).

“Indistinguishable” is something of an overstatement. Computer generated random numbers will always be pseudo-random numbers. If, by “indistinguishable” mean that the random numbers for all intents and purposes look random, then fine, but one shouldn’t think that they are truly random.

Pseudorandomness is actually not a bug but a feature. Often, you want to be able to reproduce a particular sequence of random numbers, given a known starting seed.

To get truly random numbers, one would need to use some truly random process - for example by measuring the time between radioactive decays.

One would have to be very careful making assertions based on such a sample.

For example, the above .vlog contains 43 die rolls, and a Χ-square test gives a p-value of 0.003, which would make us reject the null-hypothesis that the die is unbiased. However, we should consider the number of die rolls in our sample: 43 is not a lot of observations, and the whole test is dubious.

A different approach, which I’ve used in a number of modules - for example Gettysburg: 125th Anniversary Edition - is to define an alternative, loaded dice. If the users choose to use that dice, then the die rolls are no longer uniformly distributed, but rather triangular distributed i.e., middle values are more probable than extreme values. In this way, one can remove some of the significance of luck from the game.

Check the source code of the VASL custom classes.

Yours,
Christian

I will point out that while I understand the intent, the premise is flawed.

Even if the overall game randomness is exactly average, the context of a given random roll drives huge swings in game luck.

Some rolls are critically important while others are trivial.
If all the critical rolls go in favor of player-A, then the luck is not “average” regardless of the overall game randomness statistics.

So unless ALL the rolls are equally important or you have a way of differentiating randomness by game_criticality_weight, you aren’t going to get anything valuable out of the requested feature.

BTW - this is something I have considered and discarded for my own game module, so have thought about the problem at length.

2 Likes

I get where you’re coming from; having rolled twelve, yes twelve ‘ones’ in a row playing a solo battle of Rio Plata. Needless to say, I needed higher rolls to succeed - frustrating.

However, I do think it stll gives a more-or-less true to life sequence of events as, for most games, we’re not trying to simply recreate a historical battle, but actually re-fight it. It makes games replayable, as no two playthroughs are the same.

Real life battles have been like this too: Take the Battle of Midway. Even with the American code breaking and the pre-positioning of the US task forces northeast of Midway, Japan should not have suffered so total a tactical and strategic loss, given the forces arrayed against each other. The USN rolled a number of sixes in a row.

But that’s just my opinion. I respect yours as well.

It is a common misconception - not accusing anyone in particular of it - that rolling the same number many times in a row means the die is biased.

Another variant of the same misconception goes something like: For the past N rolls I’ve only gotten 1s, 2s, 3s, 4s, and 5s. Surely the next roll must be a 6.

Both expectations - not rolling the same value in consecutive rolls or getting a 6 on the next roll - are entirely unreasonable. Remembering your primary school probability classes, each row is independent of the previous rolls. That means, that the probability of rolling a particular value in each roll is exactly the same as in the previous roll. Thus, the chance of rolling a 1 on the twelfth roll is exactly the same as the probability of rolling a 1 on the eleventh roll: 1 in 6.

We can calculate the probability of 12 rolls of 1 out of 12 rolls. For that, we would use the binomial distribution

               n!
P(n,r) = ------------ * p^r * (1-p)^(n-r)
          r! * (n-r)! 

where p is probability of success (rolling a 1), n is the number of trials, r the number of success (rolling a 1), x! = x*(x-1)*(x-2)*...*1, and x^a means x to the power of a. With p=1/6, n=12, and r=12, we get

                 12!                                        12!
P(12,12) = -------------- * (1/6)^12 * (1-1/6)^(12-12) = -------- * (1/6)^12 * (5/6)^0 = (1/6)^12 ~ 0.0000000005 = 0.00000005%
           12! * (12-12)!                                12! * 0!

because, by definition, 0!=1, and x^0=1. Thus, rolling 12 ones in a row is rather unlikely, but not impossible. Thus, we cannot conclude from rolling 12 ones out of 12 trials, that the probability isn’t 1/6.

Generally, our intuitions about probability is rather poor. It really takes one to do the Maths before we can say much about it.

Just to be clear: I used Gary’s (@BB.30) example by way of illustration - in no way do I imply that Gary does not understand this. I’m perfectly convinced, from what Gary wrote, that there’s no misunderstand on that part.

Yours,
Christian

1 Like