Multiplayer game jerkiness issue solved

I have finally managed to resolve the bug that has made Lockdown Protocol's network game practically unusable on anything but near-ideal connections. Client side motion has been horribly jerky, especially jumping.

I have been trying to fix this bug countless times over the years, always failing to pinpoint the real root cause. I was already considering dropping the multiplayer support completely, when I rolled up my sleeves for final debug attempt and found it. It was actually a combination of multiple errors.

Here's a technical explanation of the problem (in case someone is interested):

One thing I already knew as a cause of jerks was bad connection latency estimation that resulted in way too frequent tick counter adjustments to keep "time" in sync with server. I rewrote the filtering for latency measurement., which lead to smoother movement of non-player controlled objects. The most critical part, movement on player controlled objects, was still as bad as ever.

The root problems was combination of two serious bugs. Jumping state was not properly updated to client, which caused client side prediction to randomly miss jump commands in it's prediction. When rolling simulation back in time after receiving an update from server, player's physics body state was not properly reset. This resulted in really bad movement prediction on client after big changes in player's velocity (for example jumping).

After these fixes the client side movement is radically better. It's still not perfect, but this is a HUGE step forward. I will have to do some real-world testing before I can say exactly how much latency and jitter the game now tolerates and if it is playable on average (bad) internet connection.

I have the next alpha release already wrapped up, so unless I find any more critical issues, it will be out very soon.

Back to home

Posted on 2014-03-06