BeaconConnectionInitialTimeout

BeaconConnectionInitialTimeout

#Overview

name: BeaconConnectionInitialTimeout

The value of this variable can be defined or overridden in .ini config files. 2 .ini config files referencing this setting variable.

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of BeaconConnectionInitialTimeout is to set the initial connection timeout for online beacons in Unreal Engine’s networking system. This variable determines the maximum time allowed for establishing a connection between a beacon client and a beacon host before the connection attempt is considered failed.

This setting variable is primarily used by the Online Subsystem Utils plugin, specifically within the beacon networking components. The main subsystems that rely on this variable are the OnlineBeaconClient and OnlineBeaconHost classes, which are part of Unreal Engine’s networking infrastructure for online multiplayer functionality.

The value of this variable is set in the configuration files (indicated by the UPROPERTY(Config) attribute in the AOnlineBeacon class declaration). It can be modified through project settings or configuration files.

BeaconConnectionInitialTimeout interacts closely with another variable called BeaconConnectionTimeout. While BeaconConnectionInitialTimeout is used for the initial connection establishment, BeaconConnectionTimeout is used for maintaining the connection after it has been established.

Developers must be aware that this variable directly affects the responsiveness and reliability of online connections in their game. Setting it too low might result in premature connection failures, especially on slower networks, while setting it too high could lead to longer waiting times for players when connections cannot be established.

Best practices when using this variable include:

  1. Carefully tuning the value based on your game’s network requirements and target audience’s typical network conditions.
  2. Consider providing a way for players to adjust this setting if your game is expected to be played across a wide range of network qualities.
  3. Implement proper error handling and user feedback for cases where connections fail due to this timeout.
  4. Regularly test your game’s networking behavior with various timeout values to ensure optimal performance across different network conditions.
  5. Keep this value in sync with any server-side configurations to ensure consistent behavior between clients and servers.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:2382, section: [/Script/OnlineSubsystemUtils.OnlineBeacon]

Location: <Workspace>/Engine/Config/BaseEngine.ini:2399, section: [/Script/Lobby.LobbyBeaconClient]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/OnlineBeaconClient.cpp:194

Scope (from outer to inner):

file
function     bool AOnlineBeaconClient::InitClient

Source code excerpt:

						NetDriver->SetWorld(World);
						NetDriver->Notify = this;
						NetDriver->InitialConnectTimeout = BeaconConnectionInitialTimeout;
						NetDriver->ConnectionTimeout = BeaconConnectionTimeout;

						if (!bSentHandshake)
						{
							SendInitialJoin();
						}

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/OnlineBeaconHost.cpp:108

Scope (from outer to inner):

file
function     bool AOnlineBeaconHost::InitHost

Source code excerpt:

				NetDriver->SetWorld(GetWorld());
				NetDriver->Notify = this;
				NetDriver->InitialConnectTimeout = BeaconConnectionInitialTimeout;
				NetDriver->ConnectionTimeout = BeaconConnectionTimeout;
				return true;
			}
			else
			{
				// error initializing the network stack...

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Public/OnlineBeacon.h:100

Scope (from outer to inner):

file
class        class AOnlineBeacon : public AActor, public FNetworkNotify

Source code excerpt:

	/** Time beacon will wait to establish a connection with the beacon host */
	UPROPERTY(Config)
	float BeaconConnectionInitialTimeout;
	/** Time beacon will wait for packets after establishing a connection before giving up */
	UPROPERTY(Config)
	float BeaconConnectionTimeout;

	/** Net driver routing network traffic */
	UPROPERTY()