Micro lags when vsync on or limiting FPS

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.
Post Reply
HeliumPL
Prole
Posts: 3
Joined: Sun Feb 21, 2016 4:55 pm

Micro lags when vsync on or limiting FPS

Post by HeliumPL »

Hello guys.
I have a very basic and short application which displays a square, which follows the mouse. It has constant velocity and stops immediately after reaching cursor position. It isn't moving very fast. There is a code which determines square's velocity:

Code: Select all

-- x and y are the square's coordinates; XX and YY are the mouse cursor ones; dt is delta time which is passed as a paramter in love.update
if y + 50 > YY then y = y - 200 * dt end
if y + 50 < YY then y = y + 200 * dt end
if x + 50 > XX then x = x - 200 * dt end
if x + 50 < XX then x = x + 200 * dt end
(Please don't say that it's a bad code, I know it. :P)

And here is my problem: When I disable vsync and my application runs at 1000 FPS everything is very smooth and beautiful :> but after turning vsnyc on or limiting FPS to 60 some micro lags start to appear. 30 FPS limit makes the micro lags appear more often. They appear from few seconds to few times per second and they are about 5-20 ms long which makes them visible and annoying.

I am attaching a .love file. Sometimes the lags may not be present for a few seconds. To see the lags make the rectangle move from one screen edge to another only horizontally.

My problem may sound strange and very stupid but I'm 100% serious. Pls help :(
Attachments
lags.love
(818 Bytes) Downloaded 97 times
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Micro lags when vsync on or limiting FPS

Post by zorg »

Hi,

A few relevant threads:
viewtopic.php?f=4&t=78526&hilit=microstutter
viewtopic.php?f=4&t=79914&hilit=micro+stutter

Also, without vsync, it still stutters, you just don't notice it that much.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Post Reply

Who is online

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