What happens when you replicate a pointer?

I would like to know how much data is sent over the network when a pointer is replicated.

The size of the pointer?
The class size?
The size of the modified class member?
Or how does it actually work?

Thank you so much!!

1 Like

The entire replication system is quite complicated. So you probably get the best information from looking at the code. Some of the classes involved in the process are FNetGuidCache, UPackageMap/UClientPackageMap, UNetDriver and UActorChannel.

If you are concerned with measuring actual data take a look at the Network Profiler or the more recent and possibly more detailed Networking Insights.

Regarding replication of UObject*, when the object is already known to a client it can be identified via its FNetworkGUID, a simple wrapper around an uint64 (used to be uint32 I believe) that is assigned to objects at runtime and is not persisted beyond a running instance of the application.

Once the guid is assigned and replicated (and acknowledged by the client) it can be used from that point onward. The case that an Actor becomes irrelevant and gets destroyed on the client but becomes relevant again later, so that the Actor is spawned again is also handled.

The replication system distinguishes between “static” objects (e.g. Actors placed in the map, native and blueprint classes, etc.) and objects spawned/created at runtime. Of course in order to spawn an Actor/subobject its class must be identified via guid as well, the spawn transform of the Actor must be sent, its subobjects and all the properties are replicated. Static objects can be identified directly via their path/name, but its subobjects and all the properties also need to be replicated.

Property replication is pretty much the same for static and non-static replicated objects since subobjects and properties need to be replicated in both cases.

2 Likes

Hi @UnrealEverything

I wanted to know this because i don’t want to send data that is not relevant and thus not congesting bandwidth unnecessarily.

I have a replicated actor pointer, but I am only interested in knowing if the instance is null or not null, the rest of the class data is not usefull to me.

So knowing how pointer replication works can help me decide whether to continue down this path or look for another more efficient solution in terms of data sending.

The tools you’ve shown me look great (Network Profiler and Networking Insights). I’m finally going to know exactly what the network performance is like. Thank You so much!!

The technical description is very interesting. When I programmed with sockets it was impossible to send pointers over the network. Only data structures with a specific size would be sent. So I was also very curious to know how Unreal handle that.
I think I’m also going to study those classes a little to satisfy my curiosity.

Thank you very much for such an elaborate response.
Very appreciated

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.