Calculate time bonus for quickest time?
![jonnyDiamond](http://forums.gamesalad.com/applications/dashboard/design/images/defaulticon.png)
Hi,
I am having trouble working out a good equation to calculate bonus points for completing the level in less time.
I have a levelScore and a levelTimer (The timer counts up, not down). At the end of the level I want to add the levelScore to some equation that gives the player more points, the quicker they complete the level.
It would be good to also have it calculate on a curve, so that the further the timer is from zero, the quicker the point bonus decreases.
Any ideas? ... Any MathMagicians out there?
Thanks heaps!
I am having trouble working out a good equation to calculate bonus points for completing the level in less time.
I have a levelScore and a levelTimer (The timer counts up, not down). At the end of the level I want to add the levelScore to some equation that gives the player more points, the quicker they complete the level.
It would be good to also have it calculate on a curve, so that the further the timer is from zero, the quicker the point bonus decreases.
Any ideas? ... Any MathMagicians out there?
Thanks heaps!
Comments
rule- if leveltimer is less than any_giventime_of_your_choice_for_a_just_ok_time
then change levelscore to
levelscore+(((any_giventime_of_your_choice_for_a_just_ok_time-leveltimer) * (any_giventime_of_your_choice_for_a_just_ok_time-leveltimer))/number to divide squared seconds of undertime to something sensible)
This would square the remaining seconds to an increasingly large number based on how short the player took to complete the level, then divide it by some number you wished to bring that number down to a range you wishes to give as bonuses, and add to the original score.
its an idea anyway...
hope it helps
kipper
That's without curve sorry but you could add back more points to the negative time for different time ranges
e.g. Negative time plus 1000 when time taken less than 10 seconds etc ...
Well I worked this out based on your help. If anyone knows better, please let me know.
`game.sceneScoreTotal = game.sceneScore +(( game.gameTimer /( game.gameTimer ^2))*10000)`
The gameTimer stuff at the end means the quicker you finish the better. Also it has a curve so that the further the timer is from zero, the quicker the bonus points decrease.
As old_kipper and ApplaudApps point out, the 10000 at the end of the equation will differ depending on your scoring system.
Thanks again!
bonus=10000/game.gameTimer