void ULyraReplicationGraphNode_PlayerStateFrequencyLimiter::PrepareForReplication()
{
ReplicationActorLists.Reset();
ForceNetUpdateReplicationActorList.Reset();
ReplicationActorLists.AddDefaulted();
FActorRepListRefView* CurrentList = &ReplicationActorLists[0];
// We rebuild our lists of player states each frame. This is not as efficient as it could be but its the simplest way
// to handle players disconnecting and keeping the lists compact. If the lists were persistent we would need to defrag them as players left.
for (TActorIterator<APlayerState> It(GetWorld()); It; ++It)
{
APlayerState* PS = *It;
if (IsActorValidForReplicationGather(PS) == false)
{
continue;
}
if (CurrentList->Num() >= TargetActorsPerFrame)
{
ReplicationActorLists.AddDefaulted();
CurrentList = &ReplicationActorLists.Last();
}
CurrentList->Add(PS);
}
}
void ULyraReplicationGraphNode_PlayerStateFrequencyLimiter::GatherActorListsForConnection(const FConnectionGatherActorListParameters& Params)
{
const int32 ListIdx = Params.ReplicationFrameNum % ReplicationActorLists.Num();
Params.OutGatheredReplicationLists.AddReplicationActorList(ReplicationActorLists[ListIdx]);
if (ForceNetUpdateReplicationActorList.Num() > 0)
{
Params.OutGatheredReplicationLists.AddReplicationActorList(ForceNetUpdateReplicationActorList);
}
}
In LyraGame, this is all usage of ForceNetUpdateReplicationActorList
.
I don’t understand LyraReplicationGraph.cpp (919).
ForceNetUpdateReplicationActorList.Num() > 0
I don’t see any code anywhere that increments the ForceNetUpdateReplicationActorList. However, the code is written with the assumption that the number of ForceNetUpdateReplicationActorList will be increased. Is this correct code or am I not understanding it correctly?