Math > Logic for a Logarithmic Score Meter
Posted
by
oodavid
on Game Development
See other posts from Game Development
or by oodavid
Published on 2013-11-12T22:44:13Z
Indexed on
2013/11/13
4:15 UTC
Read the original article
Hit count: 283
math
|leaderboards
I'm trying to implement a score meter whereby I specify a maximum value (say 15,000) and I can render values on it in a logarithmic manner ie:
+------+---+--+-++ +------+---+--+-++
|== | |====== |
+------+---+--+-++ +------+---+--+-++
200 pts 1,000 pts
+------+---+--+-++ +------+---+--+-++
|============= | |================|
+------+---+--+-++ +------+---+--+-++
5,000 pts 15,000 pts +
The upper bound needs to be variable, and need to be able to convert a score to a percentage, using the above mockup as an example:
score2pct(15000, 200) = 0.2
score2pct(15000, 1000) = 0.4
score2pct(15000, 5000) = 0.8
score2pct(15000, 15000) = 1
Does anyone have any pointers for me?
© Game Development or respective owner