Summary:
UReplicationGraphNode_DynamicSpatialFrequency does not update the actor’s WorldLocation in the GlobalActorReplicationInfoMap, resulting in all distance-based relevance and update frequency calculations using an incorrect default location (typically (0,0,0)). This leads to replicated actors being incorrectly treated as irrelevant or distant, causing repeated client-side destruction and respawning. The symptoms include PostNetInit() being called every frame on affected actors, and inconsistent calls to EndPlay().
Observed Behavior:
- GlobalActorReplicationInfo.WorldLocation is never updated by UReplicationGraphNode_DynamicSpatialFrequency.
- All actors are treated as if located at (0,0,0) for spatial distance checks.
- Actors constantly become “distant” and are removed from relevance, only to be re-added next frame.
Expected Behavior:
- The actor’s actual world location should be updated every frame (or before replication gather).
- Distance and frequency logic should behave correctly, resulting in stable actor relevance.
- NetChannel should persist as long as the actor is actually relevant to the client.
Proposed Fix:
Update the constructor and override PrepareForReplication() on UReplicationGraphNode_DynamicSpatialFrequency to ensure actor locations are correctly updated:
`UReplicationGraphNode_DynamicSpatialFrequency::UReplicationGraphNode_DynamicSpatialFrequency()
{
bRequiresPrepareForReplicationCall = true;
}
void UReplicationGraphNode_DynamicSpatialFrequency::PrepareForReplication()
{
FGlobalActorReplicationInfoMap* GlobalRepMap = GraphGlobals->GlobalActorReplicationInfoMap;
repCheck(GlobalRepMap);
for (FActorRepListType& Actor : ReplicationActorList)
{
FGlobalActorReplicationInfo& GlobalInfo = GlobalRepMap->Get(Actor);
if (IsValid(Actor))
{
FGlobalActorReplicationInfo& ActorRepInfo = GlobalRepMap->Get(Actor);
ActorRepInfo.WorldLocation = Actor->GetActorLocation();
}
}
}`This aligns with the behavior of other spatial nodes in the replication graph (e.g., UReplicationGraphNode_GridSpatialization2D) and ensures relevance calculations are based on correct actor positions.
Best regards,
Peter Freese