When you see a newbie post come along about what dt is, the answer is generally the following. Love.update is called every frame. Frames, though, are not always the same length. So, if you were to try and tell something to move 3 pixels left every frame, it would move erratically at a strange and almost unpredictable pace. So, the brave and noble developers of LÖVE (I wish I could hack my keyboard and give it that Ö...) added the delta time feature, an internal counter that tells you how much time, in seconds, has passed in the last frame. This way, you could take this so called "dt" and use it as a transformer of the amount you want to move every second. This creates the illusion of smooth movement.
Of course, you have to be careful, as too high a dt from a slow framerate can mess up collisions. It's useful to limit dt through math.min, then, or use timestepping...
Hold up. Why on earth are we doing this?
It's recently occurred to me, and I'm sure to many others at some point, that there is an obvious solution to this problem that would fix everything with no dt involved: a timer with guaranteed equal increments.
You could somehow set it up in conf.lua somehow like this:
Code: Select all
function love.conf(t)
t.updateTime = 0.07
end
Now, someone who has read through all this writing is probably thinking I'm suggesting we scrap dt and do this instead. Well, I'm not. I know there has to be a reason this wasn't done, otherwise it would be suggested all the time. (Perhaps it has. I don't know, searching the forums isn't turning up anything. Did you it doesn't even accept "dt" as a valid search term? Anyway, back on topic.)
Basically, I want to know why this wasn't done. Timers seem like such an obvious solution. Is there something I don't understand about the workings of C++? If anyone could shed any light on this, I would greatly appreciate it. Dt, from my perspective, seems very unnecessary.