OPEN

OPEN

#Overview

name: OPEN

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of OPEN is to handle the opening or loading of a new level or map within the Unreal Engine 5 game environment. It is primarily used as a command in the engine’s console system for level management and navigation.

This setting variable is mainly relied upon by the Engine module, specifically within the game instance and world management subsystems. It’s referenced in key engine components such as UGameInstance, UEngine, and UWorld.

The value of this variable is not set directly, but rather used as a command identifier in the engine’s command parsing system. It’s typically invoked through the engine’s console or exec functions.

OPEN interacts with other command-handling functions, particularly HandleOpenCommand, which is called when the OPEN command is detected in the input stream.

Developers must be aware that using the OPEN command can have significant implications on the game state, as it involves loading new levels or maps. It should be used carefully, especially in networked environments, to ensure proper synchronization between server and clients.

Best practices when using this variable include:

  1. Ensure proper error handling and validation when processing the OPEN command.
  2. Consider the impact on performance and memory when opening new levels, especially on lower-end devices.
  3. In multiplayer scenarios, make sure to handle level transitions correctly across all connected clients.
  4. Use it in conjunction with other level management commands and systems for a comprehensive level navigation solution.
  5. Document any custom implementation or extensions to the OPEN command functionality for easier maintenance and collaboration.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GameInstance.cpp:773

Scope (from outer to inner):

file
function     bool UGameInstance::Exec

Source code excerpt:

{
	// @todo a bunch of stuff in UEngine probably belongs here as well
	if (FParse::Command(&Cmd, TEXT("OPEN")))
	{
		return HandleOpenCommand(Cmd, Ar, InWorld);
	}
	else if (FParse::Command(&Cmd, TEXT("DISCONNECT")))
	{
		return HandleDisconnectCommand(Cmd, Ar, InWorld);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:4883

Scope (from outer to inner):

file
function     bool UEngine::Exec

Source code excerpt:

		return HandleDeferCommand( Cmd, Ar );
	}
	else if( FParse::Command( &Cmd, TEXT("OPEN") ) )
	{
		return HandleOpenCommand( Cmd, Ar, InWorld );
	}
	else if( FParse::Command( &Cmd, TEXT("STREAMMAP")) )
	{
		return HandleStreamMapCommand( Cmd, Ar, InWorld );

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/World.cpp:6133

Scope (from outer to inner):

file
function     void UWorld::NotifyAcceptedConnection

Source code excerpt:

	check(NetDriver->ServerConnection==NULL);
	UE_LOG(LogNet, Log, TEXT("NotifyAcceptedConnection: Name: %s, TimeStamp: %s, %s"), *GetName(), FPlatformTime::StrTimestamp(), *Connection->Describe() );
	NETWORK_PROFILER( GNetworkProfiler.TrackEvent( TEXT( "OPEN" ), *( GetName() + TEXT( " " ) + Connection->LowLevelGetRemoteAddress() ), Connection ) );
}

bool UWorld::NotifyAcceptingChannel( UChannel* Channel )
{
	check(Channel);
	check(Channel->Connection);