Blood Bowl 2

Blood Bowl 2

View Stats:
 This topic has been pinned, so it's probably important
Dode Sep 22, 2017 @ 9:04am
RNG - some questions answered
So, the RNG. Lots of ideas about it, lots of questions about it. Here are some questions which were put forward to the devs, a summary of their answers, and any explanation which might be desired for those who desire it.

Q. What RNG is used?
A. The RNG used is the one Python uses. This is the Mersenne Twister.

Notes - the Mersenne Twister MT19937. Wikipedia (if you trust it) tells us that this particular RNG has 3 desireable properties:
1. Long period. This is the number of iterations before the RNG repeats itself. In this case that is (2^19937) - 1, so really quite a lot (in the order of 10^6001).
2. It is k-distributed to 32-bit accuracy for every 1 > k > 623. That means that all sequences up to 623 numbers long are equally probable. This is important in BloodBowl, where typically a few hundred dice will be thrown. The "32-bit" part means that it produces a number between 0 and (2^32)-1, or 4,294,967,295. This is basically the output of the RNG.
3. It passes various statistical tests for randomness. These include diehard tests, tests for sequences, tests for bias etc etc.

The source code for the Python RNG can be found here[svn.python.org].

The MT is not cryptographically secure, so you wouldn't want your bank using it, but it is sufficiently random for dice rolls.

Q. How does the RNG output dice results?
A. Initiation is through the RandInt(a,b) command.

Notes - RandInt(a,b) is a Python command which produces a number from a to b inclusive. The code for this can be seen in the source code linked above. This command means you can use 1-6 (d6, block dice), 1-8 (scatter, injury) or just about any number (e.g. players on the pitch for the dreaded rock).

Q. We know the game uses server-side rolls, but does the server initiate a new RNG for each match, or does it have one RNG running and sending numbers to each match as they ask for it?
A. The server sets up a new instance of the RNG for each match.

Q. Does the AI tamper with or otherwise know the rolls beforehand?
A. The AI rolls exactly the same way as the player. Early campaign matches are scripted, as are challenges, but that's all.

So those were the questions. As I said before, the MT passes things like the diehard tests, but individual replays have been looked at as well, using chi square testing, autocorrelation and t-testing of actual vs expected rates. If you care to look into it you can do these tests yourself with software such as Excel (or probably Google Sheets, although I’ve not tried that), with dice parsing available from onesandskulls.com

Hope that helps.
Last edited by Dode; Sep 25, 2017 @ 8:45am