The following code can be found in FReplicationWriter::Write
if (HasDataToSend(WriteContext)) { if (WriteContext.bHasHugeObjectToSend) { WriteResult = UDataStream::EWriteResult::HasMoreData; } else if (WriteContext.bCanWriteMoreData && ((int32)WriteContext.NumWrittenPacketsInThisBatch < GReplicationWriterMaxAllowedPacketsIfNotHugeObject)) { WriteResult = UDataStream::EWriteResult::HasMoreData; } else { WriteResult = UDataStream::EWriteResult::Ok; } }…in the final else, we return a EWriteResult::Ok which means we are done sending packets this frame even though we have more data to send (Context.bHasDestroyedObjectsToSend | Context.bHasUpdatedObjectsToSend). Why is that? If we have the bandwidth, why not keep sending until the connection is saturated or the packet window is full?
Maybe I just need to bump GReplicationWriterMaxAllowedPacketsIfNotHugeObject to a higher number?
GReplicationWriterMaxAllowedPacketsIfNotHugeObject is is mostly in place to even out performance (both on server and client) too not send too many packets per frame. If you have the headroom it can be bumped..
…I guess my question is, why not let bandwidth constraints enforce this? Connection saturation checks are performed earlier in the call stack, why the need for this protective measure if we’re already ensuring we don’t overstep the available bandwidth (and therefore packets sent this frame) for the connection? Do they serve different purposes?
Thank you again for the additional info, it will help us further in our debugging of an issue with respect to server->client acks getting lost and/or delayed.
That is a good question and the truth is that the rate control is not very solid at the moment especially if the server framerate varies a lot and not all systems play nicely, the packet limit is mostly in place to even things out for the client.
Fortnite uses a very high setting for allowed bandwidth and with the ReplicationWriter being greedy it will might send a lot of data after a spike which might affect client performance in a bad way.
If you have tuned your data/systems to behave well there is no need to have this max packet limit.