Re: Fix For Laggy Delta Time
Posted: Mon Apr 06, 2015 9:35 pm
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.
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