ZDoom / gzdoom

GZDoom is a feature centric port for all Doom engine games, based on ZDoom, adding an OpenGL renderer and powerful scripting capabilities
http://zdoom.org
GNU General Public License v3.0
2.47k stars 540 forks source link

Reworked clientside movement prediction handling #2538

Closed Boondorl closed 5 months ago

Boondorl commented 5 months ago

Previously the movement prediction would calculate the full distance but with lerping enabled would only move the player partially towards their destination. I'm guessing this was to reduce mismatches due to all of the variables present in Doom, but the result was extremely stuttery when playing online at high latency unless using a high scalar value. The thing is, this feature should always be disabled because in low latency, chances for a misprediction are small and in high latency, rubberbanding is much more common. Rather than assuming the player is wrong, prediction should be assuming the player is right and only correcting when truly wrong.

This rework removes the lerping and instead replaces it with a proper rubberbanding solution. If a movement mismatch is detected, it will now interpolate the player towards their corrected predicted position, smoothing out the snaps from a misprediction. Since lerping has been removed, cl_predict_lerpscale and cl_predict_lerpthreshold have been deprecated. Instead they're now succeeded by three new cvars: