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.
bcolin
Prole
Posts: 3
Joined: Sun Oct 05, 2014 10:04 am

Re: LÖVE framerate stutters?

Post by bcolin »

szensk wrote:Stopping the garbage collector stopped the stuttering? Keep it stopped and call collectgarbage("step", 1) each update. I'd test it myself but I'm at school.

But as Robin says, make sure you are not creating objects each frame. Especially something that you don't need to recreate each frame.
Amazing. This SOLVE my problem (with a small performance cost - 12 fps to 9 fps). Thank you so much!
Yes, in the update function I create a new table and insert about 100 new objects (in fact, the polygons positions to be drawn), and in the draw function I iterate on this table and draw each object. I will look at a way to optimize that.

So my problem was probably not related to the original one submitted by Metalcookie, although I can see also the stutter in his stuttertest example.
jjmafiae
Party member
Posts: 1331
Joined: Tue Jul 24, 2012 8:22 am

Re: LÖVE framerate stutters?

Post by jjmafiae »

make sure that there is no thing such as setColor INSIDE the table.
User avatar
desadoc
Prole
Posts: 4
Joined: Tue Jun 04, 2013 12:17 am

Re: LÖVE framerate stutters?

Post by desadoc »

Team Viewer causes some stuttering (at least for me), even if it's only running in background. And recently I had trouble with a nvidia driver update, 344.60 I think. It caused some stuttering (on every game, not only my löve game project) when I was watching streams on twitch.tv,

Also, I had screen tearing on arch linux + xfce before I switched to another compositing manager, compton I think.

And I noticed that drawing + update times per frame are about 10~20% lower when vsync is turned off on Windows.
User avatar
Jubjub
Prole
Posts: 1
Joined: Fri Nov 21, 2014 9:49 am

Re: LÖVE framerate stutters?

Post by Jubjub »

The only way to fix this kind of stuttering is to implement a fixed timestep (http://gafferongames.com/game-physics/f ... -timestep/), like it's been said in this thread before, but you MUST implement interpolation. Without interpolation a fixed timestep is almost worthless. Otherwise there will be some amount of stuttering, which will vary on different setups, and be less noticeable the more objects are in the screen.

I've seen this same behavior happen in C games using straight up OpenGL, so it has nothing to do with Löve.
Whatthefuck
Party member
Posts: 106
Joined: Sat Jun 21, 2014 3:45 pm

Re: LÖVE framerate stutters?

Post by Whatthefuck »

Here's something that might interest you guys - over the time I've worked with LOVE2D, I noticed that the garbage collector is the main offender when it comes to random stuttering with a locked framerate of 60. I have an i5 4670 and a R9 290 and I had the same issue.

You can partially solve the issue by manually controlling the step size, for my game I made it auto-adjust the step size based on how much memory Lua is using. But for the most part a step size of no more than 500 should be enough; in my opinion 500 is actually somewhat overkill.
User avatar
adrix89
Party member
Posts: 135
Joined: Fri Oct 15, 2010 10:58 am

Re: LÖVE framerate stutters?

Post by adrix89 »

For people who have this problem because of the fixed framerate setting the app to fullscreen solves it.
I am not sure about the garbage collector.
I use Workflowy but you can check out Dynalist as its the better offer.
Whatthefuck
Party member
Posts: 106
Joined: Sat Jun 21, 2014 3:45 pm

Re: LÖVE framerate stutters?

Post by Whatthefuck »

adrix89 wrote:For people who have this problem because of the fixed framerate setting the app to fullscreen solves it.
I am not sure about the garbage collector.
The GC can contribute to stuttering, because LOVE's default step sizes and collection frequency is a bit strange and manually adjusting the step size not only helped solve the stutters, but also bumped up my FPS by about 100-150 frames.
bizziboi
Citizen
Posts: 57
Joined: Sat Apr 16, 2011 9:24 am

Re: LÖVE framerate stutters?

Post by bizziboi »

Even if you control stepsize yourself, you can still get spikes if you have a lot of garbage that is C userdata since Lua frees that all garbage userdata up in one atomic step.
Post Reply

Who is online

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