Calculate time bonus for quickest time?

jonnyDiamondjonnyDiamond Member Posts: 11
edited November -1 in Working with GS (Mac)
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!

Comments

  • old_kipperold_kipper Member Posts: 1,420
    I think it would be something like but I may have made a mistake and there may be a far better and easier way of doing it, but-

    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
  • ApplaudAppsApplaudApps Member Posts: 308
    (Time taken multiplied by -1) plus 100 or 1000 or whatever suits your expected level time

    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 ...
  • jonnyDiamondjonnyDiamond Member Posts: 11
    Thanks guys!

    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!
  • Rob2Rob2 Member Posts: 2,402
    this sort of arrangement is marginally simpler

    bonus=10000/game.gameTimer
Sign In or Register to comment.