Download

Setup for Multiplayer Pawn/Controller/AnimInstance with Switchable Characters/States

Hi!

I’ve been toying with things a lot and always seem to run into a few caveats regardless of how I do it.

I’ve read the documentation and so forth but of course it isn’t so elaborate.

This is what my game needs:

  • Player’s can choose a character (so, different model and different skeleton) and it sets it as the mesh in the Pawn blueprint.
  • These characters can sheathe/unsheathe a weapon or stealth, which changes their animations so it needs to be accessible via the AnimInstance blueprint.
  • Characters each have a large quantity of animations for their attack cycles/combos and so forth.
  • They can equip different weapons which change their animations yet again.
  • Animations need to work on multiplayer so having replicated variables in the PlayerController isn’t a good idea as it’s only relevant to the owner.

This is the problem:

If the PlayerController or Pawn blueprint refers to a specific event or variable in the AnimInstance I have to cast to the specific instance which will be different for each character. This means I either have to use one AnimInstance for all (retargeting?) and make states for each character which could get convoluted, or I need a way of never sending information to the AnimInstance (it would have to obtain this itself).

There are two enums that affect BOTH input and animation so both the AnimInstance and PlayerController need this information. One is the CombatState which is either ‘Normal’, ‘Combat’, or ‘Stealth’. Then there is MoveState which is either ‘Idle’, ‘Walk’, ‘Run’.

These are what I am uncertain of:

Is there some method of getting away with using one AnimInstance here?

Where would the CombatState and MoveState go so that both the PlayerController can use it for input and the AnimInstance can use it for animations in the state machine or wherever I need it.

Thanks, I appreciate any help.