Page 1 of 2
Set FPS ().......?
Posted: Wed May 25, 2016 1:33 pm
by sunday
Hi,
Is there a way to set FPS for a game, like I want to set FPS (60) for a game? Would appreciate any feedback.....Thanks and God Bless....
Sincerely,
Sunday
Re: Set FPS ().......?
Posted: Wed May 25, 2016 1:45 pm
by ivan
No. There is no way to guarantee that "love.update" will always be executed in under 1/60 of a second. It may take longer depending on the machine and your Lua code. That's why we have "dt".
Re: Set FPS ().......?
Posted: Wed May 25, 2016 1:57 pm
by Sulunia
Re: Set FPS ().......?
Posted: Wed May 25, 2016 2:17 pm
by sunday
Hi Ivan and Sulina,
Thanks for the information, really appreciated it....So I can use:
function love.update(dt)
if dt < 1/30 then
love.timer.sleep(1/30 - dt)
end
end
and set it to if dt < 1/60 then
love.timer.sleep(1/60 - dt) and this will set my FPS to 60 for the game?
The reason I'm asking is that I'm very interested in using Lua2 for mobile games ( IOS / Android ) and also Desktop, but would really love the ability to set p my FPS to 60, even though, I still need to optimized code......Thanks again for your help.....God Bless....
Sincerely,
Sunday
Re: Set FPS ().......?
Posted: Wed May 25, 2016 2:21 pm
by pgimeno
You also need to disable vsync in [wiki]conf.lua[/wiki] or with [wiki]love.window.setMode[/wiki].
Re: Set FPS ().......?
Posted: Wed May 25, 2016 2:24 pm
by ivan
Sunday, if you want to have a "fixed time step" in your game,
it's usually done using "accumulators":
http://gafferongames.com/game-physics/f ... -timestep/
PS. Note: accumulators do not guarantee that your game runs at 60 FPS.
Accumulators simply ensure that the math works out nicely,
so you can avoid imprecise floating-point math due to varying "dt".
Re: Set FPS ().......?
Posted: Wed May 25, 2016 2:58 pm
by sunday
Hi,
Thanks for all the help guys / gals, much appreciated it......By any chance, do you know if Love2d supports, Game Circle, Game Center or IAP integration? Or this is something in the near future that will be supported.....? Thanks for the help and God Bless....
Sincerely,
Sunday
Re: Set FPS ().......?
Posted: Wed May 25, 2016 3:00 pm
by Sulunia
If you want your game to run at 60 FPS, just turn on vsync.
And there was a guy messing with mobile ads in love2d. I'll find the link later and edit this post here for you.
Re: Set FPS ().......?
Posted: Wed May 25, 2016 4:51 pm
by Davidobot
Here's a crude way to set the approximate FPS. This method requires modifying love.run.
Use "q" to decrease the desired FPS by 5 fps and "e" to increase by 5.
Re: Set FPS ().......?
Posted: Thu May 26, 2016 1:11 pm
by sunday
Hi Davidobot,
Thanks for the quick love script, much appreciated it.....Also, thanks everyone for their help....
I just downloaded the .love framework, I have a Mac OS X 64 Bit, but I have a question though, I see that the .love file is 11.6 MB, so when I finish the game, and I packaged it to a platform, will this be included as well, I mean the 11.6 MB with the final export, so if I have a games that's like 20 MB, it would be then 30+ MB at the end?
Thanks and God Bless...
Sincerely,
Sunday