LÖVE framerate stutters?

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.
User avatar
Metalcookie
Prole
Posts: 16
Joined: Sat Dec 10, 2011 2:57 pm
Location: Netherlands

LÖVE framerate stutters?

Post 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.
Attachments
stuttertest.love
(3.65 KiB) Downloaded 275 times
User avatar
slime
Solid Snayke
Posts: 3132
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: LÖVE framerate stutters?

Post by slime »

Try disabling Aero and see if it still happens.
User avatar
Metalcookie
Prole
Posts: 16
Joined: Sat Dec 10, 2011 2:57 pm
Location: Netherlands

Re: LÖVE framerate stutters?

Post by Metalcookie »

It still happens. I have also tried full screen and variants.
User avatar
Ref
Party member
Posts: 702
Joined: Wed May 02, 2012 11:05 pm

Re: LÖVE framerate stutters?

Post 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.
User avatar
Metalcookie
Prole
Posts: 16
Joined: Sat Dec 10, 2011 2:57 pm
Location: Netherlands

Re: LÖVE framerate stutters?

Post 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?
Clouds
Prole
Posts: 23
Joined: Tue Nov 27, 2012 4:06 am

Re: LÖVE framerate stutters?

Post 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).
User avatar
Ref
Party member
Posts: 702
Joined: Wed May 02, 2012 11:05 pm

Re: LÖVE framerate stutters?

Post 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
Attachments
stuttertest2.love
Modified your conf & added another circle
(936 Bytes) Downloaded 279 times
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: LÖVE framerate stutters?

Post 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.
User avatar
Ref
Party member
Posts: 702
Joined: Wed May 02, 2012 11:05 pm

Re: LÖVE framerate stutters?

Post by Ref »

Guess I'm just luck to have a low end computer that doesn't stutter.
davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: LÖVE framerate stutters?

Post 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.
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 61 guests