Download

NetMulticast skip a client? (am I doing this correct?)

So currently to send information from a client to everyone else on the server I do this:



UFUNCTION(Server, Reliable, WithValidation) void functionServer(); //Client sends information to server
UFUNCTION(NetMulticast, Reliable, WithValidation) void functionClients();//Server Sends information back to everyone


When the functionClients gets called I check the player to make sure it’s not the original Client that sent the message because the NetMulticast sends out to everyone including the client that originally sent to the server. To me this seems wasteful and possibly like I’m doing it incorrectly.

Is there a way to do a NetMulticast while skipping one client or is there a more preferred way for clients to send a message to server and out to everyone else?

Thanks!

As far as I know there isn’t a way to filter multicasts in any way. They just broadcast to everyone in the world including the server. Depending on what your trying to do there is probably a different way that doesn’t replicate to the owner. For example, using a replicated int with ReplicateUsing that doesn’t replicate to the owner.

Server-side you can also route through Actors that each client own and use RunOnOwner. That way you can avoid multicast and select who should receive the RPC.