Hello, I have just recently found Löve engine and I think i'm starting to löve it!
The previous engine I worked with I was used to having constant FPS throughout the execution. I was wondering if it can also be achieved in Löve. Is it possible to set the Frame Rate of Löve to some constant number? I've searched the wiki and all I saw was love.timer.getFPS (no set), there was also nothing about it on the configuration file.
Setting the Frame rate
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- tentus
- Inner party member
- Posts: 1060
- Joined: Sun Oct 31, 2010 7:56 pm
- Location: Appalachia
- Contact:
Re: Setting the Frame rate
You may want to read this thread: http://love2d.org/forums/viewtopic.php?f=3&t=1708
Last edited by tentus on Tue Jan 11, 2011 6:33 pm, edited 1 time in total.
Kurosuke needs beta testers
Re: Setting the Frame rate
Strictly speaking, no.
Instead, you should program your game to be speed independent. Make good use of the dt variable passed to love.update.
Instead of:
do this
Instead, you should program your game to be speed independent. Make good use of the dt variable passed to love.update.
Instead of:
Code: Select all
function love.update()
-- hoping for 30 FPS
moveThing(3.333) -- move it 100 pixels a second (100/30)
end
Code: Select all
function love.update(dt)
-- time independent code, yay!
moveThing(100*dt) -- move it 100 pixels a second. this works because dt is the time since the last update, in seconds.
end
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Setting the Frame rate
Also, you can control the framerate *somewhat* by using love.timer.sleep().
Help us help you: attach a .love.
- Taehl
- Dreaming in associative arrays
- Posts: 1025
- Joined: Mon Jan 11, 2010 5:07 am
- Location: CA, USA
- Contact:
Re: Setting the Frame rate
When you use love.graphics.setMode to set your screen metrics, you can enable vsynch, which will cap the framerate at 60.
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
- TechnoCat
- Inner party member
- Posts: 1611
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Milwaukee, WI
- Contact:
Re: Setting the Frame rate
Doesn't work on my computer.Taehl wrote:When you use love.graphics.setMode to set your screen metrics, you can enable vsynch, which will cap the framerate at 60.
Re: Setting the Frame rate
Thanks for the really quick responses guys. I am trying to build some sort of RPG game so I don't think I need the accuracy the update per dt provides. I'll just try to do a workaround using love.timer.sleep.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Setting the Frame rate
Using dt is probably still a good idea, because if you don't, the game runs much faster on a faster computer.omegazion wrote:I don't think I need the accuracy the update per dt provides
Help us help you: attach a .love.
- tentus
- Inner party member
- Posts: 1060
- Joined: Sun Oct 31, 2010 7:56 pm
- Location: Appalachia
- Contact:
Re: Setting the Frame rate
DT should still become a vital part of your game code. For example, how fast can the player walk? How often do random encounters occur? The easiest and simplest solution is to use dt. Trust us, once your get to know it you'll wonder how you got by without it.
Kurosuke needs beta testers
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Setting the Frame rate
No, you should still use it. Seeing as you'll want your characters to walk from tile to tile, not just jump to each tile without animation. Because that's the lazy person's way out.omegazion wrote:Thanks for the really quick responses guys. I am trying to build some sort of RPG game so I don't think I need the accuracy the update per dt provides. I'll just try to do a workaround using love.timer.sleep.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 4 guests