ShowFlag.ServerDrawDebug

ShowFlag.ServerDrawDebug

#Overview

name: ShowFlag.ServerDrawDebug

This variable is created as a Console Variable (cvar).

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ShowFlag.ServerDrawDebug is to control the visibility of debug rendering from the Dedicated Server during Play In Editor mode (with Use Dedicated Server checked) in the client viewport.

This setting variable is primarily used in the Unreal Engine’s rendering and debugging systems. It is particularly relevant for the engine’s multiplayer and networking components.

The value of this variable is set through the engine’s show flags system, which is typically controlled via the viewport or editor settings. It can also be influenced by the bShowServerDebugDrawingByDefault property in the ULevelEditorPlaySettings class.

The ShowFlag.ServerDrawDebug interacts with several other variables and systems:

  1. It’s associated with the ServerDrawDebug variable, which shares the same value.
  2. It’s used in conjunction with bShowServerDebugDrawingByDefault in the LevelEditorPlaySettings.
  3. It’s checked in the CanDrawServerDebugInContext function to determine if server debug drawing should be rendered.

Developers should be aware of the following when using this variable:

  1. It’s only effective in non-shipping builds, as indicated by the SHOWFLAG_FIXED_IN_SHIPPING(0, ...) macro.
  2. It’s categorized as a developer-oriented show flag (SFG_Developer).
  3. It’s specifically for visualizing debug information from a dedicated server in a networked Play In Editor session.

Best practices when using this variable include:

  1. Use it judiciously, as rendering debug information can impact performance.
  2. Combine it with other debugging tools and logs for comprehensive multiplayer debugging.
  3. Remember to disable it when not actively debugging to avoid unnecessary rendering overhead.

Regarding the associated variable ServerDrawDebug:

The purpose of ServerDrawDebug is the same as ShowFlag.ServerDrawDebug - to control the visibility of debug rendering from the Dedicated Server.

It’s used in the engine’s core rendering and debugging systems, particularly in multiplayer and networking contexts.

The value is set through the show flags system and can be influenced by editor settings.

It interacts closely with ShowFlag.ServerDrawDebug and is checked in the CanDrawServerDebugInContext function.

Developers should be aware that this variable is part of the EngineShowFlags structure and is used to determine if server debug drawing should be rendered in client viewports.

Best practices include using it in conjunction with other debugging tools, disabling it when not needed, and considering its performance impact in complex multiplayer scenarios.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:381

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(0, Bones, SFG_Developer, NSLOCTEXT("UnrealEd", "BoneSF", "Bones"))
/** Draw debug rendering from the Dedicated Server during Play In Editor (with Use Dedicated Server checked) in this client viewport */
SHOWFLAG_FIXED_IN_SHIPPING(0, ServerDrawDebug, SFG_Developer, NSLOCTEXT("UnrealEd", "ServerDrawDebugSF", "Dedicated Server Debug Drawing"))
/** If media planes should be shown */
SHOWFLAG_ALWAYS_ACCESSIBLE(MediaPlanes, SFG_Normal, NSLOCTEXT("UnrealEd", "MediaPlanesSF", "Media Planes"))
/** if this is a vr editing viewport, needed? */
SHOWFLAG_FIXED_IN_SHIPPING(0, VREditing, SFG_Hidden, NSLOCTEXT("UnrealEd", "VREditSF", "VR Editing"))
/** Visualize Occlusion Query bounding meshes */
SHOWFLAG_FIXED_IN_SHIPPING(0, OcclusionMeshes, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeOcclusionQueries", "Visualize Occlusion Queries"))

#Associated Variable and Callsites

This variable is associated with another variable named ServerDrawDebug. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Settings/LevelEditorPlaySettings.h:408

Scope (from outer to inner):

file
class        class ULevelEditorPlaySettings : public UObject

Source code excerpt:

	FString AdditionalServerGameOptions;

	/** Controls the default value of the show flag ServerDrawDebug */
	UPROPERTY(config, EditAnywhere, Category = "Multiplayer Options")
	bool bShowServerDebugDrawingByDefault;

	/** How strongly debug drawing originating from the server will be biased towards the tint color */
	UPROPERTY(config, EditAnywhere, Category="Multiplayer Options", meta=(ClampMin=0, ClampMax=1, UIMin=0, UIMax=1))
	float ServerDebugDrawingColorTintStrength;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DrawDebugHelpers.cpp:41

Scope (from outer to inner):

file
function     bool CanDrawServerDebugInContext

Source code excerpt:

		(WorldContext.World()->GetNetMode() == NM_Client) &&
		(WorldContext.GameViewport != nullptr) &&
		(WorldContext.GameViewport->EngineShowFlags.ServerDrawDebug);
}

#define UE_DRAW_SERVER_DEBUG_ON_EACH_CLIENT(FunctionName, ...) \
		if (GIsEditor) \
		{ \
			for (const FWorldContext& WorldContext : GEngine->GetWorldContexts()) \

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:381

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(0, Bones, SFG_Developer, NSLOCTEXT("UnrealEd", "BoneSF", "Bones"))
/** Draw debug rendering from the Dedicated Server during Play In Editor (with Use Dedicated Server checked) in this client viewport */
SHOWFLAG_FIXED_IN_SHIPPING(0, ServerDrawDebug, SFG_Developer, NSLOCTEXT("UnrealEd", "ServerDrawDebugSF", "Dedicated Server Debug Drawing"))
/** If media planes should be shown */
SHOWFLAG_ALWAYS_ACCESSIBLE(MediaPlanes, SFG_Normal, NSLOCTEXT("UnrealEd", "MediaPlanesSF", "Media Planes"))
/** if this is a vr editing viewport, needed? */
SHOWFLAG_FIXED_IN_SHIPPING(0, VREditing, SFG_Hidden, NSLOCTEXT("UnrealEd", "VREditSF", "VR Editing"))
/** Visualize Occlusion Query bounding meshes */
SHOWFLAG_FIXED_IN_SHIPPING(0, OcclusionMeshes, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeOcclusionQueries", "Visualize Occlusion Queries"))