Client make two traces on server

When the Server (Host) attacks: The trace executes once per animation. (Correct behavior).

When the Client attacks: The trace executes TWICE on the Server for a single animation.

It seems like the AnimNotify is triggering twice on the Server for the Client character, or the Montage is somehow playing double on the Server).

  1. Input Event
  2. Advanced Play Montage
  3. Server Events
  4. Animation
  5. AnimNotify
  6. Event DoAttackTrace
  7. Make Weapon Trace

Hey @segonir!

So I haven’t run into issues with this before but I haven’t used animnotify with online multiplayer. However, what I’m seeing in your code and hearing from you is that you are probably not running it twice on the host- you’re running it once on the host and once on the client. Running it on the client looks like it’s propagating it to all using multicast, correct?

The problem is that every instance of the montage running will use every anim montage within it on their own. If you push that animation to every other client it will also run on every other client and they will all ALSO do the code.

You need to also have the code from the montages’ animnotifies also make sure it has authority etc. :slight_smile: At least that’s what I’d do next going off of the code you’ve shown here and the issue you’re having.

Hope that helps!

Thanks for the reply @Mind-Brain !
Can you please tell what do you use instead of AnimNotify? I’m trying to make a simple hitboxes without tracking sockets and etc. Just simple spawn a trace with specific timings of animations.

I don’t have a better recommendation for your use case here- I haven’t done anything like this with replication. I’ve done single player games mostly and a multiplayer shopping game with friends that wasn’t published and had very little replication besides locations of items. This sort of thing wouldn’t have had a use. :frowning: Sorry!

I think the solution is more of an order of operations situation. You don’t want to run the checks on the client because that enables cheating. You tell the animnotify to NOT run the code if it’s on client side, and that may be all you need. Just use “Has Authority” and if it doesn’t have authority don’t run it. :slight_smile: Just make sure the only thing you’re excluding is the code that’s being run more than once accidentally!

I did try to add has authority on everything, my guess is the animation just starting playing twice on the server. Do you have any idea where the trouble can possibly be, according to my code? Maybe its in the function or in custom event… man I wish I could know :worried:

You need to control execution of the multicasts. Servers execute Multicasts as well.

Get Local Role == (Autonomous, Authority, Simulated) Branch

Host will Match Autonomous and Authority on Listen Server, but only Authority on Dedicated server.

Branch [ Is Server ] will only execute on server

A clean split approach is to have the client do an action, then RPC the server.
Server does the action for its proxy copy, then Multicast to all others to do the action.

The multicast would then have a branch conditional to exclude all from execution other than simulated proxies.

Branch [ Get local role == Simulated Proxy ] → Execute this logic

Now I’m in Game Animation Sample UE5.5. I just checked the same functions and same setup in the different clean Game Animation Sample but in UE5.7 and it worked flawlessly. Maybe there is a checkbox of client network priority in project settings or something like that?