Variable Replication Frequency on not-changing values

Hello,

what is the network overhead of replicated variables that only occasionally change value? For example the boolean state if a pickup item was already picked up by a player or not. I am wondering if I should use replicated variables for this or reliable RPCs since these values change rarely, but I have many of these items scattered around, meaning they could cause a lot of traffic if there is notable overhead, even though they dont change their status.

Thanks

My understanding is that the server will check on tick for all variables marked as replicated on your class, if your class is currently not dormant. So the cost of this will change depending on how many variables and how many actors you have. So its better to profile. I remember something people used to do to dodge this cost was to set their actors dormant and then use a force net update to send the values when they changed variable values. But now we have a much better way of handling this by using Push Model, I suggest you take a look at it, its very easy to set up and use. What push model does, it that the server will only check the replicated variable when you manually mark it as dirty, so if your value is not dirty there won’t be any server cpu cost as far as I know.

1 Like

For ops specific scenario a variable isn’t the best solution.

If an item is picked up, it should no longer exist for other players to interact with. Returning the item to a pool, or destroying it is the better option.

Every tick the server loops all players. For each it compiles a list of actors within net cull distance and iterates through the relevancy criteria, then checks changes.

1 Like

Thanks guys!

Well this depends and I think for my specific scenario it may be a good approach, since the items have a cooldown time after they were collected. After the cooldown they will reappear (think Mario Kart power-ups). Removing the items and putting them into a free pool would add additional complexity I would like to avoid.

I will check out the push model though, sounds promising!

For this type of actor you’d hide it, disable collision (interaction), set dormancy, start timer on the server. Timer would reverse the process. No added variable needed.