Super fast frame rate?

We recently jumped up from 3326 to 3462/63 and the frame rate seems crazy fast. We have fps = 30 in config.lua but it looks like 60 fps. Switch back to 3326 and it’s fine - forward to 3462 and it’s super fast.

We rely on the timer a lot for animation in our game and this is a real problem. Why is this happening?

Nathan.

Any ideas @robmiracle ?

I can’t think of any changes that we’ve made since then that affects framerate, but I’ll ask Engineering to look at it.

Rob

Timers should not be affected by the frame rate. And we are unaware of anything that would mess with this.

Can you put together a demo project with your config.lua and build.settings that demos that changing the frame rate affects the animation? It would be great if we could simply change the FPS in config.lua and see this misbehavior. Put that in a .zip file and upload it to a data sharing site like Dropbox or Google Drive and share it with us, please.

Rob

OK we’ll get onto it.

Here you go - your HelloWorld app with a count of called to my timer function and also a count of “seconds” (increments every 30 calls based on an fps of 30).

https://drive.google.com/file/d/1fe2sa8KaTxJh925zEvkcDEz_DVevRqww/view?usp=sharing

We’ve isolated it to build Corona 2018.3366 from 2018.09.07. 3365 has the correct frame-rate and 66 onwards appears to be broken.

Interestingly the release notes for 3366 include “Framework: making iterating timer more precise” - looks like this may be the problem @robmiracle ?

Thanks for tracking it down. It seems that it was single line fix in timer framework you’re referring to:

https://github.com/coronalabs/framework-timer/commit/7111d58a44751319a0866b76ccd4a9d7df9d1137

It doesn’t seem to change framerate in any way, but it does have some fixes to “timer” framework.

May I ask you to try saving timer.lua near your main.lua and see if it helps?

Here’s version before the fix: https://raw.githubusercontent.com/coronalabs/framework-timer/ef432e49bf7a8fc5a1d8db29f4532717ba840fc0/timer.lua

Also, you can add this code to beginning of your main.lua

package.loaded.timer = nil timer = require "timer"

That doesn’t fix it - still going flat-out.

OK. I took a deeper look. Unfortunately timer is not reloading like that, but issue is with that change. That change alters the behaviour that timer is invoked only once per frame. FPS are actually stay same, just timer gets fired up quite a bit. I’m looking if there’s a fix for such behaviour.

BTW, here’s code for FPS counter:

local frames = display.newText( "FPS: 00.0", world.x, world.y-160, native.systemFont, 32 ) frames:setFillColor( 0.2, 0.6, 0.8 ) local i = 0 local startTime = 0 function OnFrame( e )     i = i+1     if i == 100 then         frames.text = string.format("FPS: %.1f", 1000\*i/(e.time - startTime))         i=0         startTime = e.time     end end Runtime:addEventListener("enterFrame", OnFrame)

ok thanks.

I committed the fix, it should be fixed in tomorrow’s daily build.

Awesome thanks.

Please, try 3468

Confirmed fixed in 3468. Thanks @vlads  :smiley:

Any ideas @robmiracle ?

I can’t think of any changes that we’ve made since then that affects framerate, but I’ll ask Engineering to look at it.

Rob

Timers should not be affected by the frame rate. And we are unaware of anything that would mess with this.

Can you put together a demo project with your config.lua and build.settings that demos that changing the frame rate affects the animation? It would be great if we could simply change the FPS in config.lua and see this misbehavior. Put that in a .zip file and upload it to a data sharing site like Dropbox or Google Drive and share it with us, please.

Rob

OK we’ll get onto it.

Here you go - your HelloWorld app with a count of called to my timer function and also a count of “seconds” (increments every 30 calls based on an fps of 30).

https://drive.google.com/file/d/1fe2sa8KaTxJh925zEvkcDEz_DVevRqww/view?usp=sharing