# Have any video game designs used non-uniform random numbers in interesting ways?

A variety of video games use uniformly distributed numbers to decide the outcome of an event, such as a "50% chance to hit" almost always means to check if a random floating point number from 0-1 is greater than 0.5. Many games will layer a few of these uniform percentages on top of each other, for instance a D&D hit roll is a uniformly distributed number from 1-20, except that 1 and 20 have special outcomes. To my mind it seems like things like critical hits are added by designers to try and emulate the fact that in reality hitting/missing or winning/losing is not actually a binary outcome.

In many cases the real life amount of "damage" done by an attack would likely be closer to a gaussian/bell curve distribution, which many results in the middle but the occasional very exciting outlier and smooth curve connecting them. Dice games like Settlers of Catan emulate gaussian distributions by adding together multiple independent rolls, but I feel like I've almost never seen this mechanic in video games.

It seems like games like Civilization (Sid Meier talked extensively at GDC about player perception not matching the actual math used in the game) would benefit from results that matched how things work in the real world. Have any video games used a gaussian or otherwise non-uniform distribution of random numbers in interesting ways?

• lol @ Civ example. What an archer beating a Tank isn't fun? Haha! I suppose it depends if you are the one with the archer. :-) – paulecoyote Jul 20 '10 at 21:35
• I can't find the link right now, but the gist was that players were very upset when a "70% chance to win" as shown in the UI lead to occasionally losing. He blamed the fact that humans are bad at doing probability but I blame the fact that a "70% chance to win" doesn't even make sense in a world of analogue outcomes to battles. – Ben Zeigler Jul 20 '10 at 21:58
• Actually I think the problem was that the probability was calculated wrong, as it was only a heuristic prediction. You'd get 90% predicted when your chance was 98% or something to that effect. By the way, DnD also uses non uniform numbers- damage and HP are multiple dice rolls. – Superbest Feb 11 '12 at 13:35

Shooters often use Gaussian random distribution for weapon accuracy. (If you use linear random numbers and you have bullet decals, it's very easy for a player to see that the accuracy distribution is square, which "feels wrong.")

One interesting random selection method that you don't mention, but which shows up fairly often in games, is "random without replacement." This is analogous to drawing cards from a deck; the game runs in random order through a set of possible outcomes (put together with the desired distribution) and then "reshuffles." This is done to reduce the chance of lucky or unlucky streaks.

• The concept in your second paragraph is also known as a "Shuffle Bag". – Tetrad Jul 20 '10 at 22:01
• It's also common for shooters to randomly choose a point on a circle (ie an angle and radius) for bullet hits. This eliminates the square as well and ensures that more bullets hit near the center than not. – Sean James Jul 21 '10 at 11:42

I use Poisson distributions quite a bit - mainly when trying to work out the number of times that a random event should occur within a period of time.

This has the nice property that the distribution of events if you have two 1 second timesteps is the same as one 2 second timestep, so great for simulations with variable-length time steps.

Something that I have done in the past and that World of Warcraft currently does is to increase the chance of a random event based upon the number of tries since the last successful event. That is for instance, a quest item may have a 20% drop rate on the first NPC kill, a 22% on the 2nd, a 25% on the 3rd, resetting back to 20% when it does drop. I implemented a tech tree where the chance to discover a tech increased each turn until it was on the order of a 99.9% chance of occurring.

Random encounters in RPG-s are often non-uniform.

Set X to a random integer between 64 and 255.
For each step in plains, decrement X by 4.
For each step in forest, swamp, or desert, decrement X by 8.
When X < 0, a fight ensues. Go to step 1.


This makes encounters more realistic because animals/trees etc. like to have some space between them.

• I never really though about that, but that's a pretty slick approach to a lot of count-down randomizations. – Kzqai Nov 9 '15 at 13:55

I've seen critical hits in some action-RPGs before, but usually for action-based games the numbers are kept intentionally simple for a reason: the player is busy running and jumping and dodging and shooting, and they really don't have time to do probability calculations in their head.

So, you're more likely to see non-uniform numbers in things like turn-based strategy games. A typical example are "rogue-like" games (Nethack, Angband) which have non-uniform weapon damage -- one weapon might do 3d5 damage for example, and another does 4d4, and the game will tell you these numbers and it's up to you to decide which one is better (factoring in other variables like weapon weight, character proficiency, etc.)

• even warcraft 3 uses dice-based damage, most of the damages in the scenario editor use the formula "X+YdZ" – Henk Jul 22 '10 at 0:59

League of Legends has a hero named Gangplank with an attack that used to have pretty much uniform distribution which they changed to a gaussian. There is a circle area of effect where multiple hits may occur and they decided to make it cluster towards the center.