Check events 1 time per second instead of 60 times?

  • Hi all,

    I'm using Construct 2 to make some non-game stuffs. The problem is that the engine checks all the events 60 times per second, which is an overkill for my purpose. I only need to check the events 1 time per second to reduce the battery consumption. Is there anyway to do this? Modifying the exported c2runtime.js file, perhaps?

    PS: I know that I am using the wrong software, but my time is limited and I need something friendly to people who don't know how to code.

    Thanks a lot!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It needs to do that, but you could wrap your code up using

    System. Every [add number seconds here]

    And possible toggle pause/unpause every second????

    And the battery will have zero effect (Zero Savings) running your app the way you discribe. You lose more battery juice using a screen, wifi, etc.

  • It needs to do that, but you could wrap your code up using

    System. Every [add number seconds here]

    And possible toggle pause/unpause every second????

    And the battery will have zero effect (Zero Savings) running your app the way you discribe. You lose more battery juice using a screen, wifi, etc.

    Hmm... I think it still check my events 60 times per second, but the events don't trigger (I have been already using every 1 second). Setting timescale seems to improve the situation either.

  • If nothing is changing, the engine will stop drawing the screen, so the GPU can power down and save battery. The events are still checked every tick but you could put them all in a group and disable the group except for one tick every second. This would mean the work per tick is so small it probably won't bring the CPU out of its low-power state.

    I guess some kind of option to stop ticking for a while could be useful, but it's not on our todo list right now.

  • If nothing is changing, the engine will stop drawing the screen, so the GPU can power down and save battery. The events are still checked every tick but you could put them all in a group and disable the group except for one tick every second. This would mean the work per tick is so small it probably won't bring the CPU out of its low-power state.

    I guess some kind of option to stop ticking for a while could be useful, but it's not on our todo list right now.

    The problem is that I only have one event (For every 1 second). Everything is executed in that event. is there anything else I can do? I sent you a message via the support email to explain my situation.

  • tipztv: How about putting all the code inside a function and then calling the function using a timer like Ashley and DUTOIT advised?

    I found that using functions and then calling them whenever I want keeps the code clean and optimized.

    Would that work for you?

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