|
Delta Timing - what exactly is it? |
Kikaru
Member #7,616
August 2006
|
What exactly is Delta Timing? I know it has something to do with changing how fast something thing goes (in the case of a moving object) based on how long it took to run the logic loop, but I'm not sure how to implement it, or even exactly how it works. I couldn't really understand the articles I found very well. Thanks in advance! |
blargmob
Member #8,356
February 2007
|
It is the measurement of time between to points in time. --- |
SiegeLord
Member #7,827
October 2006
|
Delta timing is basically variable time logic step timing. First, you need a very accurate timer to keep the time. I do not think you can make a good delta timing based loop using allegro's timers for example. Then you do this:
Basically, you measure the amount of time passed between each logic update, and do then base your logic things on that time interval. In the example above, for example, I move the player by multiplying his speed in units per second by the time passed in seconds. Also, I update some sprite time counter by the same interval. Then I blit to the screen as usual, and then do a frame limiting step. This last step is optional and most games don't do it, but it is nice to have for the laptop users. You shouldn't use this method though for a couple of reasons: depending on the speed of the computer the results of the game might be dependent on the FPS, because Euler integration is like that. Also, you need a high quality timer, which you may not have. At the same time this method is nice to have for this one reason: you can do 'bullet-time' effects trivially, just multiply the delta by some factor and automatically everything in the game is slowed down (or even sped up). This can be done in a fixed time step timing (the usual kind suggested on these forums) but it needs planning. With delta timing you get the ability automatically. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
blargmob
Member #8,356
February 2007
|
That's a bit better explanation then mine --- |
Kikaru
Member #7,616
August 2006
|
Thanks. So it's basically what I thought it was. |
|