Spyke

Syndicated from the fediverse. Read and engage on the original instance.

View original on lemmy.world
godot·GodotbyMossBear

What's the best way to calculate milliseconds elapsed between frames?

I've seen several different methods for accomplishing this, but I was wondering if there's a way of doing it that is best? Also, somewhat related, but is delta in milliseconds?

View original on lemmy.world
14

3 replies

Delta is the number of seconds since the last frame. So to get the number of milliseconds, you can just do delta*1000

20
lemmy.ml

That's what delta is for. It calculates the amount of time that has passed since the last frame (tick) in milliseconds.

You mainly use it for lag compensation or interpolation but you can use it for anything. It's basically a fractional frame.

EDIT: You can also use it as a lagometer. If the ms goes higher than the tick rate, that's how you know that your game is under load.

14

You reached the end

What's the best way to calculate milliseconds elapsed between frames? | Spyke