## Random Drop Rates

Started by winkio, June 21, 2016, 03:07:16 am

#### winkio

##### June 21, 2016, 03:07:16 amLast Edit: June 21, 2016, 03:23:01 am by winkio
Drop rates are used in two ways in games: common rates, where the player is expected to get numerous drops as they play, and rare rates, where a special item has a small chance of dropping, forcing the player to grind to get the item.

Common rates work well, and they aren't really that interesting mathematically.  If everything I kill in a Zelda game as a 25% chance of dropping a rupee and I kill thousands of things over the course of a game, rupees will drop fairly steadily.

Uncommon rates are tricky.  If I spawn an endless wave of monsters that have a 10% chance to drop a key needed to get to the next room, how many monsters does the player need to kill to get the key?  The answer is not 10.  It's actually pretty complicated.  What we get is a table of a percentage of players that get a key by the time they kill X number of monsters:

``#Kills  %Players1       10%2       19%3       27%4       34%5       41%6       47%7       52%8       57%9       61%10      65%20      88%30      96%40      99%``

So we can see that over one third of all players have to kill more than 10 monsters to get the key.  Of course, there are also some that get the key on the first or second monster.

What is the math behind this?  First, total the probability of the player not getting the key N times.  Since there is a 90% chance of not getting a key each drop, it is 90% * 90% * 90% ... n times, or 0.9^n.  But since I want the probability of the player getting a key (or multiple keys), I subtract this value from 1.

P = 1 - (1 - dropRate)^n

Let's take a look at another result.  Let's say you want to have your super secret special item drop with a 1/1000 chance, or 0.1%.
``#Kills    %Players1         0.1%10        1%100       10%1000      63%2000      86%3000      95%``

There's still 14% of your players that don't get your drop even after killing 2000 monsters.  Clearly this will be frustrating for them.

So what are some alternatives?  There is no easy answer, but this is one solution that I like:

Increase your drop rate every time the drop fails, and reset it once the item drops.  Take a look at the 10% drop rate example, now with an additive 10% increase every time the drop fails (10%, then 20%, then 30%, etc.):

``#Kills  %Players1       10%2       28%3       50%4       70%5       85%6       94%7       98%8       99.6%9       99.96%10      100%``

The drop rate is quite aggressive now, but we know that if the player does not get the drop for 9 kills in a row, then 10th kill is guaranteed to drop with a 100% chance.

The math here is slightly more interesting.

P = 1 - product(1 - dropRate * i, from i = 1 to i = n)

For the 10% case, we can write it as:

P = 1 - (9!/(9 - n)!) * 0.1^n

But overall, this is not really what we want.  Half of the players are getting the drop in 3 kills.  Let's try another solution that does away with the 10% rate altogether.

Let's set the drop rate to start at 2^(-9), and double it each time it fails to drop (2^-9, 2^-8, 2^-7, etc.), while still resetting on a successful drop.

``#Kills  %Players1       0.2%2       0.6%3       1.4%4       2.9%5       5.9%6       12%7       23%8       42%9       71%10      100%``

Finally, we have something that looks like we want.  Most of our players will not get the drop until the higher number of kills, but there is a hard cap at 10 kills that guarantees every player will get the drop.

What does the math look like?

P = 1 - product(1 - 2^(a - MaxN), from a = 1 to a = N)

in this case, we have maxN = 10, so

P = 1 - product(1 - 2^(a - 10), from a = 1 to a = N)

This can be expensive computationally, but there are some shortcuts.  There might even be a way to simplify the product expression to an exponential term, but I'll have to look at that later.

Hopefully I have imparted a small amount of distrust for low random drop rates to you.  If you have any ideas on other ways to make a good drop rate system, I'd love to hear them.  Otherwise, if you are stuck grinding for something in a game and it feels like it's taking way too long, now you know why >_>

#### Blizzard

##### June 21, 2016, 05:39:16 am #1
Check out Daygames and our games:

 King of Booze 2 King of Booze: Never Ever Drinking Game for Android Never have I ever for Android Drinking Game for iOS Never have I ever for iOS

Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

#### winkio

##### June 21, 2016, 04:02:46 pm #2 Last Edit: June 21, 2016, 04:07:59 pm by winkio
I thought of two more ways to do rare drop rates.

The first way is to drop item components at a common frequency that can be traded or combined to make the rare item.  So instead of a sword dropping with a 1/1000 chance, you drop sword pieces with a 1/4 chance, and give the player the ability to exchange 250 sword pieces for the sword.  Pretty straightforward.

The other way requires no multiplication or exponents, but still increases the drop rate on failure.  This is done by subtracting the drop rate from the total probability for each failure.  So for a 10% starting drop rate, it would be (1/10, then 1/9, then 1/8, etc.)

``#Kills  %Players1       10%2       20%3       30%4       40%5       50%6       60%7       70%8       80%9       90%10      100%``

This data is a result that seems very clean and logical to us, although it is not obvious why it occurs.

Let's look at the math:

P = 1 - product(1 - (dropRate / (1 - dropRate * (i - 1))), from i = 1 to i = n)

