Change the framerate between 30 and 60 at runtime

Hi all

Basically I’d like to have some sort of option in my game menu to allow the user to switch to a lower frame rate mode if their device runs slowly at 60 fps.

At the moment, I don’t know if there is a way to change the Corona engine framerate between 30 and 60 FPS -at runtime- (I already know how to hard wire it to one or the other using the project config before compilation)

The culprit of course is that the Corona physics engine is frame rate driven, so while my game might run silky smooth 60fps on iPhone4 etc, it may run sluggishly on older iPhones at 60fps. Having a ‘low quality’ game option that switches to 30fps would be a big help…

Any ideas?

Cheers
Cel. [import]uid: 9428 topic_id: 4383 reply_id: 304383[/import]

Can anyone confirm whether this is even possible (I’m thinking no at the moment, but I was hoping there was an undocumented API call to set the app frame rate at run time…)? [import]uid: 9428 topic_id: 4383 reply_id: 14478[/import]

I use the following code in my config.lua.
The reason I needed this was to change the frame-rate for iOS devices with weaker CPUs.
This code will by default set the frame-rate to 60fps, but on iPhones before 3GS and iPods lesser than 3rd generation will set it to 30fps. iPads use the default of 60fps.

This code works perfectly on my test devices (iPod 2ndGen, 4thGen, and iPad 2).

Hope this may help someone out there…

config.lua:
[lua]local platform = system.getInfo(“platformName”);
local architecture = system.getInfo(“architectureInfo”);
local optimumFPS = 60;

if (platform == “iPhone OS”) then
if (architecture:sub(1,6) == “iPhone”) then
if (tonumber(architecture:sub(7,7)) < 2) then – < iPhone 3GS
optimumFPS = 30;
end

elseif (architecture:sub(1,4) == “iPod”) then
if (tonumber(architecture:sub(5,5)) < 3) then
optimumFPS = 30;
end
end
end

application =
{
content =
{
width = 320,
height = 480,
scale = “letterbox”,
fps = optimumFPS;
antialias = false,
xalign = “center”,
yalign = “center”,

imageSuffix =
{
["@2x"] = 1.4
}
}
}[/lua] [import]uid: 70847 topic_id: 4383 reply_id: 47067[/import]