How do i synchronize animations between clients and what logic should i run?

Hello, i’m making a multiplayer game, what is the best approach to synchronize the animations between clients and which logic should i run between clients and server? For example, i want to equip a weapon with the following workflow:

  1. The Autonomous client pressed the 2 key to equip a weapon
  2. The Autonomous Client runs the function EquipWeapon, which checks if we already have a current weapon, if so execute StartUnequippingWeapon(WeaponForStartEquippingWeaponAfterWeUnequip); If we don’t have a current weapon it executes StartEquippingWeapon(WeaponToEquip).
  3. The Start(Unequipping/Equipping)Weapon method uses PlayAnimMontage to play the animation and SetTimer for the duration of the animation and then executes Finished(Unequipping/Equipping)Weapon, which has the finishing logic.
  4. After the Autonomous client runs the right Start(Unequipping/Equipping)Weapon method, we send a ServerEquipWeapon for the server to run the same logic.
  5. After the server runs the right Start(Unequipping/Equipping)Weapon method, we send a NetMulticast ClientEquipWeapon for all other clients.

From here what should i do?

  • Simulated clients don’t need to know in what state the character or the weapon is in or if it’s valid, so when the client function request comes from the server i check if it’s a simulated client, if it is i just stop any running animation and start playing the equip animation and do nothing else.

OR

  • Make everyone run the same logic, and if for some reason the simulated client is still doing the equipping animation but the server is telling him to start reloading (for example), then it should check that and run FinishedEquippingWeapon to stop the animation immediately to put everything on the right state, and only then execute StartReloadingWeapon.