// networking
Short clips of networking and replication issues in Comply - what was happening, why, and how each was fixed. All tests performed on a range of 100-200ms and 5% packet loss.
// issue
When letting go off the zoom input, there would be a delay equal to the round trip time before actually zooming out.
// cause
The zoom in/out state was handled via gameplay tag. That tag was applied upon pressing the zoom input by activating a gameplay ability that applies the effect that applies the tag, and the ability was cancelled when releasing input. Zooming in worked fine because the ability activation is predicted, but ability cancellation is not predicted so there was a delay equal to the round trip time before the ability got cancelled and the tag removed.
// fix
The boolean handling the zoom in/out state (bIsAiming) is now set locally immediately upon pressing input. Zooming is cosmetic only so it doesn't need to be validated.
// issue
Client impact particles were only visible locally, never visible for other simulated proxies.
// cause
The impact cue had no server-side execution path.
// fix
Play a non-replicated cue locally for responsiveness, and when target data is received, play a replicated cue since now the server will execute it and will surely have the correct information (hit result) of the impact.
// issue
// cause
// fix
// issue
// cause
// fix
// issue
Projectile looking jittery instead of moving smoothly.
// cause
When using just replicated movement on the projectile, the server ticks the projectile movement component and the projectile's position replicates down to clients via standard actor movement replication, which looks jittery on high ping and packet loss due to the client only getting location updates after actor location replication, which results in constant corrections.
// fix
Use a local variable for the launch velocity passed into the projectile movement component. The launch velocity (passed in from the ability) is set at projectile spawn which triggers an OnRep that passes it into the component locally. This moves the projectile locally for smoothness. Replicated movement is no longer used on the projectile.
// issue
Rubber banding when being slowed/speed being added back in slow zones.
// cause
Setting speed values on the CMC is not predicted, so a high latency client keeps moving at the incorrect speed until they get the new movement speed replicated back which causes them to rubber band due to the correction.
// fix
Immediately apply speed reduction/adding back on the CMC locally when affected. Now the client is synced up from the start.