I'm building a fairly conventional shooter in which both the player and projectiles produced by the player's gun are owner-predicted ghosts. These ghosts spawn and behave as I would expect, with one problem: Any time a new projectile is instantiated, the character controller experiences a hiccup and appears to roll back slightly. This is experienced almost like a frame hitch, but does not appear on the profiler. It is barely noticeable in builds, but present. In the editor it's very obvious. This does not happen if either the player movement system or the projectile spawn system are restricted to run entirely on the server, but if I run both without WorldSystemFilters (as I understand to be correct for clientside prediction) projectile spawning seems to interrupt the player controller. It's almost as if the new projectile is taking up a packet the player controller was meant to use. Any ideas what my problem might be there? I've been chasing various update orders all day without success.
#Predicted Ghost Interference Jitter
1 messages · Page 1 of 1 (latest)
I seem to have tracked the problem to a SetComponent in my projectile instantiation. I set the transform of my projectile based on some figures from a Character IComponentData, which is also involved in driving the character controller and the associated transform. Specifically setting the initial position based on that transform appears to cause the problem, but I'm not sure why or what to do about it.
Got it! My character movement job was being executed without checking for Simulate (https://docs.unity3d.com/Packages/com.unity.netcode@1.0/manual/prediction.html) which was producing the interruption. I don't entirely understand why instantiating projectiles made this problem noticeable, but it has solved the issue. Leaving this here as reference to others.
Possible that the pre spawn caused the prediction loop to rerun for it. And since your player didn't receive any new snapshot it didn't need to rollback, but continue from where it left off last update. Thus you modifying it without simulate tag would write incorrect data.