How do I measure a real time reliably on slow cpu machines with DT?

0 favourites
  • 5 posts
From the Asset Store
Sprite set of animated modern war machines, include ground and air machines.
  • Just noticed that the timer of game may vary if the CPU is very slow;

    I have this code:

    Every 0.05 seconds Add 0.05 seconds to mytimer

    How can I measure the real world time more accurately to make calculations based on time?

    Also, even if I monitor the system variable Time, it seems to run slower than a real-time clock when I enable from Chrome settings the slow computer simulation mode...

    Can I use DT somehow to convert time to real secs?

    Should this work better? Every tick: add DT to mytimer?

    If I enable Chrome 6x cpu slowness setting, it also affects to DT..

    What API can I use to read system clock directly?


  • You can use system wallclocktime, or the date plugin's now expression to get Unix time.

    Dt by default has a limit of 30 fps (minimum of 0.033. You can change this by the system action set minimum framerate.

  • Just tested "wallclocktime" - it seems to have same problem its slowing than a real life clock when I have CPU Slowdown mode in chrome? Is it really the real system clock time?

    Btw, can I somehow detect the FPS and reduce the graphics / particles if low cpu?

  • If wallclock time doesn't work, use

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Btw, can I somehow detect the FPS and reduce the graphics / particles if low cpu?

    You can use the "FPS", "cpuutilisation", and "gpuutilisation" system expressions to detect high loads and then apply actions to reduce those loads (such as removing effects etc.)

    for the cpu and gpu utilisation you could use:

    Evaluate expression: (cpuutilisation*100)>90

    For FPS you could use:

    Evaluate expression: FPS<'targetfpsrate'

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