What is Delta Time?
Delta time is basically a value which is calculated for us by the modern game engines like Unreal and Unity. Delta Time is the amount of time it took for engine to process the previous frame.
How Delta Time is Calculated?
Delta Time’s calculation is rather simple, Engine uses system’s internal clock to compare the system time when engine started processing the previous frame, to the system’s time when engine started processing the current frame.
Every motherboard has a “system clock” which is responsible to keep track of time. Operating systems have access to that system clock and provide API’s to read that clock and engine gets the time from that API and that’s how things are synchronized.
Why Delta Time is Important?
CPU is responsible for execution our code. The CPU with higher clock speed will execute much more instruction that one compare to lower clock speed. This means that depending on CPU’s clock speed game can run at different speed on different machine, and this is perfectly normal. This is one of the reason why we see Frame rate difference on PC and console. This sometimes ruin’s the playing experience if game is Frame Rate Dependent.
To make our game Frame Rate Independent we use Delta Time. By including delta time we assure that our game speed remain constant on different machines.