Game Timer

Blitz3D Forums/Blitz3D Programming/Game Timer

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

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.