Replicating character animation state machines

Hi all, first question posted, please be nice to me :wink:

I’ve been going through learning materials at a steady clip, and I feel I’ve a fairly decent overview. The game project is a 4vs4 multiplayer shooter, and so I’m at the point where I need to look into replication.

My current problem is that the animation state machine I’ve set up does not seem to carry over correctly. I’ve based my character setup on this tutorial and the result I’m seeing is that state based animations like the server’s jogging and jumping is replicated on the client, but not vice versa. When the client is jogging, it only appears to walk really fast on the server.

I’m guessing this has to do with authority over certain state properties, such as the isJogging, isJumping, isFalling, speed etc, and that the server isn’t allowing the client to set them?

My basic instinct now is to ditch my whole animation setup and rethink it for the purposes of a multiplayer game rather than just an abstract tutorial, and in general, I’d appreciate an overview of do’s/don’ts when setting up character animation for multiplayer games.

I’m assuming you want animation state machine transition rules to rely on as few replicated variables as possible. For instance, maybe the character could check its transform delta client-side to determine what walk cycle to use rather than depend on an “isRunning” variable? Maybe the blend space should be more complex to include the whole range of movements?

Setting up for single player seems a total breeze, but I want to make sure I’m doing this right without getting lost in all the blueprints and graphs :slight_smile:

Hello,

I am sorry to hear about your problem.

In general, your Animation Blueprints for single and multiplayer games should not differ to a large extent.
As you’ve mentioned, animations are often triggered by Boolean flags. Thus, additional attention should be payed to the way these flags are set. In other words, variables that are important to gameplay should only be modified on the Network Authority (Server) and then replicated to Remote Machines (Clients).

In this situation, you can set a variable to Replicated which means the variable produces a one-to-one copy of the variable that is replicated from the Server to Clients, so that appropriate animations will be triggered in multiplayer.
If you like to learn more about variable replication in Blueprints, please go here:

As for the Blendspaces, they can be very useful, but please note that in order for them to work correctly, proper animation assets should be used. Please also make sure that variables that are used in dimensions of your Blendspace acquire appropriate values (for example, you may want to make speed change between 0 and 1 and calculate it by dividing the actual value of Pawn’s speed by the value of its maximum speed). If animations don’t blend together right, you may want to check Target Weight Interpolation Speed variable in the Anim Asset Details panel of your Blendspace.

Hope this helped!

Have a great day!