This concept is a foundation of all games, and it is widely used and very important to know if you want to develop video games.
You may know the acronym FPS
, which means Frames Per Second
;
the delta time is the time that has elapsed between two frames. Simple and
straightforward to understand. But why is it so important? That’s because it
allows games to run the same way on every computer. New computers can run games faster,
while old ones may run them slowly; and that’s where the delta time enters the
game.
Imagine you have your brand new computer and can play your games very smoothly with high FPS; the character animations are smooth with no jerks, that’s cool. As the FPS is high, the computer can render more things in less time. On the other hand, you have an old computer, and everything seems to be laggy, which results in the characters being rendered fewer times as the FPS is low. Now, imagine you are moving your character. With the new computer and high FPS, you can reach a longer distance than with the old computer because the character is rendered more often. That’s precisely where delta time is useful; it is used in the movement calculation to move the character at the same speed to travel the same distance in the same time on both machines. Obviously, the faster computer will render it smoother than the old one, but the same distance will be traveled in the same time!
Awesome, right?