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

Unexpected prediction with IN_WALK #2030

Open
KingofBeast opened this issue May 17, 2015 · 4 comments

Comments

@KingofBeast
Copy link

commented May 17, 2015

Situation:
player:SetCanWalk(false)
player:SetRunSpeed(0)
player:SetWalkSpeed(0)

Normal movement keys work as expected: no movement. However, using the +walk key (flagged to IN_WALK and defaulted to left alt) causes crazy prediction issues and the player's camera springs forward and backward.

All buttons removed in CMoveData in a clientside SetupMove hook has no success.

@TheFreeman193

This comment has been minimized.

Copy link
Contributor

commented May 18, 2015

I can't seem to reproduce this- Setting the speeds to 0 causes the player to move at the maximum allowed velocity of 10,000 (assuming sv_maxvelocity is set high enough). I can imagine this causing prediction faults with an internet server. Are you testing this in vanilla GMod? What happens when you try this in SP?

@willox

This comment has been minimized.

Copy link
Contributor

commented May 18, 2015

Are you crouching whilst this happens?

@KingofBeast

This comment has been minimized.

Copy link
Author

commented May 19, 2015

No crouching, and my mistake. The speeds were set to 0.001 due to 0 equaling max velocity.

@TheFreeman193

This comment has been minimized.

Copy link
Contributor

commented May 19, 2015

Right, I can confirm this now. First of all, this is only to do with WalkSpeed and IN_WALK; RunSpeed plays no part. Looking at the prediction errors, this is caused by the server expecting no movement at all, whilst the prediction system is expecting movement at the maximum allowed velocity. In other words, the server is treating the values correctly, but the prediction system is treating any WalkSpeed value <=0.25 as equivalent to zero.

As for the involvement of IN_WALK, I suspect that when walking is enabled, its override value of 100 is preventing the errors. Even when disabled, the IN_WALK input gets triggered, and therefore the prediction system thinks the player is walking. Since walking is actually disabled, the velocity is taken from the WalkSpeed value and hence there is a major disagreement.

A temporary workaround until this can be looked into is to use a safe value such as 1 for WalkSpeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.