ShooterDemo: why use replication instead of RPC to network hit/death events?

In the ShooterDemo, the hit/death events are networked to clients by replicating the LastTakeHitInfo variable holding various bits of information about the last “take damage” event on a specific player. What is the reasoning behind using variable replication instead of RPCs for the hit and death events? Does it simplify handling a specific use-case I’m not seeing, or is it about reducing bandwidth/overhead?

In ShooterDemo, the LastTakeDamage variable is replicated with a custom condition using an expiration timer, so that it’s only replicated for a few seconds after the latest damage event, in order to avoid spamming clients in the process of joining the game. However, it’s also used to detect the death event on the client, so you can potentially have a client joining right after another player died and its dmg variable replication timed out, so it wont be notified of the death event…

I think i will split hit & death handling, so that hit events are networked via variable replication while the death event will be sent as a reliable RPC.

RPC’s are much more expensive as they are more ‘critical’ and must be sent in a specific order reliably and things like packet loss can jam up the works, where as variables that are replicated using repnotify can have more conditional forms of replication as well as custom ways to replicate in order to limit bandwidth usage, In C++ you can declare advanced or complex repnotify rules quite easily whereas with function calls you generally have to have more annoying checks to see if the call is valid with the penalty of the function always being called no matter what. I believe repnotify variables also will send data reliably but if data changes quickly, only the most updated data will be sent whereas with RPCs they will be called no matter what even if subsequent calls render earlier calls obsolete.

I don’t personally agree with 100% of how ShooterGame is replicated as some bits are set up in a way that make more complex mechanics harder to do, however the above reasoning should be considered whenever you choose an RPC vs a RepNotify.