Closed Boondorl closed 1 week ago
So CF_PREDICTING is just a total dud now? Isn't that bad for compatibility with mods that might rely on the old client prediction handling, like mods that are no longer in development to be changed to use IsPredicting() instead? Might be a good idea to have CF_PREDICTING still be set and unset somewhere for backwards compatibility.
It does still get set. As someone who's written a lot of client-side safe code, I'm fully aware it can't be tossed.
Oh my bad, I didn't see the line where it still gets switched on and off.
With 4.13 looming, gonna close this for now since it'll need to be re-structured anyway for the prediction overhaul
Currently working with client-side prediction is a bit too limiting due to the nature of only having the info that the client is predicting and nothing else. Not only this, but handling the prediction state via
cheats
is volatile as it allows players to unset it (likely unintentionally) while predicting which will break the game state immediately.Prediction is now locked behind
ClientState
which is readonly. This will be used for getting a client's network status (both the consoleplayer and others) and currently supportsCS_PREDICTING
,CS_LATEST_TICK
, andCS_RUBBERBANDING
.CS_LATEST_TICK
is of particular interest because it can allow effects and sounds to be executed on the player's last "real" tick rather than constantly being repredicted. This allows for things like sounds on landing to be played at the last predicted tick without rapid firing when being played back.ClientTic
has also been added which can be compared againstgametic
to see how far ahead the player is currently predicting on a given tick. Note thatgametic
becomes one tick ahead when predicting since its value is incremented after all game logic but before prediction starts.These fields should mainly be used for client-side prediction as they won't give the same values across clients (similar to
consoleplayer
), but things likeCS_LATEST_TICK
andClientTic
are still set for all clients so logic can execute correctly on their end. For instance, a non-consoleplayer client will only update on a real tick, but their flag will always be set toCS_LATEST_TICK
so a landing sound would still play at the correct time if checking against it.