Is Root Motion already stable for Multiplayer Games?

I’ve been evading root motion on my multiplayer project for a while because it had some networking problems some versions ago. Now I tried to implement it on multiplayer, and it does work… but not completely. Server’s movement looks just fine, but clients’ movement looks extremely glitchy on the screen of the one controlling the pawn. My guess is that the local animations that move the character are battling with the server trying to move the character and replicate the movement for everyone. Is there any approach to implement Root Motion correctly on multiplayer games? Would building a root motion controller fix the problem? What are your thoughts on it?

Edit: I have built a very basic project showing what I’m talking about. Please, test it with 3 clients and observe the movement behavior of every player through each screen.Download

I guess what’s your problem here is that the client plays the animation (having his location be changed through root motion) but then get’s an update through the server replicating the actor location (which causes the glitchyness).

If you need to have a server authorative I would probably try and animate on the server, replicate the movement only, and multicast simulate the animation with a non root motion version of it. I never tried if this would work.

I’d probably advise you to follow this wiki page:

from what I gathered it’s not replicating the movement but instead replicating all the variables it depends on so the clients can correctly simulate.

Hope I could help you!

Cheers ;D

I was kinda interested in this myself so I tried something in your project.

I could reduce the glitchyness a lot by making it Montage based (as suggested by [this reddit post][1])

Make an anim montage of your walk animation. Change the anim BP so it doesn’t have the walk state anymore and also add the slot so the montages work.

Then change your CharacterBP like so

Make sure your actor still replicates movement for this approach.
This reduced the glitchyness massively for me.

Hope this helps you!

Hey! Thanks a lot for your answers. Unfortunately, my main project makes it almost mandatory to have blend spaces, but I’m gonna follow the tutorial you have mentioned. It seems a very logical way of solving the problem. I also found another way of replicating root motion, but it’s a little hacky and I don’t recommend it for anyone reading this. However, it’s a solution anyways:

  • Create a pawn, with only a spring arm and a camera attached to it;
  • Make it the default pawn;
  • Make this pawn spawns the main character once it’s spawned. Also, attach it to the main character;
  • You also need to create a variable referencing this character on your “Camera pawn”.
  • Create the input system on this “Camera pawn”, storing all the important variables, such as axis inputs and boolean values (like “Is Sprinting”, etc…) on the actor and pass them to the server using the Tick event;
  • Make the server properly assign these variables to actual character (referenced on the pawn).

I have implemented this solution on the sample project I provided on the question.Download.

But again, thanks for the answer. You helped me a lot! :smiley:

This is what I ended up with. It’s being played on a client with Dedicated Server: