Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Third Party Fishnet Body Jitter

Discussion in 'Multiplayer' started by wooolly, Jan 18, 2024.

  1. wooolly

    wooolly

    Joined:
    Aug 12, 2017
    Posts:
    9
    Hello,

    I'm using Fishnet client side prediction V1 in my FPS game (will upgrade to CSP V2 once it's released).

    I'm experiencing jitter issues, which I've been able to resolve by using a transposer body type virtual camera which follows the graphical transform of the predicted object. I was still experiencing jitter, but once I added some small interoplation (1) to the predicted object, it fixed most issues.

    However, the character must still be jittering, because despite the camera no longer seeing most of it, it's still very visible with character animations (for instance, the weapon I'm holding is jittering when I move). I've determined that it's not the animation, as all animation parameters look correct, so it must be the local predicted player object still jittering.

    My main question is: why is my player body still jittering with an interpolation of 1, and why did it resolve issues with my camera but not this? Before, rotating my camera whilst moving would cause the world to look jittery, now it's clear and fine, so the camera looks fine, but the local character is still twitchy!

    Thanks for help, advice or suggestions anyone can give!
     
  2. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,520
    Small advice: test character jitter with a fixed-position/rotation camera. Sometimes it's *still* the camera. :eek:
    I have repressed all memory of how I escaped a similar jitter situation besides that one. :(
     
    wooolly likes this.
  3. wooolly

    wooolly

    Joined:
    Aug 12, 2017
    Posts:
    9
    Hey Lorenzo, when I move my character around though, everything else in the environment looks okay? It use to look bad as it jittered, but now it looks fine? How would I know whether it's still the camera for sure?
     
  4. Punfish

    Punfish

    Joined:
    Dec 7, 2014
    Posts:
    410
    Lo-renzo is correct that we must first make sure it's not the camera. See if there is jitter with a stationary camera.

    There was also something else discovered as of very recent affecting Prediction 2, but could also be present in Prediction 1.

    Find class PredictedObjectOwnerSmoother then look for these lines...

    Code (CSharp):
    1.                 if (_interpolation == 1)
    2.                     ResetGraphicalToInstantiatedProperties(true, true);
    and comment them out.
     
  5. wooolly

    wooolly

    Joined:
    Aug 12, 2017
    Posts:
    9
    Thank you both for your responses.

    I've watched the character move in the editor mode (does that count?) and I can't make out much jitter, but it's definitely more noticable through the eyes of the character. Please can you correct me if there's a different form of stationary camera test you'd like me to perform, and what I should do for it.

    I tried commenting out those two lines of code, but unfortunately I could not tell any difference.

    I've recorded the two forms of jitter so that you might have a better idea of what I'm trying to explain :)



    Weapon Jitter

    • Interpolation is set to 1
    • Rotating round the other character is clear, no visual disturbances
    • Look closely at the weapon, it's jittery and not nice to look at


    Environment Jitter

    • Interpolation is set to 0
    • Rotating round the character causes visual disturbances, you can see the other character looks jittery despite not moving
    • The weapon we're holding looks fine, the animation is moving the weapon around but no visual disturbances


    In both cases I think our player is jittering, and the camera is merely following our player (the graphical predicted object). However, interpolation seems to smooth out camera movement so that environmental jitter no longer occurs, but it makes our own character's jitter visible, whereas with no interpolation we don't see the weapon jitter because our camera is moving as erratically with it.

    Sadly I'm unsure whether it's a misconfiguration, problem with my CSP implementation, or a bug (unlikely, most likely it's my fault). I can't understand why interpolation would help smooth the camera but not my local character? Ultimately I would like to fix the issue, but even if I could mask the issue with interpolation or some other kind of smoothing that might be enough.
     
    Last edited: Jan 19, 2024
  6. Punfish

    Punfish

    Joined:
    Dec 7, 2014
    Posts:
    410
    Can you set the interpolation to 2 just to see if that changes anything? I'd also recommend again trying a static camera specifically, not just scene view.
     
  7. wooolly

    wooolly

    Joined:
    Aug 12, 2017
    Posts:
    9
    I changed the interpolation value to 2 and 3, any interpolation above 0 seems to have the same weapon jitter.
    I detached my camera from my character to make it a stationary/static camera, and from what I can see, the character appears to have slight jitter, sometimes it's more noticable than other times. I'll post videos for you to see :)

    Interpolation 0



    Interpolation 1




    Interpolation 2