Download

Client cancels an action, how to replicate?

Hi,

my character can cast a spell, which takes an amount of seconds to finish. This action is correctly replicating to all clients. Now I want the character to be able to cancel the casting before it is complete and replicate this correctly to all clients. My approach is this:

  • Client: Player hits cancel
  • Client: Check if player is currently casting. If yes: Cancel casting immediately (client side prediction) and tell server
  • On Server: Check if player is currently casting. If yes: Cancel casting and NetMulticast to everyone
  • All Clients Except Owner: Cancel casting immediately if still casting

Now I wonder if this is correct, because the NetMulticast will actually reliably send back to the original owner client, who already knows that the action was canceled and does not need to do anything here. So I am sending one RPC call too many to one of my clients, which could be skipped to save bandwidth.

Question: Is there any way to send to all, except the original owner? Or am I doing it wrong altogether?

Check this out. :slight_smile:

1 Like

Thanks, I was wondering about RPCs in this case, but that article was still helpful. I will need it once I start replicating more stuff through variables instead of RPC calls.