1
$\begingroup$

I am making a game where you want a skill value to modify some in game values. With a scale that goes from half to double. 50% to 200%. If I'd do it linear 125% will be the centre but I want the centre to be 100%.

I want a mathematical function:

  • Where I input and number from 0 to 100.
  • And get out a number from 0.5 to 2 or from 50% to 200%.
  • The function maps 0 to 0.5.
  • The function maps 50 to 1.
  • The function maps 100 to 2.
  • And I would like it to follow a logarithmic scale.
  • I do not care what happens outside the specified range.

I have made this Google Docs document which shows my plan B.

I hope someone out there can help me this has been a mathematical problem that has bugged me for years.

$\endgroup$
2
$\begingroup$

If $x$ is your input between $0$ and $100$, then $2^{\left(\frac{x}{50}-1\right)}=\exp(\frac{\ln 2}{50}x-1)$ will range from $.5$ to $2$ as specified.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.