I'm working on a solitaire game for HTML5, where most of the time nothing changes on the screen. To save power on mobile (and fans spinning up on desktop/laptop), I though I'd reduce the framerate from 60 to 10 fps, setting it back to 60 when the player starts dragging a card. But in order to respond to input immediately, I still need
update() to be called at 60 fps or thereabouts.
So I did the obvious:
FlxG.updateFramerate = 60;
FlxG.drawFramerate = 10;
FlxG.fixedTimestep = false; // Edit: added
However, if I do this, my
update() gets called only 10 times per second, with
elapsed == 0.1, and input is noticeably laggy. Once the frame has been processed and
drawFramerate has been cranked back up, everything is fine again.
Using neko for debugging, but observing the same on html5. Using HaxeFlixel 4.2.0, OpenFL 3.6.1.
Is it possible to have my cake and eat it too?
Edit: Looking at the code for FlxGame, it seems
step() is called at most once per draw frame, if
fixedTimestep == false. On the other hand, if
fixedTimestep == true, I would expect to get multiple
update() calls in a burst right before for each draw frame, so that's not really helping either.