Page 2 of 2

Re: Fix For Laggy Delta Time

Posted: Mon Apr 06, 2015 9:35 pm
by Evine
How about a more visual test.
The upper line is based on monitor vsync and the bottom line is based on dt.
Not much difference eh? But look closely and you'll see that one line has more jitter than the other.

Code: Select all

monitorDTposition = 0
loveDTposition = 0

monitorDT = 1 / select(3,love.window.getMode()).refreshrate

function love.update(dt)
	loveDT = dt

	monitorDTposition = monitorDTposition + monitorDT * 197.894563
	loveDTposition = loveDTposition + loveDT * 197.894563

	if monitorDTposition > 800 then -- Reset code
		monitorDTposition = -10
		loveDTposition = -10
	end
end

function love.draw()
	love.graphics.rectangle("fill",monitorDTposition,190,10,100)
	love.graphics.rectangle("fill",loveDTposition,310,10,100)
end

function love.timer.sleep() end -- Easy hack to kill the function

function love.keypressed(key)
	if key == "escape" then
		love.event.quit()
	end
end

Re: Fix For Laggy Delta Time

Posted: Mon Apr 06, 2015 9:41 pm
by s-ol
Evine wrote:How about a more visual test.
The upper line is based on monitor vsync and the bottom line is based on dt.
Not much difference eh? But look closely and you'll see that one line has more jitter than the other.

Code: Select all

monitorDTposition = 0
loveDTposition = 0

monitorDT = 1 / select(3,love.window.getMode()).refreshrate

function love.update(dt)
	loveDT = dt

	monitorDTposition = monitorDTposition + monitorDT * 197.894563
	loveDTposition = loveDTposition + loveDT * 197.894563

	if monitorDTposition > 800 then -- Reset code
		monitorDTposition = -10
		loveDTposition = -10
	end
end

function love.draw()
	love.graphics.rectangle("fill",monitorDTposition,190,10,100)
	love.graphics.rectangle("fill",loveDTposition,310,10,100)
end

function love.timer.sleep() end -- Easy hack to kill the function

function love.keypressed(key)
	if key == "escape" then
		love.event.quit()
	end
end
The question isn't whether there's jitter, the question is whether that jitter matters :P

Re: Fix For Laggy Delta Time

Posted: Mon Apr 06, 2015 10:09 pm
by zorg
Evine wrote:How about a more visual test.
Both jitter the same amount the same time on my machine... so yeah :o:

Re: Fix For Laggy Delta Time

Posted: Tue Apr 07, 2015 7:39 pm
by squidborne_destiny
Ah, ok I realize now the error of my ways. Also, I realized that I didn't have vsynch enabled. Thanks for the help guys!

Re: Fix For Laggy Delta Time

Posted: Wed Apr 29, 2015 4:13 pm
by squidborne_destiny
Hey guys, thanks for the responses. I totally get why that doesn't work. Also I enabled Vsynch and the problem is totally gone. Problem gone so thanks. :nyu: