0
\$\begingroup\$

I've been reading valve's article on multiplayer networking repeatedly recently and everything is starting to make since. One thing I'm wondering on though however is what percentage value to use for interpolation. For example the article shows this image:enter image description here

Then the following explanation is given:

The last snapshot received on the client was at tick 344 or 10.30 seconds. The client time continues to increase based on this snapshot and the client frame rate. If a new video frame is rendered, the rendering time is the current client time 10.32 minus the view interpolation delay of 0.1 seconds. This would be 10.22 in our example and all entities and their animations are interpolated using the correct fraction between snapshot 340 and 342.

At the end of the last sentence it states to use "the correct fraction between snapshot 340 and 342". What would this fraction be? Is it the time it takes for a frame to render?...or am I way off?

\$\endgroup\$
2
\$\begingroup\$

Client 1 has a frame-rate of 120Hz, meaning each frame is 8.333mS.
Client 1 has a tick-rate of 20Hz, meaning each tick is 50mS.

Each Update(float deltaTime) on Client 1 is, therefore:

 8.333mS / 50mS = 16.6% of a tick

For each tick, Client 1 Updates() and Renders() about 6 times and each Update() increases the lerp by about 16.6%.

Client 2 has a frame-rate of 60Hz, meaning each frame is 16.666mS.
Client 2 never received tick 342 and is interpolating between 340 and 344.
Client 2 is lerping 2 tick's worth of time, therefore:

 16.666mS / 100mS = 16.6% of two ticks

Between those two ticks, Client 2 Updates() and Renders() about 6 times and each Update() increases the lerp by about 16.6%.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.