Modify Bone Replication Lag/Jitter Client Side.

Hey, so I’m making a multiplayer FPS game and I’m really stuck. It feels like I tried everything.

I have a problem with the Modify Bone on the client side when I’m looking up and down, its jittery but on the server side it’s not. Look at the video for reference.

Youtube Video

Here are some pictures of my blueprints

This one is on the character blueprint. The function is being called by the Anim BP.

This one is the Anim BP.

Let me know if you have any ideas! Thanks.

Sorry, the video I posted didn’t capture the server side. Here’s a better video.
Video

Had a different issue but it is very similar.

What could help you is the following: Mess around with the rotation settings in the Player BP. Check/Uncheck Use Pawn Desired Control Rotation in the movement component and in the camera / springarm component that you have. Anything that is related to how the pawn is getting the mouse input. This helped me at least…
Movement Component: Check “Desired Control Rotation” and uncheck “Orient Rotation to Movement” (Section “Character Movement Rotation Settings”)
Camera: “Use Pawn Control Rotation” uncheck if having a spring arm
Spring Arm: Check the above and inherit all

This was a side-effect of my problem: I was using a similar setup in the AnimBP and the issue was the network lag - that you can’t prevent. What I did was sending the same information twice to the AnimBP and marking one as “Replicate Not Owner”. Then in the BP I added a branch to distinguish between owner and not-owner. This solved the jitter on the client side, but has no effect at all on the server/host (no jitter, but also not the effect I have intended). All clients as well as the host see the animation of the others properly. Just the host itself doesn’t see his own animation…

Hope could help

The problem is “server correction”. Your behaviors/logic needs to be setup so the server derives with the same result.

Adding a spring arm seemed to help a little but i’m not sure I understand the second part. Replicate not Owner? Do you mean Run on owning Client? Let me know! Thanks

1 Like

Hey, thanks for the help. Would you mind elaborating?

From Switch has Auth [remote]…(client side) you are telling the server to Calc pitch and set a replicated var. Then on the Server side of the switch [AUTH] you are again calculating and setting pitch on the same replicated var. So basically telling the server to calc and set pitch twice in the same frame.

Here’s the new pitch (replicated in the variable), now run the same calcs again and set (override) the replicated values.

What you should be doing is on the remote side (client) is running the calc locally, setting the var, then call the server event. Server event should calc its own pitch and set its own var.
switch has authority [AUTH] should do nothing.

Control Pitch [Rot] var should not be set to replicate.

What this does is allow the client to execute its own local usage of the control pitch var (responsiveness). And the server will execute its own. They should both naturally derive the same result for the given frame/input event. No need to pass variables etc. If the calculation on the server differs it will correct your client.

1 Like

Well, adding a spring arm was not what I intended to advise to you xD Glad to hear that it still helped.

I was talking about replication conditions (drop down menu below the one where you choose between “No Replication”, “Replicated” and “RepNotify”), there you should select “Skip Owner”. But this is basically the same thing that recommended you to do, but less efficient. Follow his approach instead

1 Like

Thanks for the help, I’m getting closer but what I failt to understand is how do I implement this with my AnimBP beacuse I need to pass a variable to modify the bone rotation. Which var do I pass, client var or server var. I’ll try a couple of thing and let you know if it works. Thanks again.

On the technical side if the end result is you need this value in the anim BP, just calc it in the anim_bp.

If you want to calculate and set the variable in the character class and use it in the anim bp, then simply get ref to character class and get the variable.

1 Like

Just to be clear, is it the server or the client that is jittery? and are helping you if the issue is on the server. If the issue is on the client, the solution would be different. It could be that the transitions between the different animation points aren’t properly configured so they look jittery.

There are a couple of other things I can think of client-side, but I just want to confirm.

I intended to help even though it was a client-sided issue. Obviously, I am not very good at that…

I have the following setup for my procedural Aim Offset system that works jitterless on client and server and is properly replicated.
In the Character BP (or Controller, where ever your input actions are)


Then, in the Event Graph of the AnimBP a simple transfer of the variable:
3

Which, then, is used to modify the bones in the AnimGraph of said AnimBP:

This enables the player to look up or down (regardless of being the host or just the client) and replicates the movement to all other players on the server (i.e. every other player gets visual information that you are looking up or down)

Would be nice if or @anonymous_user_30ad8436 could explain to us WHY it works and maybe if there is a better, more efficient way to achieve this result

Hope this was finally a good response from my side

Most efficient approach is to use animation (Aim Offset, Blendspace). It’s deterministic. You don’t have to replicate anything.

At most you’ll need a replicated bool, enum variable to set the state. If you can code your setup to be deterministic…even better.

1 Like

I understand the point in that, it surely saves performance but at the cost of accuracy. Especially if you have other variables that depend on the outcome of “Spine Rotation X” (like a procedural aiming system in a third person shooter. If you were to reposition the camera, the gun won’t point to the center anymore and the blendspace needs to be updated).

But I fully agree: If the code can be made deterministic, it is always preferable

Hi there.
Its been a while since this thread was relevant but I could need your help.
I am right now facing the same issue as my movement clientside is jittery.
Now I wanted to try your approach but I just can’t connect the “Get Spine X Rotation” variable with the get anim instance.
I created the variable and the custom event on the animBP and copied everything else from your screenshots.

Could you help me out with this?

Best regards,
Selflezz

Edit: figured this out. But Y Rotation is still jittering

1 Like