Dice

We often see people complaining that the dice on Dominating 12 are unfair. This page collects all the information about the dice in existence to be as clear and transparent as possible, and to act as a resource to link people who are claiming the dice are unfair to.

For more information about the different dice options, check out the dice page, which describes the different options possible. To find a longer discussion with further detail on the website's dice, check out this forum thread.

Too long; didn't read

If you just want a quick summary, below are the main points.

  • To simulate the outcome of any battle, we first generate the dice rolls that would happen in a real-life game, and then use the official rules to calculate how many troops each player loses.
  • The dice rolls are simulated in such a way that they are indistinguishable from a truly random die roll you would make by actually rolling a die. That is to say, they are both equally unpredictable.
  • When evaluating the fairness of dice, there are several parts of human psychology that get in the way. Humans often think that random is the same as uniform, and they often remember bad results more clearly than good results. Together, this creates a bias that the dice may be unfair, even though they statistically are not.
  • Many games don't offer true randomness. Instead of generating a correct random result, they generate a result that people are most likely to think as correct. Dominating 12 has chosen to stay true to the original game mechanics by using accurate dice rolls, but it has added a balanced dice option for people who prefer more predictable outcomes of their battles.

The dice algorithm

The algorithm consists of the following steps:

  1. Using a cryptographically secure pseudo-random number generator (CSPRNG), we generate one byte for each die roll we want to do. A byte is a number between 0 and 255.
  2. Since there are 256 unique values in a byte, but 256 is not divisible by 6, if the number is 252 or higher, we generate a new byte instead to ensure all numbers have an equal chance of occurring.
  3. To transform the byte into the number rolled by the dice, we do an operation called modulus. This is the same as dividing a number by another, and taking the remainder. So if we wanted to take a generated 51 and turn it into a roll for a six-sided dice, we would take the remainder, which is 3, since 51 = 6 * 8 + 3.
  4. We normalise so that the dice rolls are 1-6 instead of 0-5.
  5. Now that we have rolled our virtual dice, we use the official game rules to compare the values of the attacker and defender, and update the game board accordingly.
  6. The results of our virtual dice rolls are shown in the game at the top of the page. To make them easier to interpret, they are already sorted from high to low so you can compare them more easily. This is not the order in which they have been generated.

Computers can never generate truly random results, but they are pretty good at approximating true random. We call these "fake" distributions pseudo-random. For Dominating 12, we use the pseudo-random number generator that is used by OpenSSL. It has the property that it is cryptographically secure. What this means is that even a computer that knows all the past numbers that have been generated cannot predict what will come next. This makes the numbers it generates indistinguishable for true random to the human eye.

Experiments

To make sure that our implementation is correct, we regularly run experiments that simulate the dice rolls exactly as we roll them in the game. Randomness will introduce noise, but if we keep rolling enough times, at some point our rolls will approach the expected probability of our outcomes.

In the following table you can see the probabilities that we achieve mathematical chances for a battle where the attacker has at least 3 attacking units, and the defender at least 2 (the most common scenario by far).

Outcome Expected % Actual %
Attacker kills 2 troops 37.17% 37.00%
Attacker kills 1 troop, loses one 33.58% 33.45%
Attacker loses 2 troops 29.26% 29.56%

As you can see, there is a small difference between the actual result and the final result, but this is expected. If we kept rolling, those differences would slowly disappear.

Randomness and probability

Computers are bad at true randomness, but human brains are probably even worse. There are several effects at play at any given time. If you were asked to randomly distribute one thousand red and blue balls over a football field, how would you do it? You would probably make sure the balls are roughly evenly distributed, and that the colours are nicely mixed. This is not random at all. In an actual random distribution, you would get groups of red balls and groups of blue balls. Parts of the field would have a lot of balls, other parts would be much emptier. This is the nature of randomness. Randomness is ugly.

Let's look at a sequence of ones and zeroes. You could say that this is a coin toss, with a 1 being heads and 0 being tails. Let's generate one hundred of these:

1000011110100010101000010101110001011110001011011000000101111100111001100001001001000110001010011111

These were generated using a true random generator at random.org, yet parts of it don't look random at all. At some point we generated six zeroes in a row, and almost right after than, five ones. This isn't so unlikely as you might think. When this happens with dice, suddenly you may be losing (or winning) a few battles in a row.

There are psychologically proven biases in how we perceive data (for example the clustering illusion) that make it hard for us to accept when data is random, and when it is not. On top of that, we tend to remember outliers more than normal averages. We may play ten games with pretty average results, but then in the eleventh one, everything seems to go badly for us (this is an instance of the clustering illusion mentioned above). We remember that eleventh game, but those earlier ten games, we forget about easily. Over time, only these weird results stand out, and this gives us the feeling the dice are unfair.

Randomness in other games

The human psyche is somewhat predictable when it comes to randomness. Game designers often care more about the player having fun than the randomness in a game being accurate. This is why many games don't implement true randomness, but instead implement something that is more in line with what people think as randomness.

In many games, you can get loot/drops from killing monsters or completing tasks based on random chance. Maybe the item you really want has a chance of 1 in 100 to drop. It is completely possible that after 200 or even 300 rolls, you still don't have the item. This tends to lead to frustration, which is what game designers want to prevent. Often, games will implement a mechanic so that if you still don't have the item after 100 rolls, the probability will quietly increase to make sure you actually get it.

On Dominating 12, we have purposefully chosen to stay true to the original probabilities and outcomes of the game. This is why people may complain that Dominating 12 is less fair than other sites. In reality, these other sites are more than likely to tweak the results of their algorithm to give more favourable results.

To allow for people who don't like this feeling of randomness, Dominating 12 supports a balanced dice game option that is available by enabling advanced settings on the game creation page. Balanced dice don't significantly alter the probability of an attacker winning over a defender, but it does make it more likely that both players lose troops, making the number of outliers much smaller. You can learn more about dice options on the dice page.

FAQ and myths debunking

You have admitted your dice are not truely random, so the dice are unfair.

True randomness is possible to achieve by using external services, but they would make the website much slower. We've run experiments, and the results when using a true random generator are not different than using a pseudo-random generator.

Look at my results here. This truly can't be random!

Every result you can think of is theoretically possible. This website allows you to play a lot of Risk, and make a lot of dice rolls in quick succession (much more so than real life). Therefore you will see a lot more outliers come by, even though the vast majority of your rolls are much more average. The fact that you had a few outliers does not imply the algorithm is wrong - as a matter of fact, it's only proof that the algorithm is working well.

I keep losing battles, it must be the dice' fault!

It is easy to overestimate your chances. For example, some factors that you may not immediately consider:

  • When both attacker and defender roll the same number on the dice, the defender wins.
  • When both parties have a large enough army, the attacker has an extra dice roll and discards the lowest roll.
  • An attacker always has to leave behind one troop, so a 3v3 becomes a 2v3, stacking the probabilities in the defender's favour.

Players who've made it to a high rank of Dominating 12 understand how probabilities work, and often use calculators to get an idea of the possible outcomes. The Gambit Battle Odds Calculator is a powerful tool that you can use to plan complex moves, while this open source calculator is simple but effective.