Is it possible to have a variable net update frequency, so that if player Y is greater than 1000 units from player X, player X receives his updates less frequently?
I think the setting you are looking for is: NetCullDistanceSquared. NetCullDistanceSquared is the square of the max distance from the client’s viewpoint that this actor is relevant and will be replicated.
Thanks, although this is a straight up cull rather than a LOD type deal.
I do not believe a system where it replicates less frequently based on distance is built in to the engine. You can always add the code to do this yourself.
You may be able to use Net Update Frequency, Min Net Update Frequency and Priority to get part of what you want. But it will only start using the system when it deems there to be too much network traffic. So that might work for you, but still isn’t exactly what you asked for.
There’s something called Adaptive Net frequency. which might be used by the engine to automatically decide to lower the net frequency based on how often it actually needs it.
“… , there is the Adaptive Net Update Frequency setting, which can be enabled with the net.UseAdaptiveNetUpdateFrequency
console variable. Once enabled, the AActor::NetUpdateFrequency
property is treated as the maximum update frequency and the AActor::MinNetUpdateFrequency
property is the minimum update frequency. The replication system dynamically adjusts the Update Frequency within this range depending on how often the Actor’s replicated properties actually change. This feature helps reduce the processing of Actors that don’t end up having any state changes to replicate…” -Matt Gibson
but to do that depending on distance is like dartanlla said " you can implement your code"
but on multiplayer i don’t see much of a sense, unless you always have only 2 users. since afaik the net frequency will impact all players. that means, that, depending on the distance between A and B you are potentially changing how A updates to C,D,E and all others.
if you want to implement an LOD type of thing, i’ve made a plugin for significance, which will easily let you modify any thing you want based on any other criteria, by default distance to an actor.
Battlefield (EA/DICE) has a high frequency update (hfu) set up. It uses 2 base net hemispheres and the camera frustum. Anything outside 80 meters and not in direct view (frustum) is replicated at 3Hz. 30-80m not in view is 10Hz.
the plugin for significance that i’ve posted above would be perfect for this.
i am confused how is this possible though, @RevOverDrive:
where is that camera located? is that on each client?
Does each client have the exact same camera?
Or can you change the update frequency on the client side?
Battlefield uses a single camera that’s placed in the head per character. The frequency of updates on specific actors is per player based on their distance to actor and whether it’s in frustum or not. Each player still gets a 60Hz update (unless throttled). What’s in the update is determined by the hfu.
UE’s replication system does a relevancy and priority check on every actor every server tick per player. BF’s does the same, but in the final step it determines the HFU for each. At some level it’s tracking the last update game time per actor per player.
UE’s Replication Flow (High-Level)
- Determine which actors are replicating and perform checks to determine dormancy, update frequency, and owning connection.
- Add actors that pass these checks to a list to be considered for replication.
- Loop through each connection and perform checks based on the current actor and connection. At the end of this step, there is a list of actors that are considered for replication for each connection.
- Sort the actors by priority for each connection.
- Determine if the actor is relevant for this connection.
- Replicate the actor to the current connection.
thanks so much for your response.
Are you saying that you can change the update frequency of actor X for each player (client).
how do you achieve this?
does that means that you implemented custom code to calculate a per client update frequency and apply the filter manually right?
there’s no way to do this out of the box for ue ?
This is how DICE does it for their Battlefield games series since BF4.
And Yes, there’s modifies the update frequency per actor for each client every server tick.
I have not implemented this in UE, but it is possible. You’d have to add the modifications to the Net Driver. Theses changes would prevent updating to the next UE version though. Say you make the changes in 5.4… if you update the project to 5.5 it’ll be overwritten by the new net driver.
awesome! thanks a lot!
i did some research, i think it could be implemented with partial dormancy
By setting the actor dormancy to DormantPartial
and the override GetNetDormancy
you can specify the dormancy level of each actor to each client. no need to modify net driver.
And since dormancy is executed before checking for attribute changes (almost at the start of the net pipeline) it could even be faster (as oppossed to filter at the end).
and if needed one can use forcenetflush and forcenetupdate.
GetNetDormancy receives all the info for checking if it’s on the viewport of the other client.
virtual bool GetNetDormancy
(
const FVector & ViewPos,
const FVector & ViewDir,
class AActor * Viewer,
AActor * ViewTarget,
UActorChannel * InChannel,
float Time,
bool bLowBandwidth
)
though this doc says that partial dormancy is meant to be deprecated
(and also warns about changing properties while dormant)