Avoid timers from running longer than expected

0 favourites
  • 5 posts
  • Hi, im doing a timed game, the player always have 1 min of play time on each level, i used the DT variable to advance the timer because i read that with that the game isnt frame dependant.

    Now im doing beta testing with some friends and i found that on the pc of a friend (a really slow laptop) the timer isnt running at normal speed, she can play for like 3 mins maybe even more and as the game isnt time dependant per se, it just clicking the right combination of elements, she can get crazy highscores that are immposible at normal speed.

    Any ideas on how to avoid this?

    Thanks!

  • Dt should work, maybe you are not using it correctly.

    You can also use the time expression (on start of level: set yourtime = time). And stop condition would be (time - yourtime greater or equal 60: do stuff)

    Timer behavior will also work.

  • time expression is clocked in seconds from the start of the game.

    OnStart of game

    var time_start;

    var time_end = time + 60;

    durring game play

    if(time_end < time) do end game stuff

    Please don't use dt as part of anykind of timing measure. dt is used for animation to keep animation to time step the same. As an example

    move 100px per second.

    object.x + 100 * dt; this will break up the 100 to that of only a fraction of the 60fp1second. However dt shuoldn't be used a timer keeper as dt is not really a timer.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks guys, works great now!

    That was the issue, i was using dt instead of time.

    The thing is, there is a couple of tutorials that guide people to use dt as a way of doing timers :(

    Anyway, thanks for the tip!

  • time expression is clocked in seconds from the start of the game.

    OnStart of game

    var time_start;

    var time_end = time + 60;

    durring game play

    if(time_end < time) do end game stuff

    Please don't use dt as part of anykind of timing measure. dt is used for animation to keep animation to time step the same. As an example

    move 100px per second.

    object.x + 100 * dt; this will break up the 100 to that of only a fraction of the 60fp1second. However dt shuoldn't be used a timer keeper as dt is not really a timer.

    when you increase a variable each tick by dt, it'll be incremented of 1 each seconds, this is what defines dt, so it works, I agree however that the time expression is better in that case

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)