Hi everyone, please help me. I’m trying to add multiplayer support to the generation plugin. I’m trying to send from the server to clients information about generation, I break this information into parts, as it exceeds 64kb and send it to PlayerControllere in a tick, I do it as follows.
void AWFCPlayerController::TickTransfer()
{
if (!HasAuthority()) return;
UNetConnection* netConnection = GetNetConnection();
if (netConnection == nullptr) return; // No net connection yet
TArray<uint8> ChunkBuffer;
UActorChannel* Channel = netConnection->FindActorChannelRef(this);
DequeueData();
if (DataChunksToSend == 0)
return;
if (DataChunksSent < DataChunksToSend && Channel->NumOutRec < (RELIABLE_BUFFER / 2))
{
ChunkBuffer.Reset();
ChunkBuffer.Empty();
const int32 StartIndex = DataChunksSent * MaxBytesPerRPC;
const int32 NumElements = FMath::Min(MaxBytesPerRPC, Data.Num() - StartIndex);
ChunkBuffer.Append(Data.GetData() + StartIndex, NumElements);
ClientReceiveData(ChunkBuffer);
DataChunksSent++;
}
if (DataChunksSent >= DataChunksToSend)
{
ClientNotifyAllDataReceived();
Data.Empty();
DataChunksSent = 0;
DataChunksToSend = 0;
}
}
Everything is sent, but after that there is a delay in replication of the character movement.
also a warning appears (
CreateSavedMove: Hit limit of 96 saved moves (timing out or very bad ping?)
How can this be solved or can you suggest a better approach? Thanks!