Long Function call "pauses" runtime

0 favourites
  • 4 posts
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • This is for a loading screen and I want to observe how long it takes. I've read that Every X second is based on real-world time and not ticks but I notice a "pause" on long function calls.

    Below is a simplified version of my code:

    Count = 0

    Start of layout

    -> Run = false

    -> Count = 1

    Count = 1 -> ajax request

    On AJAX complete -> Run = true

    Run = true, trigger once //modifying array of X=1000 size per call

    -> call function(1)

    -> call function(2)

    -> call function(3)

    -> call function(4)

    Every X Second -> add 1 to Count

    ---------

    After 3 seconds real time...

    Expected result: count = 4

    Actual result: count = 1 then only start adding after function calls finishes

    What am I misunderstanding here?

    Tagged:

  • Every X seconds works correctly with reasonable frame rate. If you have a code which takes a long time to complete, all other events will be paused until it's finished, including the game clock.

    You can use system timer instead - Date.now expression.

  • I believe the system wallclocktime expression works as well, although I'm not sure about the exact mechanism. Is anyone familiar with it that can clarify if wallclocktime is based on system time or otherwise?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Looks like you are right:

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