Delta time

from Wikipedia, the free encyclopedia

In game programming and computer graphics, Delta Time describes a concept that guarantees a hardware-independent speed of processes in a game loop . Delta Time describes the time difference between the previous image and the currently rendered image.

functionality

The frame rate when running through a game loop depends on the processor's clock rate. A processor with a clock frequency of 64 MHz runs through the loop twice as fast as a processor with a clock frequency of 32 MHz. This means that new images can be rendered twice as fast. A timer is called for each rendered image , which saves the elapsed time between the current and the last call. The resulting number (usually in milliseconds or seconds) is used to e.g. B. to represent the speed of the transformation of an object in the game world independently of the frame rate.

example

Assuming that the update () function is called in a game loop, the cube is scaled by 120 meters at a frame rate of 60 frames per second. At a frequency of 30 frames per second, it would only be scaled by 60 meters.

void update() {
  //Veränderung der Skalierung um 2 Meter/Bild
  cube.scale += 2
}

If the added value is now multiplied by Delta Time, the change in size no longer occurs per image, but per second.

void update() {
  //Veränderung der Skalierung um 2 Meter/Sekunde
  cube.scale += 2 * deltaTime
}

At 30 frames per second, Delta Time is

At 60 frames per second, Delta Time is

use

The concept is used in modern game programming and is part of many game engines such as Unity3D or the Unreal Engine .

literature

  • Sanjay Madhav Madhav: Game Programming Algorithms and Techniques: A Platform-Agnostic Approach . First edition. Addison-Wesley Professional, 2013, ISBN 978-0-321-94015-5 .

Web links

Individual evidence

  1. https://docs.unity3d.com/ScriptReference/Time-deltaTime.html
  2. https://docs.unrealengine.com/en-US/API/Runtime/Core/Misc/FApp/DeltaTime/index.html