Download

PlayerState or PlayerCharacter with Multiplayer?

So I am running into a problem with my multiplayer logic. I am trying to replicate animation across clients, and what I have been doing is running all of my inputs through the PlayerController, and then setting, for example “isCrouching” (not replicated), and then I call an event that Runs on Server, which then sets the “isCrouching” (replicated) variable in the PlayerCharacter based on what “isCrouching” (not replicated) is in the PlayerController. This seems to work well regarding animation. I have tried retrieving replicated variables straight from the PlayerController in the Animation Blueprint, but the animation is not replicated to the other players. I have also tried setting a replicated variable in PlayerState, but what seems to happen is a lag before the animation happens on the owning client, and none of the other clients see the animation.

What is the best way to replicate animation?

This also leads me to another question, should I store all my replicated variables that I want other clients to be able to see in the PlayerCharacter, and then just call functions in the PlayerCharacter from the PlayerController? Where should PlayerState be thrown into the mix? I already have an inventory system set up in PlayerCharacter and I am not sure if I should just leave it in PlayerCharacter or not.

Thank you!

Short answer, use your PlayerCharacter to store data for dynamic events like Animation, Health, etc. Long answer, read this, best I have found yet: