pausing FPS

Monkey Forums/Monkey Programming/pausing FPS

C10B(Posted 2013) [#1]
Hi,
My little app spends a lot of time doing nothing. You move stuff around the screen, and then sit and look at it for a while. During that period of looking (and not doing) the clock is still ticking at 30FPS, and in HTML5 my processor usage is very high, and on my mobile device it batters my battery life.

So I was wondering what is the preferred way to combat this? Should I set the FPS to 0 until I spot some user interaction, and only then wind it up to 30FPS? Or is there another technique that people are using?

Thank you


Midimaster(Posted 2013) [#2]
I do it like this:

If you immediately RETURN after OnUpdate() and OnRender() the power consumption will decrease dramatically. And OnRender() serves more!

So I only check whether there is something to do and then RETURN from OnUpdate(). If there was something to do I set a flag MUST_RENDER% for the OnRender() to be informed later.

At the OnRender() you cannot really RETURN all the time, because it might be something to redraw (destroyed by the system) or because of the flag. So I check the flag or (if nothing has to be done) count the calls of OnRender() and every 7th call I draw again my canvas.

This makes, that screen gets refreshed every 100msec or immediately if something happened. And brings down the consumption <10%

read also this:
http://www.monkeycoder.co.nz/Community/posts.php?topic=3389#35426

or see my samples of demonstration of power saving:
http://www.monkeycoder.co.nz/Community/posts.php?topic=408#2965

http://www.monkeycoder.co.nz/Community/topics.php?forum=1049&app_id=49

there is also a (german) article about how to do:
http://www.blitzforum.de/forum/viewtopic.php?t=36794


C10B(Posted 2013) [#3]
Thanks MidiMaster.
I've done a simple setting at the mo that says if a user is touching the screen, then do the rendering. If the user is not touching the screen then return straight out of the rendering method. I guess the update method is still firing 30 times a second, but at least the CPU time has dropped a lot (the processor fan no longer sounds like it is trying to take off!).

Cheers