In Some ReplicationGraphNodes, there is code to set net culldistance zero. and in some condition restore the cull distance back.
For Example:
void UReplicationGraphNode_ConnectionDormancyNode::ConditionalGatherDormantActorsForConnection(FActorRepListRefView& ConnectionList, const FConnectionGatherActorListParameters& Params, FActorRepListRefView* RemovedList)
{
FPerConnectionActorInfoMap& ConnectionActorInfoMap = Params.ConnectionManager.ActorInfoMap;
FGlobalActorReplicationInfoMap* GlobalActorReplicationInfoMap = GraphGlobals->GlobalActorReplicationInfoMap;
// We can trickle if the TrickelStartCounter is 0. (Just trying to give it a few frames to settle)
bool bShouldTrickle = TrickleStartCounter == 0;
for (int32 idx = ConnectionList.Num()-1; idx >= 0; --idx)
{
FActorRepListType Actor = ConnectionList[idx];
FConnectionReplicationActorInfo& ConnectionActorInfo = ConnectionActorInfoMap.FindOrAdd(Actor);
if (ConnectionActorInfo.bDormantOnConnection)
{
// If we trickled this actor, restore CullDistance to the default
if (ConnectionActorInfo.GetCullDistanceSquared() <= 0.f)
{
FGlobalActorReplicationInfo& GlobalInfo = GlobalActorReplicationInfoMap->Get(Actor);
ConnectionActorInfo.SetCullDistanceSquared(GlobalInfo.Settings.GetCullDistanceSquared());
}
// He can be removed
ConnectionList.RemoveAtSwap(idx);
if (RemovedList)
{
RemovedList->PrepareForWrite();
RemovedList->Add(Actor);
}
UE_CLOG(CVar_RepGraph_LogNetDormancyDetails > 0, LogReplicationGraph, Display, TEXT("GRAPH_DORMANCY: Actor %s is Dormant on %s. Removing from list. (%d elements left)"), *Actor->GetPathName(), *GetName(), ConnectionList.Num());
bShouldTrickle = false; // Dont trickle this frame because we are still encountering dormant actors
}
else if (CVar_RepGraph_TrickleDistCullOnDormancyNodes > 0 && bShouldTrickle)
{
ConnectionActorInfo.SetCullDistanceSquared(0.f);
bShouldTrickle = false; // trickle one actor per frame
}
}
what is the purpose to do this ?