Seems like it’d be useful…
You could probably serialize them by hand and send them as a single variable.
I’m guessing they aren’t serialized by default because they are usually data heavy and might trigger a disconnect if you saturate the network too much.
i feel like they couldnt be worse than an array?
I would also like to know. This is one of those things in Unreal that has been giving me an unpleasant feeling just below the tailbone for many years
mapRepl.zip (18.3 KB)
Sat down and did a little test using a struct as an intermediate. It works but it’s not templated so it would need to be modified on a map to map basis as is.
It would probably better to somehow serialize it to binary data before sending and then reconstructing it. Not sure if this can be done via FArchive (does it use binary internally?)
Binary for sure would be smaller in size and quicker to push over the network.
I pass over random quotes from Moby D (short due to censoring ) and the passed world timestamp.
The on rep function reconstructs it back and populates the TMap data.
Far from perfect but in a pinch it could be used for some init data for a level or something of that sort.
Replication on the base TMap might be impossible due to the fact that the reflection system doesn’t work well with templates (at least that used to be the case), so boiling it down to defined structs doesn’t give it problems.
Trying the templated version of the struct
template<typename T1, typename T2>
struct FMapTemp
{
UPROPERTY()
T1 Key;
UPROPERTY()
T2 Val;
};
Doesn’t want to compile as if it’s not finding the template.
nicely done, yeah i’ve just been using a struct with 2 arrays as a substitute, but im just surprised something so fundamental and useful isnt replicated by default