Game Development Community

What's the different between processTick / interpolateTick?

by John Klimek · in Torque Game Builder · 02/02/2007 (1:15 pm) · 0 replies

Can somebody please explain to me the purpose of the following three functions: (eg. ITickable)

processTick
interpolateTick
advanceTime

I've read the TDN about ITickable and it provides a basic explanation but I'm still confused.

Here is what I understand so far:

processTick is called once every tick. In a fixed-timestep simulation, the tickrate might be 10ms. That means the rendering engine is rendering as fast as possible and calling processTick on ITickable objects only every 10ms.

interpolateTick is called once every FRAME and is used to smooth out movement in-between processTick updates. (is this correct?)

--> If interpolateTick does in-fact calculate "in-between processTick updates" movement, then is it stored somewhere for rendering or does interpolateTick do the rendering itself? Would I be correct in saying that interpolateTick is used for calculating an "estimated" position and then it's value is useless? (eg. processTick will come along afterwards and update to the next real position)

advanceTime is called once every frame with the amount of time elapsed since it was last called. (eg. how long it took the last frame to process [eg. "delta time"]). (is this correct?)

--> Is advanceTime used for anything except animations? Couldn't interpolateTick be used instead of advanceTime?

One last big question to help me understand how TGB physics work in general...

------> Is the Physics engine always one-tick ahead of the rendering engine? When rendering objects, are we rendering between the last two positions? (eg. PreviousX, PreviousY and CurrentX, CurrentY) The term "interpolate" seems to indicate that we are estimating a value between two KNOWN (and VALID) positions.

------> If the above is true, does TGB stored previous positions for each entity so it can be used for interpolating?

Sorry for the long post and all of the questions. I think I'm beginning to understand how everything works but I'm still learning.

Thanks!!

- John Klimek