Hello everyone!
I have a suggestion entailing a new, more accurate way that the randomness of battles can be calculated by the server.
There is a formula that can be used to extract a random value from a pool of values that levels exponentially.
It is called Gauss’s formula, after the mathematician Karl Friedrich Gauss who discovered it.
The formula calculates the sum of numbers from 1 to n by multiplying n by 1 + n.
The formula is below:
1 + 2 + 3 + ... + n = ½ n (n + 1)
For example, if you want to add together all the numbers from 1 to 10, you can take ½ 10 (10 + 1), which is ½ (110), which is 55.
Cool, right?
But how this can be implemented into the game?
The answer is by finding a random % multiplier between 0.8 and 1.2 to multiply to the raw damage value. This number would be recalculated each iteration, and there is a greater chance of getting a number close to 1 than a number towards the extremes.
For example, let's say a unit has 4.0 attack power. We'll multiply by 10 to get a whole number, so 4.0 x 10 = 40.
(4.0 is already whole, but sometimes there will be decimal attack values, so that's why this is necessary)
Next, we'll substitute n for 40 in Gauss's formula. ½ 40 (40 + 1) = ½ 40 (41) = ½ (1640) = 820.
Here's how this can be used in the game to make it simpler for the servers to choose a random multiplier:
Let's keep using our 4.0 attack power example.
What do you guys think?
I have a suggestion entailing a new, more accurate way that the randomness of battles can be calculated by the server.
There is a formula that can be used to extract a random value from a pool of values that levels exponentially.
It is called Gauss’s formula, after the mathematician Karl Friedrich Gauss who discovered it.
The formula calculates the sum of numbers from 1 to n by multiplying n by 1 + n.
The formula is below:
1 + 2 + 3 + ... + n = ½ n (n + 1)
For example, if you want to add together all the numbers from 1 to 10, you can take ½ 10 (10 + 1), which is ½ (110), which is 55.
Cool, right?
But how this can be implemented into the game?
The answer is by finding a random % multiplier between 0.8 and 1.2 to multiply to the raw damage value. This number would be recalculated each iteration, and there is a greater chance of getting a number close to 1 than a number towards the extremes.
For example, let's say a unit has 4.0 attack power. We'll multiply by 10 to get a whole number, so 4.0 x 10 = 40.
(4.0 is already whole, but sometimes there will be decimal attack values, so that's why this is necessary)
Next, we'll substitute n for 40 in Gauss's formula. ½ 40 (40 + 1) = ½ 40 (41) = ½ (1640) = 820.
Here's how this can be used in the game to make it simpler for the servers to choose a random multiplier:
Let's keep using our 4.0 attack power example.
- After multiplying the attack value by 100 (4 x 10 = 40), the product is split into all numbers from 1 to n. In this example, it would be 40, 39, 38, 37, 36, and so on until 1.
- Then, the system will need to eliminate values that will bring the result 20%, so it will first multiply the product of Gauss's forumla (820) by 0.8. This will give us 656.
- Next, the system will add the numbers from step 1 to each other, starting with the highest number (in this case, 40). It would continue doing so until it reaches the number from step 2 (656).
- All numbers that were added before 656 was reached will be "disacrded" and won't be used to multiply because they will produce a result that is more than 20% off the original value. In this case, adding the numbers from 40 down to 19 will give us 649, and then adding 18 will give us 667. All the numbers 19 and higher (but not 18) will be discarded.
- The remaining values (in this case, 1 through 18) are put in a pool.
- To ensure that values closer to 1 are chosen, each value will get additional numbers of their value Ɐ (opposite value). For example, 1Ɐ is 18, and 4Ɐ is 15. Thus, in this example, the value 1 will get 18 numbers of itself in the pool, the value 2 will get 17 numbers of itself in the pool, and so on until the value 18, which only gets 1 number in the pool.
- Randomly, the system picks one value from the pool.
- The number that is picked from the pool is squared.
- Also randomly, the system picks to make the value positive or negative.
- Then, the value is added or subtracted from the result of Gauss's formula (In this case 820). Let's say the value 4 is picked from the pool. 4 squared is 16. The computer chooses it to be negative. 820 + (-16) = 820 - 16 = 804.
- Now, the system will find 804 as a percentage of 820. It's about 98%.
- Lastly, the attack value (originally 0.4) is multiplied by the decimal form of the percentage (0.98) and the result is the new attack value! 0.39!
What do you guys think?
Judy Hopps, fearless officer, devoted to protecting Zootopia and all of its creatures.