Page 1 of 1

Different delta time value

Posted: Sun Aug 16, 2015 12:28 pm
by Chinol
Hi guys, its my first post on this forum so greetings for everyone! :D but... get to the point.

I did my first game in Love (just Pacman, nothing special). All is ok, but i have noticed that my game is a little bit laggy... So i decided to start it on my another computer (much more worse than my main computer) and... a value of delta time was lower (about 0.003) than value of delta time on ma main computer (about 0.015). Everyone knows what is going on ? :P

Re: Different delta time value

Posted: Sun Aug 16, 2015 3:53 pm
by ivan
There is no way to guarantee a constant frame rate across computers.
Even on the same computer the frame rate could vary -
like for example if you run another process in addition to Love2D, then the delta value will increase.
There are several things you could do:
-multiply all velocity vectors by delta
-use accumulators and simulate the game by several "steps" per update

Re: Different delta time value

Posted: Sun Aug 16, 2015 5:27 pm
by Jasoco
It doesn't matter. As long as the Delta Time is lower than 1/60 (0.01666666666667) then you'll still get 60FPS.

If you turn on VSync, then the Delta Time will consistently be around that anyway.

Just make sure you use dt for movement and animation.

For instance if you had an object and moved it at a speed of 100 pixels per second you'd just simply:

Code: Select all

object.x = object.x + 100 * dt
It could be pixels per second or tiles per second as long as it's units per second and you multiply it by dt.

Re: Different delta time value

Posted: Mon Aug 17, 2015 10:36 am
by T-Bone
Assuming a constant frame rate, and not multiplying all speeds by dt is one of the most common beginner errors. Good thing you learnt about that now, rather than in a bigger project in the future!

If you need help implementing it in your game, please post it here and we can look at it :neko:

Re: Different delta time value

Posted: Mon Aug 17, 2015 3:42 pm
by Chinol
T-Bone -> I always multiply speed by DT damn... ok but i have got one more problem with distribiuting my game on windows. I have done exactly what is on tutorial but it seems doesnt working... Love2d shows me messege "no game here" or something like that.