Client replication jitters in Standalone Game

I’m learning replication but I feel like I’ve exhausted all variations of what others report should work for simple bone replication.
In the editor it works fine, as Standalone Game, the client jitters.

Am I doing it right?/ What am I doing wrong?

*(The component replication in the camera settings as well as the Reliable settings of the two custom events don’t affect the behavior and are enabled as brute-force troubleshoot)

**(Also, the original example I followed used this setup, but that didn’t impact the behavior either)

Calling an RPC in the Tick event seems really inefficient. That is a lot of network traffic especially if it just keeps send the same values.

The normal pattern to follow in UE4 to reduce jitter is to replicate input from the client to the server, then update any movement on the server and let it automatically replicate back down to the clients. This also reduces the chance that someone is able to cheat since the server is responsible for deciding what movement is allowed.

Thanks, I’ll go and ponder your response for a bit and do some testing.

As for the reason I’m using tick is because I want the head to move based on the Android Tilt Input, and there are no axis mappings for that. I can either use the ‘Get Input Motion State’-node (which is raw input that I’m unable to sufficiently smoothen), or under camera I can select ‘Lock to HMD’ and use socket rotation to get Googles smoothened input. Either way, HMD is mostly always moving, so it doesn’t seem to bad for now. I will of course put in some branches as soon as I’m past the point of bad replication.

Isn’t what you suggest exactly what I did though?
It sends the new value to the Custom event ‘UpdateHeadPitchClient’ which is run on server, and then the Custom event ‘UpdateHeadPitchServer’ multicasts it to all clients.
If this is not what you meant by serverside RPC, could you then please elaborate?

I attempted one more tweak to also include a ‘RunOnOwningClient’ but that didn’t fix it either.

…and reversing the cast, replicating variables or adding auth didn’t work either :frowning:
I’m really out of ideas :((

Hey I answered a Bone Replication question once. Maybe this can help you a bit. By the way, there is no need for an RPC.

Thank you for your answer, I found and tested your suggestion before, but I was unable to replicate your result. I just tried it again to find out if I missed something, but it still does not work for me. i assume this is because you use control rotation and I don’t.

The result is a server that replicates and a client that does nothing, also not locally.

*The event tick is in the Character event graph

Yup maybe it has to do with the way you are getting the rotation. Try it with the control rotation like I did to see if it works, so you can discard other problems

I just thought of this. Maybe the problem is that you are trying to get the rotation from the camera, and the camera is not a replicated actor so that’s why you aren’t getting the rotation in your clients.

Yes, with control rotation it works :slight_smile:
However, if that’s the only method possible, then that implies that it is currently not possible to replicate HMD rotation :frowning:

I think that (as of 4.14?) the camera should replicate though (see screenshot)

Hmmmmmm ok. Maybe you do need an RPC for now. Try this. Take your camera → get socket rotation → set rotation, nodes and put them inside an Run on Server RPC. And then on your tick drag off the Remote branch and call the RPC. Make sure you disconnect the Authority Branch, maybe that will work.

If that doesn’t work I’ll try to run some tests later when I have some free time.

If I understood correctly then that leaves me with this? (without the authoritypart)

This might indeed be on the right track.
With Authority empty the client worked (for a first \o/ ), however, the server does nothing. With multicast on server the client replicates jitters with no motion on clientside. With replicate to owning client on authority as demonstrated in the screenshot, both the client and server replicate correctly to each other, however, the client animation on client-side jitters.

Yup, it jitters because that’s latency, the server always has an advantage when you are using a listen server, that’s why you need to smooth the movement with interpolations so you get rid of the jittering. You could do that or let the client be authoritative over it’s movement which I don’t recommend because cheating.

I don’t think that that’s the correct conclusion. I think the jitters are to extreme for them to be latency while connected to localhost,
but more importantly,
I just notice that on the clientside in this configuration (Auth->Rep Owning Client), the jitter consists of the headpitch rotating back to 0. (i didn’t multiply the input so it was hard to see)

Reseting to 0 means only one thing. That you are trying to move the client without telling the server, so the server replicates the value as 0.

Actually, I’m not sure if I described the behavior correctly. Values don’t reset, but the rotation does, but only for the client on the client. (i tried setting the variable locally as well as seen disconnected in the screenshot, but to no avail.)

Left is server, right is client

**Actually, it doesn’t jump to 0, it remains 0 on the server.
But then I fail to understand what’s happening completely. If the server receives the proper values as are demonstrated through the visible serverside client-head rotation, then why is it printing out a 0-value?

***This is the solution. Apparently I had some conflicts in my main problem that caused it to behave this way, but in a clean project, it works :slight_smile:

Hmm, now I’m really at a loss… even with using indiscriminately all types of replication (without Auth and with multicast, to owning client and to server), the server keeps spitting out zeroes (and in all other configurations then the one in the screenshot, without proper client replication on the server as before. I really wouldn’t know what to try next.

*On the bright side, the option of two player games with proper HMD replication and with ‘Owner no see’ has already been achieved, thanks to you :slight_smile:

Hmm if you want to, put a download link for the project and I can take a look at it tonight.