Root Motion Not Replicating Properly!

So I just want to simply replicate a root motion montage on a key press, which should be very simple, but I always get a slight desync where the client appears to start the animation only slightly ahead of the server (or the client moves faster).

I am triggering the montage from a key press which is recorded and sent to my custom CharacterMovementComponent. I flip a CompressedFlag and send this to the server. I have confirmed that the server and the client both receive the CompressedFlag flip on the exact same timestamp, so I know for sure that they are “functionally” starting this event at the same time. Also, I have confirmed that they end the anim montage on the exact same TimeStamp. I really want to think this is a bug but it seems so basic that I’m not sure why the Engine would get it wrong.

The desync is not that visible until high pings, but it always occurs and can be detected using p.NetShowCorrections.

It has been a really long time since I’ve done any networked anything in Unreal, at least using the built in networking, but my gut feel is that you want to send an instruction to the server via reliable RPC, and have the server begin the animation. I have no idea if there’s a mechanism in place already to replicate the animation back to the clients, but if there is, then that should cover it.

There’s a strong possibility that I am completely off base and wrong here, too, considering I haven’t done this. Just a feel for how I’d think I’d approach it first off – whatever the action is, I’d want the server to know about it first before I just assume it could be done and play the animation.

Yes, Reliable RPC should also work, but in principle the compressed flags are the most powerful way to send info from client → server since they are sent every frame. Yes they are unreliable, but this shouldn’t mean that EVERY time it is not delivered on-time. Additionally, I have many other movement mechanics synced via compressed flags and they rarely have desyncs, so I can eliminate the possibility that compressed flags are not trustworthy.

I’m not sure if your that familiar with CMC but the reason I can play the anim on the client first is because of its client prediction model.

So, one thing that I found, was a person who’s done this. They don’t really go into too much detail, but they do at least explain it “for dummies” (which I am, on the topic, for the most part, although i have implemented a character with partial root animations, it was in a non-networked game.) https://www.casualdistractiongames.com/post/2017/05/09/UE4-Root-Motion

I did ask someone else that I know has worked with it some before, and they said “make sure that ALL of the inputs to your anim blueprint are replicated, let the anim blueprints do what they do, and it should all work out in the end. You may have to multicast to the other players to get it to work on their end”

… edit: they just sent me a message that said “probably best to make sure you’re always in None physics mode rather than walking or whatever else, when doing a root motion”