Page 4 of 4

Re: LÖVE framerate stutters?

Posted: Tue Oct 07, 2014 6:04 pm
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.

Re: LÖVE framerate stutters?

Posted: Wed Oct 08, 2014 5:09 am
by jjmafiae
make sure that there is no thing such as setColor INSIDE the table.

Re: LÖVE framerate stutters?

Posted: Thu Nov 20, 2014 1:14 pm
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.

Re: LÖVE framerate stutters?

Posted: Fri Nov 21, 2014 9:55 am
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.

Re: LÖVE framerate stutters?

Posted: Fri Dec 12, 2014 11:14 am
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.

Re: LÖVE framerate stutters?

Posted: Sat Dec 13, 2014 10:02 am
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.

Re: LÖVE framerate stutters?

Posted: Sun Dec 14, 2014 9:06 am
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.

Re: LÖVE framerate stutters?

Posted: Fri Dec 19, 2014 7:33 am
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.