Hi. I am curious about the benefits of reliable multicast vs a repnotify variable for the purpose of playing an attack animation. It is a dedicated server / client setup. This is for a 2d fighting game so the clients seeing the animation I feel is critical to the gameplay.
In this instance all I am trying to do is:
(On Character Client) Input action attack -> Server RPC -> (Server) Multicast RPC -> Server/Clients Play Attack w/ Animation.
or
(On Character Client) Input action attack -> Server RPC -> (Server) set w/ Notify replicatedAttack -> Server/Clients onRepReplicatedAttack Play Attack w/ Animation.
In a situation where network relevancy doesn’t come into play, (2 characters standing next to each other, network relevant to each other at the time of the above attack action input) which is the more correct way to go about this?
Both will work but a multicast RPC is better suited for this. I’m not a networking expert, but as far as I understand it comes down to “Is it a persistent thing you are trying to achieve?” - For example, a door’s open state should be replicated using RepNotify so the door can be driven by this variable. This is great since it will work even if a player joins the game later. On the other hand, one time events or actions, like shooting, melee attack, explosion of a barrel, etc. are better suited for RPCs. These will happen at some point, but it’s not relevant to players who join after the fact that someone shot his gun for example. Not the best explanation but I think you get the point.
Multicast is used for broad gameplay events. I recommend to never use it besides ending a game, scores or something like that. Replication is always the way to go for client based interaction. Imagine you have 500 players multicasting their animations. That sounds horrible. You only want to notify clients in a radius.
scores probably aren’t that important. Multicast should be used for things that need to go to everyoneas soon as possible, and that depends on the game that you’re building. There are two different responses here, that are both correct, depending on the game.