Download

Replicating large arrays.

I am looking talented person to create / guide me to create system that can replicate large arrays. I already posted this question to C++ section, but because this isn’t ordinary stuff, I’m afraid that there isn’t any help. So let’s make a Job Offering from the problem.

Below is my original message:


Hello!

I have been fighting with this one a long time. Basically, I have a tool that allows players to draw into air by creating an Actor that has Instanced Static mesh component. When player is holding the trigger, new instances are added. This works great in single player game, but problems arise when I need to have this working in multiplayer.

There are approx, 100-1000 mesh instances in one drawing. If I replicate array normally, the clients will start lagging so much that playing is impossible until replication is finished. What I tried to do is putting all new instances to array and after 1 second, move all stuff from array to replicated array that is send to client, so the payload is much smaller for server, but I am having problems implementing that. Also, that system might have problems because game is Drop in / Drop out. So eventually, the replicated array has lot of stuff and newly joined players would try to replicate the whole array and we are back in square 1.

In Attachement is the code from the crucial parts.I explain them here:

Function BeginPlay:
We set the timer on. Timer runs functions SendJointBulkToReplicate and SendStrokeBulkToReplicate

Function Update:
Runs every tick. In this function, We are adding all the new strokes to NON-replicated array. If we are server, then we just draw them to world.

Function SendStrokeBulkToReplicate
We add all the stuff to replicated arrays and then clear the array so we can have new stuff in there.

Functions** OnRep_AddStroke** and OnRep_AddJoint
These are run after the** ReplicatedStrokeTransforms and ReplicatedJointTransforms **are updated. What I try to do there is to add instances that are yet to be added.

If I play this as a client, I can paint normally maybe 1-2 seconds and after that I get more and more lag. The more I draw, the more lag I starting to get. I thought that Array replication in Unreal is clever enough to replicate only new changes to array, not the whole array?


So I am looking a person who can do this replication system with me and guide me along the way. I am willing to pay 200 dollars or more (If guidance is good and thorough). Unreal Replication system itself is pretty familiar with me and I am having no problems understanding the basic workflow, so you don’t have to start with very basics.

Thank you very much!

Not totally certain if I have the solution for you, but I do have some thoughts and avenues you can explore. Let me know if you’d like to hop on skype or exchange emails or such.

Reduce the size of the array, only replicate what you need to. Use some filtering to occlude what does not need to be replicated. What can you afford to do on the client.

You should check FFastArraySerializerItem class first. Also, it’s not a good idea to replicate transforms,especially if you haven’t non-uniform scaling. Split it into quantized vectors.

Thanks. This problem no longer needs help. I used the quantized vectors and I managed to get the painting arrays as small as 30 elements even in larger paintings. Also, real time replicated painting is done by sending Multicast RPC to current listeners with every 0.05 seconds. The way I originally did it, made zero sense.Thanks all.

edit: I also replicate only FVector points that are in in 3D space. Every client locally calculates and draws strokes using those Quantized vector points.