Page 1 of 4

LÖVE framerate stutters?

Posted: Fri Aug 01, 2014 10:16 pm
by Metalcookie
I've almost always noticed stutters in the framerate when working with LÖVE. Today I decided to simply ask the forum. hi.

I'll give a description of what I mean with these "stutters". Sometimes it's like one of the usual (60) frames just decides to not show up today, causing the frame before it to appear twice as long before skipping to the one afterwards. Instead of the frames going 1-2-3, they go 1-1-3, if not worse. Of course, this is more noticeable at lower framerates. With Vsync off and a framerate of ~1000 fps, it's practically not noticeable. However, when Vsync is enabled or when the framerate is lowered in another way, these stutters can be very annoying.

It has happened on every computer I have used LÖVE on, as well as every project or on all code. I believe this has been happening for several version now as well (since around 0.8.0?). The computer I am using currently has windows 7 64 bit (I am also using a 64-bit installation of LÖVE), an i5-4590, an AMD HD 6850 and 8GB of DDR3 RAM. I can't imagine that my computer is not powerful enough to handle a simple LÖVE project. It's been bothering me and I want to know if this happens to others as well, or if it can possibly be helped.

Of course, I have attached a simple .love as a 'test'. It's just a white circle circling around inside the window at a decent speed, making eventual stutters easy to see.
Here's the code in main.lua:

Code: Select all

function love.load()
	timer = 0
	screen = {
		width = love.graphics.getWidth(),
		height = love.graphics.getHeight(),
		update = function(self, new_width, new_height)
			self.width = new_width
			self.height = new_height
		end
	}
	circle = {
		x = 0,
		y = 0,
		radius = 50,
		update = function(self, dt)
			self.x = screen.width/2 + (screen.width/2-self.radius) * math.cos(timer * math.pi)
			self.y = screen.height/2 + (screen.height/2-self.radius) * math.sin(timer * math.pi)
		end,
		draw = function(self)
			love.graphics.circle("fill",self.x,self.y,self.radius,_)
		end
	}
end

function love.update(dt)
	timer = timer + dt
	circle:update(dt)
end

function love.draw()
	circle:draw()
	
	love.graphics.print("FPS: "..love.timer.getFPS(),0,0)
end

function love.resize(width, height)
	screen:update(width, height)
end
conf.lua doesn't really have anything interesting to note, other than vsync being enabled.

I also have a link to a .webm where one of these stutters occurs, for those who are into that .webm stuff: http://puu.sh/azUxg/bc8c3443f7.webm (the stutter happens about at the top of the path)

I wouldn't say this is a big issue, but it's something I want to look into nevertheless.

Re: LÖVE framerate stutters?

Posted: Fri Aug 01, 2014 10:58 pm
by slime
Try disabling Aero and see if it still happens.

Re: LÖVE framerate stutters?

Posted: Fri Aug 01, 2014 11:09 pm
by Metalcookie
It still happens. I have also tried full screen and variants.

Re: LÖVE framerate stutters?

Posted: Fri Aug 01, 2014 11:54 pm
by Ref
Ah!
Not really an answer but try deleting the conf file.
If better than see what's screwed up in the conf file.
Nore: You don't need the math.pi in the trig functions.

Re: LÖVE framerate stutters?

Posted: Sat Aug 02, 2014 12:16 am
by Metalcookie
Ref wrote:Ah!
Not really an answer but try deleting the conf file.
If better than see what's screwed up in the conf file.
EDIT: On second thought, remove the 2*math.pi from the trig functions.
Both things do nothing about the stutters. Removing math.pi only makes the circle move slower (pi times slower, to be precise), but the stutters still occur sometimes, as before.

Is it perhaps just the result of something basic in the workings of computer programs, like a random factor in processing speed throwing the framerate slightly off?

Re: LÖVE framerate stutters?

Posted: Sat Aug 02, 2014 1:38 am
by Clouds
I've found that my GPU seems to microstutter/drop frames when VSYNC is on, for many programs, not just LÖVE. It's also an ATI/AMD GPU. In the end I've just force-disabled VSYNC in my Catalyst Control Panel since some programs don't allow disabling it (and it's too much annoyance to download and edit the config file for small LÖVE examples people post to this forum, for example).

Re: LÖVE framerate stutters?

Posted: Sat Aug 02, 2014 6:38 pm
by Ref
Metalcookie wrote:
Both things do nothing about the stutters. Removing math.pi only makes the circle move slower (pi times slower, to be precise), but the stutters still occur sometimes, as before.

Is it perhaps just the result of something basic in the workings of computer programs, like a random factor in processing speed throwing the framerate slightly off?
Think it has something to do with your GPU.
The attached script doesn't stutter on my machine.
Best

Re: LÖVE framerate stutters?

Posted: Sat Aug 02, 2014 8:47 pm
by Jasoco
Yeah, I get stuttering too every few seconds or so. And I've got the top of the line laptop Apple sells right now.

I accept it as something that's going to happen either way.

Re: LÖVE framerate stutters?

Posted: Sat Aug 02, 2014 9:48 pm
by Ref
Guess I'm just luck to have a low end computer that doesn't stutter.

Re: LÖVE framerate stutters?

Posted: Sat Aug 02, 2014 10:04 pm
by davisdude
For me, (using a Windows 8 laptop) it stays constant at around 59 FPS, except for when booting up: it starts at 1, then goes to about 54, then stays steady at 59.