Created
March 19, 2016 12:44
-
-
Save fabio-t/ea93766e98a03e3eb425 to your computer and use it in GitHub Desktop.
Diminishing returns formula
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static double diminishing_returns(double val, double scale) { | |
if(val < 0) | |
return -diminishing_returns(-val, scale); | |
double mult = val / scale; | |
double trinum = (Math.sqrt(8.0 * mult + 1.0) - 1.0) / 2.0; | |
return trinum * scale; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Taken from here. Can be greatly useful.
For example, suppose you define a Skill, Climbing, that makes you decently good very fast but it takes a huge amount of effort to really master. Suppose each skill has levels from 0 to 500, and to go up one level it requires a certain "effort" (experience, money, whatever). Now, if "decently good" means skill level 100 and "mastering" means skill level 500, we could use a scale of 20 to get the following progression:
So, before skill level 100, small efforts yield big level increases. So we get to "decently good" quite fast.
After skill level 100, increasingly more effort is required to go up one level. To get to a level less than 3 times higher than "decently good", we need 5 time the effort it took us to get there.