I want to know which type of replication is more efficient.
Replicating a variable present inside and actor or replicating a variable present inside an actor component.
According to the component replication page
Bandwidth Overhead
The overhead for component replication
is relatively low. Each component
within an Actor that replicates will
add an additional NetGUID (4 bytes)
‘header’ and an approximately 1 byte
‘footer’ along with its properties.
CPU wise, there should be minimal
difference between replicating a
property on an Actor vs replicating on
a component.
I will make my some of my systems as actors instead of actor components depending upon this. So it will be helpful is some one can point it out.
On the actor is more efficient. That bit about the overhead says it all.
If you have a 4 byte variable on your actor, it only costs the 4 bytes. If, however, you also replicate a component and have the variable on that instead, it costs the replication of the component (a few bytes) + the variable (4 bytes in this example). Having it on the actor will always be more efficient, but why then would they have component replication? I’d assume it’s design efficiency. If a component has replicated features that are as complex as an actor, then the additional overhead of replicating the component is basically negligible when you think about the big picture of designing your actor and their components.
So to summarize. If the component is only going to replicate a few variables, and you’re only going to have 1 instance of that component on the actor, then it’s easy enough to have the actor handle that replication. However, if the component has more than a few variables and/or you are using more than 1 instance of that component on a single actor, then for the sake of building a game and not losing your mind, replicate the component.
Its basically either using 2 Actors or 1 Actor and 1 Actor component.
I went with 2 Actors for now.
because the replication list of the components is big. Its an array having around 50 variables. I can switch back to using components although when i want.