I'm developing an open-ended strategy game. I am using the following formula to calculate damage (In PHP 'cause I don't know MathJaX!):
$rand = rand($a, $b) + $c;
$damage = $rand * sqrt(($d / 20) * $c));
a
, b
, c
, and d
are all values that can be modified by the user over the course of play, either by buying a better item (a
and b
), investing in the item (c
), or investing in their character d
.
What I want to do now is add a bit of randomness to the outcome of the equation. Because the game is open ended:
- a static value would become unnoticeable/negligible over time.
- a percentage based value would allow for too much noise over time.
So, I want to add a random value that is small at first, and grows with increased input, but has diminishing returns. I'm sure I need some kind of logarithmic formula, but I'm not sure how to go about it!