For some reason I seem to still be struggling to wrap my head around networking in Unreal. From what I gather, if an actor owned by a client, such as a PlayerController and a Pawn/Character, needed to replicate something, they would have to send it to the server first using a Server RPC, and then from the server use a NetMulticast RPC to replicate it to all the other clients. Otherwise, if it is an actor just placed on the level for instance, it is already owned by the server. Therefore, all you need is to call a NetMulticast RPC from the server only in order to get that to replicate.
Now let’s say I want the player to be able to attack. How would I handle the replication of that attack function? Let’s say for simplicity’s sake, all the attack function does is play an animation, and toggle a boolean variable. Right now, my solution is to have three functions; one for the server, one for the multicast, and the regular one. So the function runs, checks if it’s a client, if it is then it calls it on the server, which then runs it as multi. It works, but I have a feeling I’m doing something wrong. Maybe I’m just not used to it, but I can’t see myself having three functions every time I want something similar to happen. For example, if I right click for attack 2, that’s 3 extra functions. If I sheathe/unsheathe, that’s 3 extra functions. I also feel strange calling multicast so often, I feel like I’m abusing bandwidth by doing so. What am I doing wrong and what is a good way of handling the above problem?
Thanks for any help!