You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Replication graph changes to allow for subconnection calculations as well, matching functionality of the netdriver system.
#rb: LouisPhilippe.Seguin, Jon.Nabozny #ROBOMERGE-OWNER: ben.marsh #ROBOMERGE-AUTHOR: jake.leonard #ROBOMERGE-SOURCE: CL 5922969 via CL 5931747 via CL 5931993 #ROBOMERGE-BOT: BUILD (Main -> Dev-Build) [CL 5939852 by jake leonard in Dev-Build branch]
This commit is contained in:
@@ -333,44 +333,65 @@ bool AReplicationGraphDebugActor::ServerCellInfo_Validate()
|
||||
|
||||
void AReplicationGraphDebugActor::ServerCellInfo_Implementation()
|
||||
{
|
||||
FNetViewer Viewer(GetNetConnection(), 0.f);
|
||||
TArray<FVector, FReplicationGraphConnectionsAllocator> LocationsSent;
|
||||
TArray<UNetConnection*, FReplicationGraphConnectionsAllocator> ConnectionsToConsider;
|
||||
|
||||
UReplicationGraphNode_GridSpatialization2D* GridNode = nullptr;
|
||||
for (UReplicationGraphNode* Node : ReplicationGraph->GlobalGraphNodes)
|
||||
UNetConnection* PrimaryNetConnection = GetNetConnection();
|
||||
ConnectionsToConsider.Add(PrimaryNetConnection);
|
||||
for (UChildConnection* Child : PrimaryNetConnection->Children)
|
||||
{
|
||||
GridNode = Cast<UReplicationGraphNode_GridSpatialization2D>(Node);
|
||||
if (GridNode)
|
||||
ConnectionsToConsider.Add((UNetConnection*)Child);
|
||||
}
|
||||
|
||||
for (UNetConnection* Connection : ConnectionsToConsider)
|
||||
{
|
||||
FNetViewer Viewer(Connection, 0.f);
|
||||
|
||||
UReplicationGraphNode_GridSpatialization2D* GridNode = nullptr;
|
||||
for (UReplicationGraphNode* Node : ReplicationGraph->GlobalGraphNodes)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (GridNode == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int32 CellX = FMath::Max<int32>(0, (Viewer.ViewLocation.X - GridNode->SpatialBias.X) / GridNode->CellSize);
|
||||
int32 CellY = FMath::Max<int32>(0, (Viewer.ViewLocation.Y - GridNode->SpatialBias.Y) / GridNode->CellSize);
|
||||
|
||||
TArray<AActor*> ActorsInCell;
|
||||
|
||||
FVector CellLocation(GridNode->SpatialBias.X + (((float)(CellX)+0.5f) * GridNode->CellSize), GridNode->SpatialBias.Y + (((float)(CellY)+0.5f) * GridNode->CellSize), Viewer.ViewLocation.Z);
|
||||
FVector CellExtent(GridNode->CellSize, GridNode->CellSize, 10.f);
|
||||
|
||||
if (GridNode->Grid.IsValidIndex(CellX))
|
||||
{
|
||||
TArray<UReplicationGraphNode_GridCell*>& GridY = GridNode->Grid[CellX];
|
||||
if (GridY.IsValidIndex(CellY))
|
||||
{
|
||||
if (UReplicationGraphNode_GridCell* LeafNode = GridY[CellY])
|
||||
GridNode = Cast<UReplicationGraphNode_GridSpatialization2D>(Node);
|
||||
if (GridNode)
|
||||
{
|
||||
LeafNode->GetAllActorsInNode_Debugging(ActorsInCell);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ClientCellInfo(CellLocation, CellExtent, ActorsInCell);
|
||||
if (GridNode == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int32 CellX = FMath::Max<int32>(0, (Viewer.ViewLocation.X - GridNode->SpatialBias.X) / GridNode->CellSize);
|
||||
int32 CellY = FMath::Max<int32>(0, (Viewer.ViewLocation.Y - GridNode->SpatialBias.Y) / GridNode->CellSize);
|
||||
|
||||
FVector CellLocation(GridNode->SpatialBias.X + (((float)(CellX)+0.5f) * GridNode->CellSize), GridNode->SpatialBias.Y + (((float)(CellY)+0.5f) * GridNode->CellSize), Viewer.ViewLocation.Z);
|
||||
|
||||
if (LocationsSent.Contains(CellLocation))
|
||||
{
|
||||
UE_LOG(LogReplicationGraph, Verbose, TEXT("Skipping location %s as we've already sent it"), *(CellLocation.ToString()));
|
||||
continue;
|
||||
}
|
||||
|
||||
LocationsSent.Add(CellLocation);
|
||||
|
||||
TArray<AActor*> ActorsInCell;
|
||||
FVector CellExtent(GridNode->CellSize, GridNode->CellSize, 10.f);
|
||||
|
||||
if (GridNode->Grid.IsValidIndex(CellX))
|
||||
{
|
||||
TArray<UReplicationGraphNode_GridCell*>& GridY = GridNode->Grid[CellX];
|
||||
if (GridY.IsValidIndex(CellY))
|
||||
{
|
||||
if (UReplicationGraphNode_GridCell* LeafNode = GridY[CellY])
|
||||
{
|
||||
LeafNode->GetAllActorsInNode_Debugging(ActorsInCell);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ClientCellInfo(CellLocation, CellExtent, ActorsInCell);
|
||||
}
|
||||
}
|
||||
|
||||
void AReplicationGraphDebugActor::ClientCellInfo_Implementation(FVector CellLocation, FVector CellExtent, const TArray<AActor*>& Actors)
|
||||
@@ -869,7 +890,6 @@ void LogGraphHelper(FOutputDevice& Ar, const TArray< FString >& Args)
|
||||
|
||||
if (!Graph)
|
||||
{
|
||||
UE_LOG(LogReplicationGraph, Warning, TEXT("Could not find valid Replication Graph."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1108,38 +1128,42 @@ void PrintPrioritizedList(FOutputDevice& Ar, UNetReplicationGraphConnection* Con
|
||||
|
||||
// Skipped actors
|
||||
#if REPGRAPH_DETAILS
|
||||
Ar.Logf(TEXT("[%d Skipped Actors]"), PrioritizedList->SkippedDebugDetails->Num());
|
||||
|
||||
FNativeClassAccumulator DormantClasses;
|
||||
FNativeClassAccumulator CulledClasses;
|
||||
|
||||
for (const FSkippedActorFullDebugDetails& SkippedDetails : *PrioritizedList->SkippedDebugDetails)
|
||||
if (PrioritizedList->SkippedDebugDetails.IsValid())
|
||||
{
|
||||
FString SkippedStr;
|
||||
if (SkippedDetails.bWasDormant)
|
||||
{
|
||||
SkippedStr = TEXT("Dormant");
|
||||
DormantClasses.Increment(SkippedDetails.Actor->GetClass());
|
||||
}
|
||||
else if (SkippedDetails.DistanceCulled > 0.f)
|
||||
{
|
||||
SkippedStr = FString::Printf(TEXT("Dist Culled %.2f"), SkippedDetails.DistanceCulled);
|
||||
CulledClasses.Increment(SkippedDetails.Actor->GetClass());
|
||||
}
|
||||
else if (SkippedDetails.FramesTillNextReplication > 0)
|
||||
{
|
||||
SkippedStr = FString::Printf(TEXT("Not ready (%d frames left)"), SkippedDetails.FramesTillNextReplication);
|
||||
}
|
||||
else
|
||||
{
|
||||
SkippedStr = TEXT("Unknown???");
|
||||
}
|
||||
Ar.Logf(TEXT("[%d Skipped Actors]"), PrioritizedList->SkippedDebugDetails->Num());
|
||||
|
||||
Ar.Logf(TEXT("%-40s %s"), *GetActorRepListTypeDebugString(SkippedDetails.Actor), *SkippedStr);
|
||||
}
|
||||
FNativeClassAccumulator DormantClasses;
|
||||
FNativeClassAccumulator CulledClasses;
|
||||
|
||||
for (const FSkippedActorFullDebugDetails& SkippedDetails : *PrioritizedList->SkippedDebugDetails)
|
||||
{
|
||||
FString SkippedStr;
|
||||
if (SkippedDetails.bWasDormant)
|
||||
{
|
||||
SkippedStr = TEXT("Dormant");
|
||||
DormantClasses.Increment(SkippedDetails.Actor->GetClass());
|
||||
}
|
||||
else if (SkippedDetails.DistanceCulled > 0.f)
|
||||
{
|
||||
SkippedStr = FString::Printf(TEXT("Dist Culled %.2f"), SkippedDetails.DistanceCulled);
|
||||
CulledClasses.Increment(SkippedDetails.Actor->GetClass());
|
||||
}
|
||||
else if (SkippedDetails.FramesTillNextReplication > 0)
|
||||
{
|
||||
SkippedStr = FString::Printf(TEXT("Not ready (%d frames left)"), SkippedDetails.FramesTillNextReplication);
|
||||
}
|
||||
else
|
||||
{
|
||||
SkippedStr = TEXT("Unknown???");
|
||||
}
|
||||
|
||||
Ar.Logf(TEXT("%-40s %s"), *GetActorRepListTypeDebugString(SkippedDetails.Actor), *SkippedStr);
|
||||
}
|
||||
|
||||
Ar.Logf(TEXT(" Dormant Classes: %s"), *DormantClasses.BuildString());
|
||||
Ar.Logf(TEXT(" Culled Classes: %s"), *CulledClasses.BuildString());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user