[HL2MP] Fix/prediction shared weapon recoil rng - #2041
Conversation
Use command-seeded shared random values for .357 yaw punch and physcannon recoil. Client and server now produce identical predicted view kick.
Use class-scoped names for the .357 and physcannon recoil random streams.
|
Interestingly, the .357 only produces this error with really low network latency (basically the local host). Even with |
I ran some tests. I think that behavior makes sense given #954.
On a subsequent re-prediction, The physcannon doesn't have an equivalent deterministic reseed immediately before its two recoil random calls, which would also explain why its error is persistent. This is why I think |
Issue:
The .357 and physcannon generate random view-punch components independently on the client and server while running shared predicted attack code. Their recoil state can therefore diverge and cause prediction corrections. Because
ViewPunchis not merely a local camera effect, we cannot simply move this to being fully client-sided. This is because it changes predicted, networked player state:Therefore, both
m_vecPunchAngleandm_vecPunchAngleVelare:EyeAngles()+m_vecPunchAngleShooting with the current setup will always show the following:
Fix:
Use command-seeded shared random values for their variable recoil components.
Before:
2026-08-30.20-38-09.mp4
After:
2026-08-30.20-39-26.mp4
Note that this is a complementary fix to #954