Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Super fast frame rate?
Started by beernathan Feb 21 2019 03:38 PM

14 replies to this topic

Best Answer beernathan , 27 February 2019 - 02:11 PM

Confirmed fixed in 3468. Thanks @vlads  :D

[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Contributor

  • 350 posts
  • Corona SDK

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.



[TOPIC: post.html]
#2

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Contributor

  • 350 posts
  • Corona SDK

Any ideas @robmiracle ?



[TOPIC: post.html]
#3

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,373 posts
  • Enterprise

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



[TOPIC: post.html]
#4

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,373 posts
  • Enterprise

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



[TOPIC: post.html]
#5

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Contributor

  • 350 posts
  • Corona SDK

OK we'll get onto it.



[TOPIC: post.html]
#6

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Contributor

  • 350 posts
  • Corona SDK

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



[TOPIC: post.html]
#7

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Contributor

  • 350 posts
  • Corona SDK

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 ?



[TOPIC: post.html]
#8

vlads

[GLOBAL: userInfoPane.html]
vlads
  • Contributor

  • 610 posts
  • Corona Staff

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"


[TOPIC: post.html]
#9

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Contributor

  • 350 posts
  • Corona SDK

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



[TOPIC: post.html]
#10

vlads

[GLOBAL: userInfoPane.html]
vlads
  • Contributor

  • 610 posts
  • Corona Staff

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)


[TOPIC: post.html]
#11

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Contributor

  • 350 posts
  • Corona SDK

ok thanks.



[TOPIC: post.html]
#12

vlads

[GLOBAL: userInfoPane.html]
vlads
  • Contributor

  • 610 posts
  • Corona Staff

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



[TOPIC: post.html]
#13

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Contributor

  • 350 posts
  • Corona SDK

Awesome thanks.


  • nick_sherman likes this

[TOPIC: post.html]
#14

vlads

[GLOBAL: userInfoPane.html]
vlads
  • Contributor

  • 610 posts
  • Corona Staff

Please, try 3468



[TOPIC: post.html]
#15

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Contributor

  • 350 posts
  • Corona SDK

  Best Answer

Confirmed fixed in 3468. Thanks @vlads  :D




[topic_controls]
[/topic_controls]