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

Update HUD using predicted client data #244

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Toodles2You
Copy link
Contributor

This change is for multiplayer.

Clients will now have their HUD display/use the values used for weapon prediction, instead of having messages sent to them each time the values update. Clients with prediction disabled won't be affected & will use the existing messages.

The benefit is that the active weapon, clips, and ammo will update without any delays when playing with high ping.

I did a bit of testing & refactoring to make sure it doesn't interfere with singleplayer loading & level changes.

Some notable changes I had to make:

  • Weapon prediction is still run when the player has no weapon equipped
  • All ammo values are fully sent to the client as part of the weapon data structs
  • Client weapons get their ammo types from the 'weapon list' message so they use the correct ammo values

@Toodles2You
Copy link
Contributor Author

I fixed ammo updates being sent before the HUD was initialized if the gamerules spawn the player with weapons, which would result in the HUD displaying zero ammo.

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.

1 participant