Page 1 of 1

stutter while scrolling

Posted: Fri Feb 12, 2021 4:02 pm
by monolifed
If I keep going right non stop I see small stutters. Attached file rather simple. My assumption is it is the video card/driver.
I am just curious that whether anyone else sees the stutter. Use left/right arrow keys to go left/right respectively

Re: stutter while scrolling

Posted: Fri Feb 12, 2021 4:42 pm
by Tabaqui
I had the exact "problem" with an old project and i had it because i've turned off vsync. Try enabling it in conf.lua like this:

Code: Select all

function love.conf(c)
	c.window.vsync = true
end
This will cause your game to run at lower FPS (in my case 60, but depends on the monitor you are using), but the draw function will be called in sync to your monitor's refresh rate. If you are using "dt" correctly in your game logic this won't affect the game experience.

Re: stutter while scrolling

Posted: Fri Feb 12, 2021 6:22 pm
by pgimeno
It depends on what you call micro-stutters. I see a little bit of tearing. If I enable vsync like Tabaqui suggests, the tearing is gone but the scroll is still not 100% smooth. But that's expected because the speed isn't a constant amount of pixels per frame like it used to be in old games; that's a logical consequence of having to adapt the program to any possible frame rate. If I set the scroll speed to 240 instead of 200, with vsync active, it is pretty smooth in a 60 Hz mode, but it loses a bit of smoothness when I switch to a 75 Hz mode.

Nevertheless, it's possible that the problem is the print() statement in your system. Sometimes these are slow.

Re: stutter while scrolling

Posted: Fri Feb 12, 2021 6:56 pm
by monolifed
So it is smooth with speed=240 and vsync on? But it is still the same for me with or without the print()
The print() was there to warn when dt is more than 1/60, And I noticed that it prints even without scrolling

OK this one has speed=240, vsync=1 and no print

Re: stutter while scrolling

Posted: Fri Feb 12, 2021 7:22 pm
by pgimeno
That one is smooth for me.

For me the print was triggering a lot of the time, perhaps because the tolerance was small. When I changed it to 1/56, it barely triggered.

Note my system is Linux, not sure if that makes a difference.

Re: stutter while scrolling

Posted: Fri Feb 12, 2021 8:39 pm
by monolifed
Thanks.
I assume that if it can run smoothly on some system with proper settings, code is not the problem.
I tested it on linux too, so I guess it makes no difference