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

For PBEM players in the Air and Armor modules I made drop down reporting dice

And then to go 1 step further. I created an on map die, that calls the dice roll and reports what hex the roll was made in.

I had also installed drop-down toolbar menus for specific 1-/2-/3-dice rolls for all the OCS and LoB modules before this request came my way.

What module is this. I don’t see the on map dice roller in the Air & Armor Wurzburg module assuming that is the correct module.

It is Air & Armor: Würzburg, Tactical Armored Warfare in Europe – Designer Signature Edition.

@Jardic, please remember to give a link to the module you mention. That makes it much easier for people to see what it is you are talking about.

The menu doesn’t really build statistics on the die rolls, but it does record which die roll was made (assuming the users are disciplined enough to use that menu). Of course, as mentioned above, if one records the session in a log (.vlog), then one can later extract the information using for example pywargame.

Hmm. Perhaps one can expand on that, and make the die on the map actually “roll” on the map showing different faces as it moves along, and ending in the actual die roll. Sort of like ZunTzu does it.

Yours,
Christian

this will also be in the soon to be released V-Corps module

This feature was added for the large group of PBEM players. It started with just doing the combat roll. Players kept adding more roll requests, (with the specific rule mentioned). The feedback I have received has been very positive. They say it saves then a ton of writing comments as to what each roll was for. I have been told they have started using it for F-t-F play also, so they have an easier time going back to reference a roll.

do you mean something like this.where the game uses custom dice?

It does not have a “rolling” effect. I supposed you could send multiple roll calls, and somehow leave enough time between each for players to “see” the die roll. before sending the final call.

I used a dynamic property to drive a Image “Layer” I tried using a ‘symbolic dice’ but this worked better

Kevin

My gaming group also plays a lot of GMT’s Sword of Rome. I created “dice caddies” for it. Clickable (action buttons) for reset and roll. Since players roll 1, 2, or 3 dice depending on how many CUs are in their stack. In the rare case that 2 rolls in a row are exactly the same I added a “reset” image. Since I use hot keys all my dice are F1 for reset, F2 for roll. My Opponents have gotten used to hearing me on discord saying "F1, F2, " then usually a swear word as vassal give me the worst possible roll for the current situation.
Of course I made a caddy for each faction.

Oops I opened the wrong version of the module, The caddies have been updated. I added the number of dice per CU,

I see value in the original post “requesting dice roll statistics”, not for checking the random number generator, but for seeing player results from the game. This might be in the domain of module writers, but perhaps the VASSAL engine can help.

For instance, there are quite a few Commands and Colors games here on VASSAL. One of the best modules is for Command and Colors Ancients. This module has a block loss counter that some of the other genres (Battle Cry, Samurai Battles) do not have. This is a very useful game-specific metric to track and is especially valuable for tournaments.

Some additional dice metric tracking for games in this game system would be: how many (game specific semantic) “attack” dice were rolled by each player, how many dice caused (game specific semantics) “hits, retreats, leader kills”.

This kind of summary is useful not for checking the dice roller randomness, but for addressing game questions such as “who was lucky”? Player A rolled 50 attack rolls and scored 10 hits. Player B rolled 25 attack rolls and scored 8 hits.

This kind of summary is probably best captured by judicial use of the chat and Report Action traits. These will go in the log file (.vlog) which can then be analysed post-action.

The use of Report Action traits will often imply that users take some action based which makes the module do something (perhaps including a die-roll), which then is recorded in the log via Report Action.

For modules that are purely virtual cardboard, it is not so obvious that Report Action traits helps.

In other modules, like many of those I’ve done, where f.ex. combat odds are calculated automatically, and combats resolved automatically, the reporting is done automatically. For example, a module may say units a, b, and c, attacks unit z in 0803 at odds 3:1 with DRM +1, and Combat in 0803 with die roll 4+1=5 results in DE. Post-action, it will be fairly easy to analyse the log file (using e.g., pywargame) to determine which player was “lucky” and which wasn’t.

Yours,
Christian