Third party systems and deltatime.

BlitzMax Forums/BlitzMax Beginners Area/Third party systems and deltatime.

Tony:
Because it's easier that way if you are drawing frames as they are ready. One frame might take 0.005 seconds to render, the next 0.002 seconds. I could have a function which sets this value, but under such a system you'd have to have that function call every frame.

This way works well with either method. If you have a fixed frequency update, then you can just stick a constant in there when you call the update function every frame. And if you do updates like me, then again you just need the one function call.

As for the best method, as far as I know, the method I'm using is the best method, as far as balancing simplicity with flexibility goes. Write the system so it can handle variable time updates, and it will be able to handle fixed time updates as well.

And the way you make it handle variable time updates is to pass it the number of milliseconds elapsed, and use that to add to your timers, and divide that by 1000.0 to get Time_Delta_Sec# which is the number of fracitonal seconds that have elapsed, and multiply that with your movement distances.

(Passing the milliseconds will probably be a little more accurate than passing the Time_Delta_Sec# to the function and trying to get the milliseconds back from that value, but I don't know if it would really make a difference. I require the milliseconds the frame took rather than the seconds because most users will know how to get that easier.)