# [Solved] I can't understand "TimeDelta"

[Sorry for poor english]

What is mean TimeDelta? for example:
5+TimeDelta()
10*TimeDelta()

and is difference between this?
50*TimeDelta()
TimeDelta()*50

Timedelta is the time since the last frame refresh. Read more here

The order of multiplication (or addition) does not matter.

thank you RazorSh4rk

I saw this before, in this link Was told â€ślife will increase by 3000 units in 10 secondsâ€ť.

How can i calculate seconds (convert seconds to timedelta)? For example add 123 units in 4 seconds, and etc.

If you put a cap to 60 fps to your game, timedelta() value will be around â€ś0.017â€ť (1/60 is the exact decimal value). So Timedelta()60 will be around 1 second.

*But this will work only if you donâ€™t have any fps drop, the timedelta value will increase in case the frame per second drop under 60.

I hope this will help, and feel free to correct me if iâ€™m wrong on the value/example i given, but itâ€™s as i always understood timedelta(), and i use it a lot.

Whatâ€™s the purpose here ??? Timedelta is great when you need a lot of counter on mnay objects for example ; if itâ€™s only related to your player entity (so for only one object), just use a basic chronometer and you will have seconds and ability to do +XXX per second. On other hand, forget about chronometer on multiples objects.

Here, I made you an example, press any key to start counting. The second variable will be the same on every machine while the first will vary based on the fps you have.
timeDeltaExample.zip (4.41 KB)

1 Like

Convert the problem, make it easier to understand:
Imagine your game runs at 3 FPS, yes, 3 frames per second, almost as bad as a console (just kidding, please ). Now, the TimeDelta() will be 0.33 seconds. This way, in 3 frames the time elapsed is 1 second:

``TimeDelta_1 + TimeDelta_2 + TimeDelta_3 = 1         // 3 frames elapsed``

TimeDelta_2 is the TimeDelta from the frame 2 (the timedeltas are all the same (0.33), but this way is easier to understand).

Now, what happens if you add 300TimeDelta() to a value ( life + 300TimeDelta() )?
After three frames, the total value added will be:

``300*TimeDelta_1 + 300*TimeDelta_2 + 300*TimeDelta_3``

This is the same as:

``300*( TimeDelta_1 + TimeDelta_2 + TimeDelta_3 )``

Again, this is the same as:

``300*( 1 ) ``

So, after 3 frames, or 1 second, you will add 300 points to the life, so:

``Value * TimeDelta() is the same as "Value per Second"``

Now, you asked how to â€śadd 123 units in 4 secondsâ€ť. If you want to add a value in 4 seconds, in 1 second you can add a quarter of the value, this way when multiplied 4 times (4 seconds) gives you the original value, easy to calculate:

``123 units / 4 seconds``

Dividing both numerator and denominator by 4:

``(123/4) units / 1 second``

You have to add (123 / 4) units per second, now using the TimeDelta:

``Add (123 / 4) * TimeDelta() to the variable Life``

Let me know if something is not clear

Thank you everybody.

Necro posting, lets go:
TimeDelta() does not seem to be the â€ścorrect and reliableâ€ť way to make consistant values. at least not in my case. I want to simulate a jump in a topdown game and this is what i came up with: but ether the Timers, or timedelta are inconsitant, cause my ZHeight value can reach from 130 to over 200 sometimes.

So, how can i get the same value every time, other then make trigger once with fixed values? (wich worked, but i want to make it smoove)