Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reworked clientside movement prediction handling #2538

Merged
merged 1 commit into from Apr 26, 2024

Conversation

Boondorl
Copy link
Contributor

@Boondorl Boondorl commented Apr 26, 2024

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:

  • cl_rubberband_scale: This determines how aggressively the interpolator should try to correct the player over their misprediction distance. Setting this to 0/1 is equivalent to having no interpolation and instead instantly snaps the player, otherwise moving them by a portion of the difference.
  • cl_rubberband_minmove: When correcting, this is the minimum distance it will interpolate. This is to prevent small movements during smaller corrections and ensure the interpolator can correctly reposition the player on their end.
  • cl_rubberband_threshold: Only differences larger than this distance should be considered for interpolating. This makes it so small mispredictions simply move the player to the right spot instantly, making it less noticeable in lower latency situations.

Now acts as a rubberbanding effect. The result is that movement is now considered correct and adjusted towards the real position if not rather than cautiously moving towards the predicted position.
@RicardoLuis0 RicardoLuis0 merged commit 12d0c94 into ZDoom:master Apr 26, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants