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.
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?
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.
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.
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
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.
In the last, i don’t know, year+?, I have never gotten root motion to work over a network (read: multiplayer game). Not once. Not even when setting it up, in theory, as it should be.
Anyone i have spoken to, until this thread, has stated its not possible. I went ahead and used root anyways. Guess what, it wasnt replicated.
I switched them all to non-root functionality … replicated.
so far, the only person able to do this is you. Anyone else on this thread seems … not working
To voice an opinion as someone who has been hanging around here there are some topics that show up that to be honest that any kind of feed back, at this point, from Epic would only add to the confusion with out first establishing the problems that needs to first be resolved but traditionally “is” resolved in due course with the ever evolving updates to the engine.
The problem in regards to the use of Root Motion over network is not an issue that it can not be used to coding and replication requirements but by the very nature and differences between in-place and Root Motion as created asset sets as part of the over all game design.
Bottom line animators, content creators, love Root Motion as all asset of the movement of the player model is contained with in the root motion data and is triggered via an event as to the desired action which includes speed, direction and location relative to the root of the player model as “authored”
In it’s current implementation as being event driven there is no way to track the XYZ location of a given player across the network in the same manner as you could create the identical physics event for say an explosion where the result as to an event has to be “identical” from one client to another.
Talking to our coders they hate root motion as to the demands of the network code to be able to update client information as to be the correct response as to an event driven being driven by the movement component that already contains the necessary requirements as to error correction.
Root Motion does not require the use of the movement component and is why you tell Unreal 4 “not” to use the movement component by telling UE4 that it is Root Motion based.
The bottom line as to network needs it would be like trying to fit a square peg into a round hole and until there is a component that manages the client to client requirements that ensures a sync to the “event” driven data the requirement of all clients knowing where the player is in relationship to world space is a very difficult task as to net-code being voodoo magic by nature.
As a perspective net-code is a place where angles free to trend.
My assumption based on the lack of Epic feedback is they by now obliviously know the the use of RM over network is a known issue and as in the past will speak up “once” there is a working solution and will in due course come up with yet another impressive solution.
P.S. As an animator being able to author using root motion makes life easier and adding the ignore RM flag is/was a feature that at least wanted so if and when RM over network becomes possible our project is future proofed as to desire.