Why is Delta Time used in Game Development ?

Notes:

Why is Delta Time used in Game Development ?

W.K.T. Update method is called once per frame based on the game's frame refresh rate

Case 1:
If you are trying to move a player by 1 unit without deltaTime then
Update()
{
playerX += 1; // 1 unit per frame
}

- if a game is running at 10FPS then
Update method is called once per frame and
Update method is called 10 times per second

if a game is running at 10FPS then
player moves 1 unit per frame and
player moves 10 units per second

- if a game is running at 20FPS then
Update method is called once per frame and
Update method is called 20 times per second

if a game is running at 20FPS then
player moves 1 unit per frame and
player moves 20 units per second

i.e. game object moves slower at low FPS and moves faster at high FPS, with respect to player experience that’s not good

deltaTime:
If we want to update sate of a game object independent of game's FPS, then we take help of deltaTime
Formula:
deltaTime = 1s/# of frames per second

- if a game is running at 10FPS then deltaTime = 1/10 = 0.1;
which indicates each frame takes 0.1s to execute

- if a game is running at 20FPS then deltaTime = 1/20= 0.05;
which indicates each frame takes 0.05s to execute

Note: deltaTime is a variable responsible holding time taken to execute each frame

Case 2:
If you are trying to move a player by 1 unit with deltaTime then
Update()
{
playerX += 1 * deltaTime; // 1 unit per second
}

- if a game is running at 10FPS then
deltaTime = 1/10 = 0.1

if a game is running at 10FPS then
player moves 1 * 0.1 = 0.1 units per frame, and
player moves 0.1 * 10 = 1 unit per second

- if a game is running at 20FPS then
deltaTime = 1/20= 0.05

if a game is running at 20FPS then
player moves 1 * 0.05 = 0.05 units per frame, and
player moves 0.05 * 20 = 1 unit per second

i.e. game object moves roughly at same speed no matter whether game is running at low FPS or high FPS