No announcement yet.

Root Motion Over Network - How Its Done

  • Filter
  • Time
  • Show
Clear All
new posts

    Root Motion Over Network - How Its Done

    The only information I could find regarding using root motion over a network is:

    • While defining if Root Motion is enabled is done inside the Animation Sequence, you will still need to determine how that sequence is handled inside of an Animation Blueprint.
    • There are several different ways in which you can handle Root Motion within Animation Blueprints.
    • For networked games where animation isn't replicated over a network, Root Motion requires the use of an Animation Montage.
    • Therefore you need to select "Root Motion from Montages Only" from the Root Motion Mode drop down menu inside the Anim Blueprint Editor inside Persona.

    Since UE4 Does not support animations or montage itself to be replicated, how is it even possible?

    Vague Answers:

    • "Try setting your play anim montage as a multicast event. Then have a server only event run that multicast event."
    • "You'll have to use our ability system to make montage to be replicated AFAIK."

    This is my understanding, and may not be accurate - feel free to correct...

    Root motion means the animation drives the location of the pawn.
    In a networked game, the server is authoratative, and when the animation plays on the server it drives the servers representation of the pawn.
    While the animation plays on the client, it also drives the location of the client representation of the pawn.
    When these two pieces get out of sync, the network correction code takes over, and adjusts the clients postion over time.

    It is import to replicate the actor state that drives the animation blueprint - this is what keeps the animations in sync.

    A common pattern is for the animation to read the pawn state in update animation event. As long as pawn state is replicated, both animation blueprints will stay fairly in sync.


      I have never seen an official response to this question even though it gets asked over and over again.

      What i do is do a multicast on the server that triggers the root motion animation via a montage on all the clients. The montage is set to replicate root motion. This seems to work for the most part but i get warnings in the console about the server and the client disagreeing on location.

      I have not tested my setup in the real world though. I would love to know what the best practices are regarding root motion and multiplayer.


        Wow. This question brings back some memories. Check this, read the comments. So basically it's not a priority to Epic.
        Hamad Al-Hasan
        Gameplay Programmer / Technical Artist


          lol from 2014 ...
          Founder and CEO of Angry Penguin Studio, LLC
          Dallas, TX USA


            Root Motion over network is not recommended as there is not a Root Motion component that you can add to the pawn or character BP that will manage the network requirements, replication and error correction, for you that would require a lot of additional work on your part.

            Root motion is ideal for local stand alone games where what you see as far as authoring goes is what you get so the animation is driven as an event so to make the animation play over the network the event trigger is what needs to be replicated.

            To see whats being replicated look at the details of the movement component in the character BP as it is this component that is actually moving and being replicated, synced, from client to client relative to the capsule and the in-place animation becoing a visual representation of the current state of the movement component.

            Can it be done?

            Sure but why reinvent the wheel or mess around with network requirements?
            Clarke's third law: Any sufficiently advanced technology is indistinguishable from magic.
            Custom Map Maker Discord
            Urban Terror


              reviving this old thread

              So basically how one would do things like a Stinger attack (like DMC)? would it have to be coded on the character? i liked the idea of root motion so each animation sets their movement if needed, that helped a lot with encapsulation.

              Any help would be great :c


                Keeping transform motion in sync is difficult, whether it is driven procedurally, by physics, by root motion, or by a human controller.

                In addition, keeping animation state machines in sync is also difficult.

                AFAIK - It looks like there is direct support for replicating root motion over simulated proxies in the current source.

                (I happen to be working on this for a project and will update with more info later....)

                I say try it your Stinger with root motion, see if it works, and update this thread :-)


                  The problem is that root motion doesn't work in my networked game, i don't know why.


                  That's my forum post, the root motion is correctly configured but no dice.

                  Is there a way in which i can recover the Root Motion Movement information per frame to check if the values are correct?


                    Is it working when playing single player?
                    Did you enable "Use Root Motion For Everything" on Anim BP in both Preview tab and Defaults tab?


                      Originally posted by HeavyBullets View Post
                      The problem is that root motion doesn't work in my networked game, i don't know why.


                      That's my forum post, the root motion is correctly configured but no dice.

                      Is there a way in which i can recover the Root Motion Movement information per frame to check if the values are correct?

                      OK when it comes to root motion people tend to see the "tree" for the forest and that the solution is not in the state machine or blend space when what controls movement over a network is the movement component that is added as part of the character BP. You can see what the movement component does by selecting the MC and see all of the requirements that is part of the MC which you would need to duplicate what is actually replicated over the network with the in-place animation being the puppet in the box.

                      Like OptimisticMonkey I'm not very optimistic that RM will work over a network until there is a movement component available to handle all of the stuff that the MC handles for in-place.

                      Would love it if RM worked over network but it has to be said that no way no how will RM work over a network with any degree of liability as to core movement requirements, and coders will kill you if they have to mess with netcode to make it work, so for now best practice is to wait for Epic to fix it.
                      Clarke's third law: Any sufficiently advanced technology is indistinguishable from magic.
                      Custom Map Maker Discord
                      Urban Terror


                        So the good news is that root motion works for me over the network :-)

                        I also started to dig into the source for Character Actor.

                        I am still researching, but it definitely appears root motion is supported... During PerformMovement() root motion is recorded into the SavedMoves. Simulated proxies store a list of received root motion moves from the server and use this for error correction.

                        So basically the animation is playing on both the client and the server, and driving movement. But on the client's simulated proxies, they receive updates for the servers position and interpolate error correction over time.

                        I am working on writing up a short blog post to document this, but thought I would share....

                        I have run 2-player networked on same machine and worked great. Planning to do more testing and share video


                          How would it be acceptable then to do a system where you could move the character given some animations? (like the tipical stinger, or whatever).
                          Should i make events that add an Input to the character and call that as a notify via the animations? The point is not to hard code which animations mvoes what but give me the tools to then configure the system for future characters


                            Any update on this OptimisticMonkey? I'm kinda at a crossroads on if I should continue with my root motion controller, or go a different direction. My game is 100% multiplayer.


                              I'm developing multiplayer sports game and run dedicated server on Linux machine in Google Cloud.

                              Network implementation in UE4 character is working as follows.

                              Character that possessed by local player controller : Root motion is calculated locally in client and replicated to server. and server replicate to other clients.
                              It look great in local client but not for other clients due to network delay / loss of data while replication.

                              Characters that Possessed by AI Controller on server : Root motion is calculate on Server and replicated to All clients.

                              It working fine but I hope to improve movement quality and minimize network bendwidth.
                              So, I'm trying to modify Character Movement Component to Server just replicate desired move target position and each clients calculate root motion in client side.