Set FPS ().......?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
sunday
Prole
Posts: 9
Joined: Thu Feb 25, 2016 3:50 pm

Set FPS ().......?

Post 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
User avatar
ivan
Party member
Posts: 1915
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Set FPS ().......?

Post 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".
User avatar
Sulunia
Party member
Posts: 203
Joined: Tue Mar 22, 2016 1:10 pm
Location: SRS, Brazil

Re: Set FPS ().......?

Post by Sulunia »

Don't check my github! It contains thousands of lines of spaghetti code in many different languages cool software! :neko:
https://github.com/Sulunia
sunday
Prole
Posts: 9
Joined: Thu Feb 25, 2016 3:50 pm

Re: Set FPS ().......?

Post 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
User avatar
pgimeno
Party member
Posts: 3656
Joined: Sun Oct 18, 2015 2:58 pm

Re: Set FPS ().......?

Post by pgimeno »

You also need to disable vsync in [wiki]conf.lua[/wiki] or with [wiki]love.window.setMode[/wiki].
User avatar
ivan
Party member
Posts: 1915
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Set FPS ().......?

Post 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".
sunday
Prole
Posts: 9
Joined: Thu Feb 25, 2016 3:50 pm

Re: Set FPS ().......?

Post 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
User avatar
Sulunia
Party member
Posts: 203
Joined: Tue Mar 22, 2016 1:10 pm
Location: SRS, Brazil

Re: Set FPS ().......?

Post 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.
Don't check my github! It contains thousands of lines of spaghetti code in many different languages cool software! :neko:
https://github.com/Sulunia
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: Set FPS ().......?

Post 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.
Attachments
FPS.love
(798 Bytes) Downloaded 441 times
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
sunday
Prole
Posts: 9
Joined: Thu Feb 25, 2016 3:50 pm

Re: Set FPS ().......?

Post 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
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 5 guests