How to replicate larger Arrays properly

Hello,

I have a question regarding the replication of a TArray. We have to replicate this array at runtime and there is no way around that, because it is generated from external data over which we have no control.

Currently I replicate the Array to the server with an “On Server” rpc event and from there on in a multicast to all players. If I do this I get sometimes the error. The error appears on client side a freezes the client after that.

[2021.09.17-08.40.44:123][ 30]LogNetTraffic: Error: UChannel::ReceivedRawBunch: Bunch.IsError() after ReceivedNextBunch 1

The structure which I replicate in the array is:

USTRUCT(BlueprintType)
struct FSingleCableData
{
	GENERATED_BODY()

		UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Parser")
		TArray<FVector> points;

		UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Parser")
		float Thickness;
	
};

TArray<FSingleCableData> array;

The event is set to reliable.

This error only appears on some clients and I have no real idea how to tackle it.

One added input. Does it help to share this array via JSON or something? Its normally not thaat large. But perhpaps this is the way

how large is your large array ?

The Array has at top about a hundred elements and the vectors in each element is between 10-100 floats.

If I’m understanding your correctly, if you’re having at most 100 in the array and (again, at most) 100 floats, you could be seeing as many as 10’000 elements.
What you’re after is FTR or “Fast TArray Replication.” See the Remarks in the link for more details and if you hit any snags with setting it up, let us know :slight_smile:

1 Like

Ok thanks, that looks good I will try useing it.

Ok cool, that actually looks quite nice. I will try using that. Thanks!