I can confirm I’ve had this issue too. It seems to be to do with 4.16 changes to “UseAdaptiveNetUpdateFrequency”. It is now default on in 4.16 (whereas was default off before then). So you can override it in your DefaultEngine.ini to…
After upgrading to 4.16, I noticed huge spikes in network latency when calling NetMulticast RPC functions and using OnRep_ properties / functions in C++.
I have made a test project in 4.15.3 that I then ported over in 4.16.1 to help you see the issue for yourself, this is a rather serious regression.
In those demo projects, pressing TAB will set a variable to TRUE, which will then be replicated to the server using OnRep_. Releasing TAB will set the same variable to FALSE. All four actions (sending boolean false & true, receiving boolean false & true) are logged in the console.
By going into the Engines Preferences, it is possible to enable timestamps on the console input to see the delay between sending a boolean and receiving a boolean.
What happens is (and it is visible with the naked eye as well) that in 4.15.3 the delay between setting a variable and having that variable replicated is maybe 2 to 3 ticks. But in 4.16, that delay will vary from about 6 to 40 (!) ticks.
Just start both projects, hit play with 1 player AND dedicated server, hit then release TAB 20 times at random intervals, in each project, and see for yourself.
You can call ForceNetUpdate() or SetNetUpdateTime() to force an actor’s properties (or queued unreliable multicast rpcs) to send on the next server net tick.
Can confirm this did help. It’s okay to keep it, but once it’s fixed i’d turn it back on.
or possibly use 's solution down below. Although I have not tried it.
If enabled, update frequency is
allowed to ramp down to
MinNetUpdateFrequency for an actor
when no replicated properties have
changed.
at-least it’s fixed and slated for 4.19 so if you used this probably change it back when or if you update to 4.19
Do you know what this TODO is referring to and how the limitations of it it would show up in practice?
void UNetDriver::CancelAdaptiveReplication(FNetworkObjectInfo& InNetworkActor)
{
if (IsAdaptiveNetUpdateFrequencyEnabled())
{
if (AActor* Actor = InNetworkActor.Actor)
{
if (UWorld* ActorWorld = Actor->GetWorld())
{
const float ExpectedNetDelay = (1.0f / Actor->NetUpdateFrequency);
Actor->SetNetUpdateTime( ActorWorld->GetTimeSeconds() + FMath::FRandRange( 0.5f, 1.0f ) * ExpectedNetDelay );
InNetworkActor.OptimalNetUpdateDelta = ExpectedNetDelay;
// TODO: we really need a way to cancel the throttling completely. OptimalNetUpdateDelta is going to be recalculated based on LastNetReplicateTime.
}
}
}
}
Also, does CancelAdaptiveReplication, ForceNetUpdate, SetNetUpdateTime, etc. work for overriding the adaptive frequency in demo recording? (demo.UseAdaptiveReplayUpdateFrequency), or only for the main network driver?