Adjust FPS in game?

I have my game set to run at 60 fps. It runs great on almost everything except for a few devices. I’d like an option for the player to set the FPS to 30 (with a simple button). Is that possible?

Unfortunately, I don’t think that’s possible in Corona.

  • Andrew

Hi @mindgrub,

This isn’t possible with the base SDK, but you may be able to accomplish it via Enterprise methods (since you’re an Enterprise user).

Best regards,

Brent Sorrentino

We just had an engineer confirm, it is not possible in Enterprise either.

UPDATE: While this is still not possible, another engineer suggested that you should probably try to not make this tied to frame rate and use time instead.  See:
 

http://lazyfoo.net/SDL_tutorials/lesson32/index.php

I remember back in the day of the original IBM PC games would use what was called “Busy Wait Loops”, where they timed things buy just running a while do loop to kill time.  When the next class of processors came out and we jumped up to the 80286 and 80386 class processors game with busy wait loops became unplayable because the loops executed too fast since they were tied to the processor speed.

This is a similar circumstance since you’re trying to use device capacities, but in this case it’s the opposite direction.  By using timers to control things, you should be able to build frame rate independent code.  Something to consider.

Rob

The only way I know to handle such things is to handle it in your game loop using time as the metric. There are quite a few tutorials on the net, one of them is Jesse Warden on youtube (if you search Jesse Warden Corona SDK) he has a bunch of different videos. One of them he covers game loops. The purpose of the game loop is to provide a unified and balanced experience across all platforms. Ie, if a physics objects are moving faster on one device, slower on another etc you can counter that going with a time based implementation.

-Nick

Unfortunately, I don’t think that’s possible in Corona.

  • Andrew

Hi @mindgrub,

This isn’t possible with the base SDK, but you may be able to accomplish it via Enterprise methods (since you’re an Enterprise user).

Best regards,

Brent Sorrentino

We just had an engineer confirm, it is not possible in Enterprise either.

UPDATE: While this is still not possible, another engineer suggested that you should probably try to not make this tied to frame rate and use time instead.  See:
 

http://lazyfoo.net/SDL_tutorials/lesson32/index.php

I remember back in the day of the original IBM PC games would use what was called “Busy Wait Loops”, where they timed things buy just running a while do loop to kill time.  When the next class of processors came out and we jumped up to the 80286 and 80386 class processors game with busy wait loops became unplayable because the loops executed too fast since they were tied to the processor speed.

This is a similar circumstance since you’re trying to use device capacities, but in this case it’s the opposite direction.  By using timers to control things, you should be able to build frame rate independent code.  Something to consider.

Rob

The only way I know to handle such things is to handle it in your game loop using time as the metric. There are quite a few tutorials on the net, one of them is Jesse Warden on youtube (if you search Jesse Warden Corona SDK) he has a bunch of different videos. One of them he covers game loops. The purpose of the game loop is to provide a unified and balanced experience across all platforms. Ie, if a physics objects are moving faster on one device, slower on another etc you can counter that going with a time based implementation.

-Nick