In-app option to switch between 60 & 30 fps

I had recently started another topic on experiencing quite severe stutter on one our mobiles apps that we are now working on porting to PC and Mac. 

There doesn’t seem to be a workaround for that problem so we’ve done some testing with running the desktop builds on 30FPS and the stutter is more tolerable under this configuration. However, most devices with dedicated graphics are able to run this project at 60 fps as well so we don’t want to universally run all versions of our app at 30 fps.

I tried implementing a simple system to skip our programme’s update routine every other frame to get the 30fps effect but the engine still continues to run at 60 fps so the jitters don’t go away-- is there any way in which we could include an option in the app that could allow users to switch between 60 and 30 fps?

A search of the forum indicates that this is not an uncommon problem but running on 30 fps certainly seems to help so an option to do this from inside the app could potentially be helpful to many developers. 

Thanks

Yeah I noticed a slight improvement using 30FPS too. However I have a question - if the stuttering is due to the low resolution of the system timers that Corona is latching onto, why does a better graphics card improve things? I too saw perfect performance with a GTX 1060 but stuttering with integrated graphics, but surely enterFrame is called irregularly whatever GPU is installed? 

@nick maybe what you are seeing is a compounding of the problem due to poor GPU performance?  If a frame takes longer than usual to run and then even longer to render due to poor GPU then it will increase the stuttering effect.

Well maybe, but surely modern integrated graphics are capable of rendering a few rects at 60fps, and certainly 30fps, *if* the underlying position calculations are sound. 20 years ago we had half-life running on vastly inferior machines, have we got so much overhead these days that we can’t scroll a few sprites without it juddering? A C64 can do that with its 1mhz processor.

I must be missing something, but surely no amount of GPU power can make up for the y positions of objects being set irregularly in the first place. And when I say improve things, what I really mean is eradicate the issue completely.

If you can, print out the frame times on both devices and see if the ranges are similar?

I’ll try that if I get time later. Not something that really affects me as I only use Corona for text-based games nowadays, just interested that such a basic thing is broken and the impact that has for people like shashwat who are building action games for desktop in Corona.

I notice it a bit in my games with cars and trains, etc not being as fluid as they should be.

Regarding the original question, you can’t toggle render speed at runtime you can only “wait” until a frame should be updated by the programmer.  Note, that the engine will still try and refresh at whatever speed is hard coded in config.lua.

@nick_sherman yeah any nvidia card that I’ve tried seems to run the game smoothly and what’s more frustrating is that the mobile version of this app never had a single problem with stutter/ fps etc. All out of ideas now. Agreed that integrated graphics have come a long way-- I run AAA games on a handheld windows device with HD 615 graphics

@SGS what we are doing now is to skip the update on all our in-game entities every second frame so effectively it’s 30 fps but stutter won’t go away. Experimenting right now with reading in a preference file in my config.lua to see if I can use that to switch between 3 and 60. I don’t mind if I have to ask the user to restart the app once they change the in-app option. Will report back how this goes

Yeah I noticed a slight improvement using 30FPS too. However I have a question - if the stuttering is due to the low resolution of the system timers that Corona is latching onto, why does a better graphics card improve things? I too saw perfect performance with a GTX 1060 but stuttering with integrated graphics, but surely enterFrame is called irregularly whatever GPU is installed? 

@nick maybe what you are seeing is a compounding of the problem due to poor GPU performance?  If a frame takes longer than usual to run and then even longer to render due to poor GPU then it will increase the stuttering effect.

Well maybe, but surely modern integrated graphics are capable of rendering a few rects at 60fps, and certainly 30fps, *if* the underlying position calculations are sound. 20 years ago we had half-life running on vastly inferior machines, have we got so much overhead these days that we can’t scroll a few sprites without it juddering? A C64 can do that with its 1mhz processor.

I must be missing something, but surely no amount of GPU power can make up for the y positions of objects being set irregularly in the first place. And when I say improve things, what I really mean is eradicate the issue completely.

If you can, print out the frame times on both devices and see if the ranges are similar?

I’ll try that if I get time later. Not something that really affects me as I only use Corona for text-based games nowadays, just interested that such a basic thing is broken and the impact that has for people like shashwat who are building action games for desktop in Corona.

I notice it a bit in my games with cars and trains, etc not being as fluid as they should be.

Regarding the original question, you can’t toggle render speed at runtime you can only “wait” until a frame should be updated by the programmer.  Note, that the engine will still try and refresh at whatever speed is hard coded in config.lua.

@nick_sherman yeah any nvidia card that I’ve tried seems to run the game smoothly and what’s more frustrating is that the mobile version of this app never had a single problem with stutter/ fps etc. All out of ideas now. Agreed that integrated graphics have come a long way-- I run AAA games on a handheld windows device with HD 615 graphics

@SGS what we are doing now is to skip the update on all our in-game entities every second frame so effectively it’s 30 fps but stutter won’t go away. Experimenting right now with reading in a preference file in my config.lua to see if I can use that to switch between 3 and 60. I don’t mind if I have to ask the user to restart the app once they change the in-app option. Will report back how this goes