Looks complicated.  Let's look at the actual terms inside the product for dropRate = 10%

``i  product term1  9/102  8/93  7/84  6/75  5/66  4/57  3/48  2/39  1/210 0/1``

What happens as we multiply the terms together?  9/10 * 8/9, the 9s cancel, and we end up with 8/10.  8/10 * 7/8, the 8s cancel and we end up with 7/10.

So we can write the product term as product = 1 - n * dropRate.  Now we get a much simpler equation for P:

P = 1 - (1 - n * dropRate)
P = n * dropRate

And there we have it, the simple result we saw in the table above.

#### Zexion

##### June 21, 2016, 05:07:36 pm #3
Nice stuff winkio, I always liked messing with drop rates when i worked with rs private servers. I think it's important to also note the necessity of the drop. If the player needs the drop to continue, then something like the typical super random rare drop rate in the first example wouldn't be optimal. If the item was purely cosmetic/optional then that first rate is completely fine and kinda fun actually. In any case, drops are cool
;o

#### winkio

##### June 21, 2016, 05:16:53 pm #4
Idk, in my opinion it's a bad idea even for cosmetics or optional things.  I remember grinding for a Rod of Discord in Terraria, which had a 1/500 drop rate.  Something that usually only takes an hour or two on any given playthrough took 11 hours when I had to kill 1700 Chaos elementals for the drop (Terraria gives you a banner every 50 kills, so it's easy to keep track).  The whole point of these low drop rates is to make players grind for the item, unless they get really lucky.  But it's cruel to force a small percentage of players to grind double or triple the time it takes for everyone else.  Especially when you start looking at games with large player bases like MMOs, it's possible that some players will never get the drop no matter how much they grind.

#### KK20

##### June 21, 2016, 05:37:19 pm #5
Quote from: winkio on June 21, 2016, 05:16:53 pm
The whole point of these low drop rates is to make players grind for the item, unless they get really lucky.  But it's cruel to force a small percentage of players to grind double or triple the time it takes for everyone else.  Especially when you start looking at games with large player bases like MMOs, it's possible that some players will never get the drop no matter how much they grind.

Basing this argument for MMOs:
But wouldn't the item rapidly lose its value? If you make it any easier, you effectively make the rare item less appealing to everyone (and make it much cheaper when trading). I'd rather have an item go to a lucky individual rather than Oprah screaming "AND YOU GET AN ITEM, AND YOU GET AN ITEM! EVERYONE GETS AN ITEM!"

 Other Projects RPG Maker XP Ace Upgrade RMXP to RMVXA performance! XPA Tilemap Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

#### winkio

##### June 21, 2016, 05:56:12 pm #6
I'm not talking about purely making the item easier, but rather capping the amount of grinding.  There will always be some players that are lucky enough to get an item without grinding, and that is not a problem to me.  The problem is the group of players that decides to grind for the item.  Some of them will have to keep at it 2 or 3 or 10 or 100 times as long as the 'average' time to grind, for no other reason than random chance.  Is that good game design?

#### Zexion

##### June 21, 2016, 07:04:03 pm #7
Quote from: winkio on June 21, 2016, 05:16:53 pm
Especially when you start looking at games with large player bases like MMOs, it's possible that some players will never get the drop no matter how much they grind.

Yeah this is true. Idk how many steel dragons i killed in RS without any dragon armor drops. Like not once ._. I guess it does feel bad but at the same time there are usually other ways in a game to achieve said item outside drops that make it less bad and also make the experience of finally getting it worth the trouble.

#### G_G

##### July 01, 2016, 09:34:21 am #8
Quote from: KK20 on June 21, 2016, 05:37:19 pm
Quote from: winkio on June 21, 2016, 05:16:53 pm
The whole point of these low drop rates is to make players grind for the item, unless they get really lucky.  But it's cruel to force a small percentage of players to grind double or triple the time it takes for everyone else.  Especially when you start looking at games with large player bases like MMOs, it's possible that some players will never get the drop no matter how much they grind.

Basing this argument for MMOs:
But wouldn't the item rapidly lose its value? If you make it any easier, you effectively make the rare item less appealing to everyone (and make it much cheaper when trading). I'd rather have an item go to a lucky individual rather than Oprah screaming "AND YOU GET AN ITEM, AND YOU GET AN ITEM! EVERYONE GETS AN ITEM!"

In that case, instead of doing a substantial 10% every time, you could do the increased drop rate much lower. In a game Destiny (that I literally play all the time) there's these things called 3 of Coins. When consumed, they increase the chance of dropping an exotic engram (which turns into an exotic weapon or armor). If the chance fails, you can pop another one and it'll increase the chance much like winkio's ending formula, so at one point or another you are guaranteed an exotic item. But if you're worried about value, just adjust the amount that the chance is increased by or for super special items, don't increase it at all.

#### winkio

##### July 01, 2016, 11:57:12 am #9
The drop rate itself does not change by 10% each time.  It is 1/10, then 1/9, then 1/8, etc.  which is 10%, 11.1%, 12.5%, etc.

Also, I was just giving an example for a rate that started at 1/10, you could do the same thing with a rate that started at 1/1000.