Game Timer

Blitz3D Forums/Blitz3D Programming/Game Timer

Paul "Taiphoz"(Posted 2003) [#1]
Well Im whacking away at my first 3D game, and im doing my best to keep its frame rate aroubnd 60-80 frames per second. on my GF2.

But I want to cater for those who cant handle those render speeds.

Now I dont want to kick off an old debate over whats better Delta Time or Tweening, for one simple reasons. I havent done both. in fact not done either in 3D so Im also not aware of any potential pitfalls I might find myself in.

So I was wondering if you fine chaps could show me an example pice of code for both the tweening thing in 3D and the delta time stuff in 3D....

Also Id love for some tips as I know a lot of you will have already come accross problems in this area.

thanks all.


jfk EO-11110(Posted 2003) [#2]
There isn't much to say about delta. Simply determine the speed and use it as a multiplyer for all movements.

ttold=tt
tt=millisecs()
ft=tt-ttold
speed#=16.67/ft
...
moveentity player,0,0,walk*speed
updateworld(speed#)

Maybe you should limit the min and max of "speed#" to prevent jumps when the system pauses for some reason.


I have also seen some problems with Firewalls, especially zonealarm seems to pause the Millisecs() Timer if an alert pops up (even when unseen in fullscreen) which results in delta-t jumps. So it might be a good idea to use the average delta-t with smoothing or only sporadic delta-t calculation updates.