Check events 1 time per second instead of 60 times?

Discussion and feedback on Construct 2

Post » Fri Oct 09, 2015 10:24 am

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!
B
12
S
4
G
1
Posts: 104
Reputation: 1,512

Post » Fri Oct 09, 2015 10:28 am

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.
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,718

Post » Fri Oct 09, 2015 10:37 am

DUTOIT wrote: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. :roll:
B
12
S
4
G
1
Posts: 104
Reputation: 1,512

Post » Fri Oct 09, 2015 10:48 am

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.
Scirra Founder
B
397
S
236
G
88
Posts: 24,408
Reputation: 194,496

Post » Fri Oct 09, 2015 11:00 am

Ashley wrote: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.
B
12
S
4
G
1
Posts: 104
Reputation: 1,512

Post » Fri Oct 09, 2015 12:36 pm

@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?
B
48
S
14
Posts: 111
Reputation: 3,924


Return to Construct 2 General

Who is online

Users browsing this forum: brupibo and 11 guests