What would be the best way to send data over RPC?

So in a multiplayer environment, I am building a TArray of inputs over a series of frames, sending this data to the server, which then multicasts this data to everyone for the purpose of simulating movement, the list is then emptied in order to build a new one.

the problem I have is that if I send a TArray as either const reference or nested in a structure, the server never gets the data, as const reference it always points to some random block of irrelevant data and nested in a structure it just considers it to have none.

My next approach was to build the data as a string and send it as that and then parse the string to extract the data, this worked perfectly for about 10 seconds until the client gets kicked for the string being too long. This happens if the client uses every possible input, while in the real world that would never be useful to the player in the game, its always a probably that somebody will just press every button at once to see what happens.

I can’t send the data as individual packets as they need to be sent together to avoid packets being received in the wrong order and not having to give each packet its own unique id to rebuild the list when its all received as this would ramp up the amount of data being sent by each client.

Why are you not using the built in movement replication?

I’ve picked up the project quite late in to development, the previous guys who wrote our movement code decided against using a child of the base character movement component, it seems easier to add MP functionality to it than to have to re-write absolutely everything just to use the default base.

our game meant the base movement controller doesn’t work and ticking “replicate movement” only works if you have zero latency, therefore I must write my own movement simulation & prediction methods.

as const reference it always points to
some random block of irrelevant data
and nested in a structure it just
considers it to have none
Are these known bugs? Seems strange that this wouldn’t work.
Anyway, is there some reason you can’t just pass the array in the RPC by value instead of const reference?

Sorry i’ve only just seen this reply. When I tried to do that it game me compiler errors saying that I have to pass arrays as const reference and wouldn’t allow me to use it any other way.

I ended up (for the mean time until i come back to reworking that section) just building a string as a packet and sending that over as a means until 4.11 comes out and I can refactor it.