How to get framerate independent / deterministic computations?
Is there a way to have framerate independent, deterministic computations?
With other words, is it possible to access the game world from a different thread, or, which would be ideal, having a function update on each physics substep?
The goal is to have an object update in reliable intervals, as opposed to having larger intervals when the framerate degrades. (See the comment to one of the answers.)
Why not use time based computations? Generally that is why delta-time is used for animation rather than each call of the tick. The same is applied to computations that need to be over time or over a set interval of time. Each call of the tick function supplies a parameter of "deltaTime" which is the number of milliseconds since the last tick. You can also get the delta time from the World Object.
(above code should work for most actors if you are not within a tick function.)
You should be able to use this for your interval based computations where 1000 milliseconds equating to 1 second.
You could make your own sub-stepping simulation scheme using the DeltaTime.
This would do double-steps to keep your simulation intervals constant.
answered Oct 10 '14 at 11:06 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here