0 Favourites

How to have same time in different fps ?

  • Hi ,

    I just make a real-time game that something appears different in some devices.For example "Every X seconds" condition. It doesn't work same in a device that has 30 fps than 60 fps .

    Any solution to make the time same on any device with different fps ?!

  • Deltatime!

    Every 1*dt seconds vs. Every 1 seconds.

    TIME*dt = time*actual seconds

    ~Sol

  • Deltatime!

    Every 1*dt seconds vs. Every 1 seconds.

    TIME*dt = time*actual seconds

    ~Sol

    Thanks for your reply .

    It doesn't help me , and it's already has problem

    I also can't use dt in timer behavior ...

  • You can create you own timer using deltatime.

    I'm at work (and about to leave to go home in about 2 minutes!) so I can't give any example right now... but deltatime will help you to resolve the problem. Hopefully someone else will chime in as well - otherwise I can see if I have time tomorrow to make an example for you

    ~Sol

  • Thanks !

    I'm waiting for your example capx

  • Sorry to drop my big mean ass in here .... but ... i see this ...

    Every 1*dt seconds vs. Every 1 seconds.

    From the manual :

    Common mistakes

    Never use dt in the Every X seconds condition! An event like Every 1 second will run every 1 second regardless of the framerate, thus is already framerate independent. The condition measures time, not frames. If you make an event like Every 60 * dt seconds, you have inadvertently made the condition framerate dependent - the opposite of what you want to achieve! Such a condition will run every 6 seconds at 10 FPS (when dt = 0.1), or every 0.6 seconds at 100 FPS (when dt = 0.01); if you just use Every 6 seconds, it already runs every 6 seconds regardless of the framerate.

    You have 3 options (to my little knowledge) to have an more accurate time measuring.

    1/ The preferred one. Don not allow the game to drop under the minimum framerate.

    The default minimum framerate = 30 FPS, or (written another way) a dt = 1/30. Minimum means in this case that once dt reached 1/30, it will not grow any more bigger when the FPS drops even more. This means that once below the minimum framerate, all dt depending stuff (including Every X seconds) will calculate to a (longer) non realistic time.

    So, optimise the game, dont let it drop below the minimum framerate, not only 'Every X seconds' will be off, every dt using behavior will be off. Collision detection will fail. Platform jumps will jump higher. Timers are off. And more and more ....

    2/ Lower the minimum framerate with the action > System > Set minimum framerate. But, if you go extreme with this, having a game that drops in FPS and recovers the next tick, the difference between dt from tick to tick can be really big. Things can and will behave erratic.

    3/ Make you own timers using the System Expression 'wallclocktime' (if you have no problems with everything else behaving badly because FPS dropped below the minimum framerate)

  • Thanks for your answer. I don't try wall clock time because it's very hard for me to change about 100 events . That means there is no way to do this . It doesn't actually have a big problem , So just thanks for your help

  • Yeah I should have clarified a bit more... don't use X seconds and dt, you have to add 1*dt to a variable to build a custom timer.

    I'm at work again and it's busy, so I will see if it calms down a bit later and I can make a quick example if you still need it.

    99 got it covered from the look of things though

    *EDIT*

    Yeah I made it anyway while I'm drinking my second coffee... slow start today, the clients have to wait until I wake up xD

    DOWNLOAD TIMER USING DELTA TIME

    ~Sol

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Thank you for the time you spent . I will check it . Hope to be useful...

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