This week’s focus was on lag compensation for carrying objects. However I got stuck with delay when throwing an object.
When the player is carrying something (including the Felicie), the item is switched to skip interpolation, meaning that it is not part of the 100ms lag of other objects, so it appears responsive. The problem arises when the player throws the object. There’s a delay between the sending of the throw command and the first server response showing the result. The 100ms lag compensation delay induced when switching off skip interpolation was subdued by recalculating from the render tick (which is 100ms in the past) to the present tick and also sending them to server. But there is still the transmission delay.
Something I will be working on next week is trying to get rid of this delay by letting the remote player simulate the throw similar to how we’re handling input prediction. For input prediction we are
- doing the player movement simulation,
- sending the keypress together with the x,y coordinates as calculated by the remote client to the server (and keeping track of the position and the current tick)
- the server replies with its own calculation according to the keypress
- the remote client verifies if its calculations match with the server and if it doesn’t it will correct the position.
We need to do something similar for the throw. The only difference is that no keypresses are done