Net.RepGraph.PrintGraph
Net.RepGraph.PrintGraph
#Overview
name: Net.RepGraph.PrintGraph
This variable is created as a Console Variable (cvar).
- type:
Cmd
- help: ``
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of Net.RepGraph.PrintGraph is to print the replication graph to the log, providing a hierarchical representation of the graph and its lists. This setting variable is used for debugging and analyzing the replication system in Unreal Engine 5.
This setting variable is primarily used in the ReplicationGraph plugin, specifically within the ReplicationGraphDebugging namespace. It is part of the network replication debugging tools for Unreal Engine.
The value of this variable is not set directly, but rather it is used as a console command. It is implemented as an FAutoConsoleCommand, which means it can be triggered from the game console or through code.
This variable interacts with the LogGraphHelper function, which is called when the console command is executed. The LogGraphHelper function is responsible for actually printing the graph information to the log.
Developers should be aware that this is a debugging tool and should be used primarily during development and testing phases. It may have performance implications if used excessively in a production environment.
Best practices for using this variable include:
- Use it sparingly in production builds, as it can generate a lot of log output.
- Combine it with other debugging commands like “Net.RepGraph.PrintGraph class” or “Net.RepGraph.PrintGraph nclass” for more specific output.
- Use it in conjunction with other replication graph debugging tools to get a comprehensive view of the replication system’s state.
- Be cautious when using it in multiplayer scenarios, as it may affect network performance.
This tool is particularly useful for understanding how actors are being replicated and how the replication graph is structured, which can be valuable for optimizing network performance in Unreal Engine games.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Runtime/ReplicationGraph/Source/Private/ReplicationGraphDebugging.cpp:934
Scope: file
Source code excerpt:
}
FAutoConsoleCommand RepGraphPrintGraph(TEXT("Net.RepGraph.PrintGraph"), TEXT(""), FConsoleCommandWithArgsDelegate::CreateLambda([](const TArray< FString >& Args)
{
LogGraphHelper(*GLog, Args);
}));
FAutoConsoleCommand RepGraphDrawGraph(TEXT("Net.RepGraph.DrawGraph"), TEXT(""), FConsoleCommandWithArgsDelegate::CreateLambda([](const TArray< FString >& InArgs)
#Loc: <Workspace>/Engine/Plugins/Runtime/ReplicationGraph/Source/Private/ReplicationGraphDebugging.cpp:15
Scope: file
Source code excerpt:
* ===================== Debugging Tools (WIP) =====================
*
* Net.RepGraph.PrintGraph Prints replication graph to log (hierarchical representation of graph and its lists)
* Net.RepGraph.DrawGraph Draws replication graph on HUD
*
* Net.RepGraph.PrintAllActorInfo <MatchString> Prints global and connection specific info about actors whose pathname contains MatchString. Can be called from client.
*
* Net.RepGraph.PrioritizedLists.Print <ConnectionIdx> Prints prioritized replication list to log
* Net.RepGraph.PrioritizedLists.Draw <ConnectionIdx> Draws prioritized replication list on HUD
*
* Net.RepGraph.PrintAll <Frames> <ConnectionIdx> <"Class"/"Num"> Prints the replication graph and prioritized list for given ConnectionIdx for given Frames.
*
* Net.PacketBudget.HUD Draws Packet Budget details on HUD
* Net.PacketBudget.HUD.Toggle Toggles capturing/updating the Packet Budget details HUD
*
* Net.RepGraph.Lists.DisplayDebug Displays RepActoList stats on HUD
* Net.RepGraph.Lists.Stats Prints RepActorList stats to Log
* Net.RepGraph.Lists.Details Prints extended RepActorList details to log
*
* Net.RepGraph.StarvedList <ConnectionIdx> Prints actor starvation stats to HUD
*
* Net.RepGraph.SetDebugActor <ClassName> Call on client: sets server debug actor to the closest actor that matches ClassName. See RepGraphConditionalActorBreakpoint
*
*/
namespace RepGraphDebugging
{
UReplicationGraph* FindReplicationGraphHelper(const TArray<FString>& Args)
{
FName NetDriverName = NAME_GameNetDriver;
const FString* DriverStr = Args.FindByPredicate([](const FString& Str) { return Str.Contains(TEXT("driver=")); });
if (DriverStr)
{
#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/System/LyraReplicationGraph.cpp:56
Scope: file
Source code excerpt:
* If it is replication graph related, there are several useful commands that can be used: see ReplicationGraph_Debugging.cpp. The most useful are below. Use the 'cheat' command to run these on the server from a client.
*
* "Net.RepGraph.PrintGraph" - this will print the graph to the log: each node and actor.
* "Net.RepGraph.PrintGraph class" - same as above but will group by class.
* "Net.RepGraph.PrintGraph nclass" - same as above but will group by native classes (hides blueprint noise)
*
* Net.RepGraph.PrintAll <Frames> <ConnectionIdx> <"Class"/"Nclass"> - will print the entire graph, the gathered actors, and how they were prioritized for a given connection for X amount of frames.
*
* Net.RepGraph.PrintAllActorInfo <ActorMatchString> - will print the class, global, and connection replication info associated with an actor/class. If MatchString is empty will print everything. Call directly from client.
*
* Lyra.RepGraph.PrintRouting - will print the EClassRepNodeMapping for each class. That is, how a given actor class is routed (or not) in the Replication Graph.
*
*/
#include "LyraReplicationGraph.h"
#include "Net/UnrealNetwork.h"
#include "Engine/LevelStreaming.h"
#include "EngineUtils.h"
#include "CoreGlobals.h"
#if WITH_GAMEPLAY_DEBUGGER
#include "GameplayDebuggerCategoryReplicator.h"
#endif
#include "GameFramework/GameModeBase.h"
#include "GameFramework/GameState.h"
#include "GameFramework/PlayerState.h"
#include "GameFramework/Pawn.h"
#include "Engine/LevelScriptActor.h"
#include "Engine/NetConnection.h"
#include "UObject/UObjectIterator.h"
#include "LyraReplicationGraphSettings.h"
#include "Character/LyraCharacter.h"
#include "Player/LyraPlayerController.h"
DEFINE_LOG_CATEGORY( LogLyraRepGraph );
namespace Lyra::RepGraph
{
float DestructionInfoMaxDist = 30000.f;
static FAutoConsoleVariableRef CVarLyraRepGraphDestructMaxDist(TEXT("Lyra.RepGraph.DestructInfo.MaxDist"), DestructionInfoMaxDist, TEXT("Max distance (not squared) to rep destruct infos at"), ECVF_Default);
int32 DisplayClientLevelStreaming = 0;
static FAutoConsoleVariableRef CVarLyraRepGraphDisplayClientLevelStreaming(TEXT("Lyra.RepGraph.DisplayClientLevelStreaming"), DisplayClientLevelStreaming, TEXT(""), ECVF_Default);
float CellSize = 10000.f;
static FAutoConsoleVariableRef CVarLyraRepGraphCellSize(TEXT("Lyra.RepGraph.CellSize"), CellSize, TEXT(""), ECVF_Default);
// Essentially "Min X" for replication. This is just an initial value. The system will reset itself if actors appears outside of this.
float SpatialBiasX = -150000.f;
static FAutoConsoleVariableRef CVarLyraRepGraphSpatialBiasX(TEXT("Lyra.RepGraph.SpatialBiasX"), SpatialBiasX, TEXT(""), ECVF_Default);
// Essentially "Min Y" for replication. This is just an initial value. The system will reset itself if actors appears outside of this.
float SpatialBiasY = -200000.f;
static FAutoConsoleVariableRef CVarLyraRepSpatialBiasY(TEXT("Lyra.RepGraph.SpatialBiasY"), SpatialBiasY, TEXT(""), ECVF_Default);
// How many buckets to spread dynamic, spatialized actors across. High number = more buckets = smaller effective replication frequency. This happens before individual actors do their own NetUpdateFrequency check.
int32 DynamicActorFrequencyBuckets = 3;
static FAutoConsoleVariableRef CVarLyraRepDynamicActorFrequencyBuckets(TEXT("Lyra.RepGraph.DynamicActorFrequencyBuckets"), DynamicActorFrequencyBuckets, TEXT(""), ECVF_Default);
int32 DisableSpatialRebuilds = 1;
static FAutoConsoleVariableRef CVarLyraRepDisableSpatialRebuilds(TEXT("Lyra.RepGraph.DisableSpatialRebuilds"), DisableSpatialRebuilds, TEXT(""), ECVF_Default);
int32 LogLazyInitClasses = 0;
static FAutoConsoleVariableRef CVarLyraRepLogLazyInitClasses(TEXT("Lyra.RepGraph.LogLazyInitClasses"), LogLazyInitClasses, TEXT(""), ECVF_Default);
// How much bandwidth to use for FastShared movement updates. This is counted independently of the NetDriver's target bandwidth.
int32 TargetKBytesSecFastSharedPath = 10;
static FAutoConsoleVariableRef CVarLyraRepTargetKBytesSecFastSharedPath(TEXT("Lyra.RepGraph.TargetKBytesSecFastSharedPath"), TargetKBytesSecFastSharedPath, TEXT(""), ECVF_Default);
float FastSharedPathCullDistPct = 0.80f;
static FAutoConsoleVariableRef CVarLyraRepFastSharedPathCullDistPct(TEXT("Lyra.RepGraph.FastSharedPathCullDistPct"), FastSharedPathCullDistPct, TEXT(""), ECVF_Default);
int32 EnableFastSharedPath = 1;
static FAutoConsoleVariableRef CVarLyraRepEnableFastSharedPath(TEXT("Lyra.RepGraph.EnableFastSharedPath"), EnableFastSharedPath, TEXT(""), ECVF_Default);