Replicated animation problem on clients

Hey all,

I’ve created a character which kicks at the press of a buton. Characters are replicated and animations are too through a call to server->multicast:

Animation server event is called in function called Perform Spin Kick, which looks like this:


Perform Spin Kick is only called if multiple boolean checks are passed, like so:

What normally stops the animation is setting attacking to true in Perform Spin Kick with SetAttack. This sets IsAttacking to true locally, then sets it to true through a reliable server function (this may be pointless, it was an attempt at setting IsAttacking locally faster on clients). The kick animations are responsible for setting IsAttacking back to false.

Spamming the E key (Ability1 action key) sometimes makes the client character play the animation twice, the second interrupting the first animation. Logs show IsAttacking is true when it happens, so Perform Spin Kick should normally NOT be called when it happens. Server side, this issue never occurs, so I’m guessing a race condition? All I want is the animation to not be cancelled by itself in clients.

I would appreciate any help

Thank you for reading!

Have you tried “Do Once”?

I have. The issue persists. This is how it was tested.

In any case, a Do Once node would serve more as a check than a solution, as there are boolean flags that SHOULD block spamming the animation. This only happens client-side, so I believe it is more of a race condition.

Why are you replicating a montage? You should never have to.

Replicate a “State” that logic will execute an event that plays the montage.

Multicast (enum OR int ) → Function to eval enum or int value to determine a montage to play → play montage.

I didn’t think about that, I’ll check into replacing it with enums per your suggestion. Does that difference make a big impact? My characters can have over 20 different animations, so I thought against using them (a big select with 20+ exit nodes seemed excessive to me)

Definitely a network performance increase.

Use a Switch Statement.

Replace your anim montage with this one:
image

On completed reset do once

Good solution! I confirm it worked.
However, it seems like my issue truly was a race condition. The kicks were responsible to set isAttacking to false through an anim notify, and the problem stemmed from the server and clients setting the boolean value back to false close to the same time.
Simple mistake on my part, but thanks for the solutions and suggestions! I’ll apply them in my project

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.