Why Random Numbers and Probabilities Are Fascinating?

Why Random Numbers and Probabilities Are Fascinating?

What is the chance of having a head or tail after tossing a coin? 50/50? 60/40? Actually, the answer is none! It will be 51% for the front side and 49% for the back side. Why? I don’t know! But if you toss a coin infinite times, the chance of two sides will be 50%. So, the probability works when you do the action infinite times.

This example and story is one of the things that caught my interest in probability and random numbers. Now, let’s talk about the random numbers in Game Design (just because it is super interesting for me and may teach us useful life lessons)

The Definition

When we are talking about random numbers in general, the first thing that comes to our mind is throwing a dice, tossing a coin, or choosing a random number out of infinite numbers which is so simple and understandable. And that is right. Based on the Cambridge Dictionary, Random means “Chosen by chance rather than according to a plan” or “Unknown and unexpected in a particular situation” and these meanings make sense. So by applying the game design concept to these meanings, if we are designing a situation that is supposed to be random, we should convey the feeling of unpredictability to a user.


True Random Generation Numbers

Now let’s go back to the first thing we learned about random numbers; an unknown result of an action that every one of us is familiar with it. This is the first type of random numbers; Flat random numbers generation.

Flat Distribution

Some events roll a number between a minimum and maximum gradient. It is a regular random number that we talked about. But as you might have experienced in real life these kinds of random events and numbers might happen 5 times in a row or even not happen 8 times in a row although you have 50% of getting tail while you are tossing a coin.

Discrete Distribution

Some events have discrete states that have a similar probability. For example, you have to choose 3 cards in a deck of 52 cards. So, the chance of being chosen for each card is 1/52.

Truncated Normal Distribution

For some events, we might need a set (or just one) of numbers or results for each sub-event. In this case, we could create a set of possibilities based on a normal distribution to be chosen. Actually, the truncated normal distribution is a normal distribution bounded with a minimum and maximum value to keep the final results between these values.

Imagine you have a set of results, rewards, or whatever to show to the end user. Some of them are medium-value stuff, some of them are super high-value stuff, and some of them are low-value. Now, answer this question; will you consider the same chance for each of those stuff? If the answer is no, I’d say you are correct because you don’t want your designed environment to be chaotic, not balanced, or uncontrollable. And if your answer is yes, I’d ask you to go back to Flat random numbers! By considering the same chance for everything, you might damage your game’s economy, community, and so on.

Random Weighted Choices

As a real-life example of weighted choices, I would ask you to answer the following question. Which animal has a higher chance of survival against a leopard? A crow, deer, or rabbit? Basically, the answer would be a crow. But it doesn’t mean the deer and the rabbit won’t survive. Now, you can give these three a score or a weight of survival. Obviously, you can give a percentage chance but if you are designing dynamic results, you might not want to change the percentage chance of each occurrence every time you add another result. So, it is better to go with weighted choices and let the statistics and math do the magic.


Pseudo-random Generation Numbers

Hence the name, these numbers don’t have a true chance of occurring. It means that even if it has been shown that a result or an event has a 3% chance of occurring, it does not necessarily mean that in the first try, it has a 3% chance of occurring or even in the second try! Keep this until here and let’s re-read something again. When we are using Flat random number generation, having some streaks is unavoidable and might make your game unbalanced. So, to avoid having these streaks and balance the activities, we can use pseudo-random numbers. But how do they work?

Since I am a DotA fan, I was researching how they are handling their random number generation. And I got to know that they use pseudo-random numbers in some mechanics of the game. Now, let’s see how this implementation works…

Pseudo-random makes it so on average, you've more chances to get a "normal" behavior. It makes it so that every time you get a proc, you have fewer chances to get another, and every time you don't get one, you have more chances to have one. Also, it diminishes the chances of having "first hit" procs. Effects based on pseudo-random distribution (PRD) rarely occur many times in a row or go a long time without happening. This makes the game less luck-based and adds a great deal of consistency to many probability-based abilities. Also, gameplay-wise, PRD is difficult to exploit. In this implementation, the event's chance increases every time it does not occur but is lower in the first place as compensation. This results in the effects occurring more consistently.

The PRD works by increasing the percentage chance for activation by a certain amount every time it doesn't activate until the activation chance is over 100%. On the other side right after activation, the chance for another activation is significantly lower than the chance stated in the game. And… at the end, it makes everything less dependent on luck! And I think it is closer to our real life! Isn’t it?


Real-life Lessons

Now, after knowing the types of random numbers, I’d like to ask you a question again; can you relate real-world events with these random numbers? Haven’t you been in a situation where you have been trying to accomplish something but you have been failing many times but at the 999th try, you have finally made it? I think everybody has been in this kind of situation. This is so similar to pseudo-random numbers. Isn’t it? Because it might seem that your success chance at the beginning of a task might be 50% but you have succeeded after trying so many times. Actually, you have gained experience, skill, and wisdom after each failure, and every time you increase your chance of success.

On the other hand, you can definitely find too many events that are so similar to every type of random number!

I think it is a good place to ask ourselves; is luck involved in the success process? How rare is the chance of getting something, reaching a point in life, or even reaching a goal? I am pretty sure that it is not 0% and I am not going to answer these questions but if it is not 0%, It will happen someday; maybe it is based on regular random numbers, maybe it is based on pseudo random numbers. Nobody knows!


The End

I tried to keep everything so simple here and avoided statistical and mathematical talk behind it. I hope you enjoyed reading it and got some clues to research about. If you have anything related to this topic that might be helpful and have something new to learn for me, please don’t hesitate to send it to me and have a little discussion about it ??


Abdulkadir FINDIK

?And those who do not judge by what Allah has revealed are ?truly? the disbelievers.?

3 个月
回复
Amir Khavari

Senior Unity Game Developer

11 个月

Awesome article! Chance knocks on the door of people who are consistent and have waited for their chance! It's unbelievable when you observe how changing a random system, revolutionizes the feeling of the game. Keep doing what you're doing ??

Farzane F.

Background Designer | Illustrator | 2D Concept Artist | Digital Artist

11 个月

Great job Sina! This article is fantastic! I found it incredibly easy to understand, even though the topic can be quite complex. Your ability to break down different concepts is truly impressive. Looking forward to more interesting articles from you~

要查看或添加评论,请登录

Sina Hosseini的更多文章

社区洞察

其他会员也浏览了