TravelSessionTimeoutSecs

TravelSessionTimeoutSecs

#Overview

name: TravelSessionTimeoutSecs

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 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of TravelSessionTimeoutSecs is to manage the timeout duration for players who are in the process of joining a game session but have not yet been fully registered. This setting is primarily used in the context of online multiplayer gameplay, specifically within the party and spectator beacon systems of Unreal Engine.

TravelSessionTimeoutSecs is utilized by the Online Subsystem Utils plugin, which is part of Unreal Engine’s networking and online services infrastructure. Specifically, it is used in the PartyBeaconHost and SpectatorBeaconHost classes, which are responsible for managing player connections and states during multiplayer sessions.

The value of this variable is set through Unreal Engine’s configuration system, as indicated by the UPROPERTY(Transient, Config) attribute in both PartyBeaconHost.h and SpectatorBeaconHost.h files.

This variable interacts with other timing-related variables and player state tracking mechanisms within the beacon systems. It is compared against the ElapsedTime of player entries to determine if a timeout has occurred for players who are pending initial join.

Developers must be aware that this variable specifically applies to players who are in the process of joining a session but have not yet been fully registered. It’s separate from the regular session timeout mechanism for already connected players.

Best practices when using this variable include:

  1. Carefully considering the appropriate timeout duration based on expected network conditions and game requirements.
  2. Ensuring that the value is set appropriately in the relevant configuration files.
  3. Implementing proper error handling and user feedback for cases where players are timed out due to this setting.
  4. Regularly reviewing and adjusting this value based on real-world performance data and player feedback.
  5. Coordinating this timeout with other network-related timeouts to ensure a consistent and fair player experience.

#Setting Variables

#References In INI files

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

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

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/PartyBeaconHost.cpp:186

Scope (from outer to inner):

file
function     void APartyBeaconHost::Tick

Source code excerpt:

								if (bLogoutOnSessionTimeout)
								{
									// if the player is pending it's initial join then check against TravelSessionTimeoutSecs instead
									FUniqueNetIdMatcher PlayerMatch(*PlayerEntry.UniqueId);
									const int32 FoundIdx = State->PlayersPendingJoin.IndexOfByPredicate(PlayerMatch);
									const bool bIsPlayerPendingJoin = FoundIdx != INDEX_NONE;
									// if the timeout has been exceeded then add to list of players 
									// that need to be logged out from the beacon
									if ((bIsPlayerPendingJoin && PlayerEntry.ElapsedTime > TravelSessionTimeoutSecs) ||
										(!bIsPlayerPendingJoin && PlayerEntry.ElapsedTime > GetSessionTimeoutSecs(PlayerEntry.UniqueId)))
									{
										PlayersToLogout.AddUnique(PlayerEntry.UniqueId.GetUniqueNetId());
									}
								}
							}

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/SpectatorBeaconHost.cpp:143

Scope (from outer to inner):

file
function     void ASpectatorBeaconHost::Tick

Source code excerpt:

							if (bLogoutOnSessionTimeout)
							{
								// if the player is pending it's initial join then check against TravelSessionTimeoutSecs instead
								FUniqueNetIdMatcher PlayerMatch(*PlayerEntry.UniqueId);
								const int32 FoundIdx = State->PlayersPendingJoin.IndexOfByPredicate(PlayerMatch);
								const bool bIsPlayerPendingJoin = FoundIdx != INDEX_NONE;
								// if the timeout has been exceeded then add to list of players 
								// that need to be logged out from the beacon
								if ((bIsPlayerPendingJoin && PlayerEntry.ElapsedTime > TravelSessionTimeoutSecs) ||
									(!bIsPlayerPendingJoin && PlayerEntry.ElapsedTime > SessionTimeoutSecs))
								{
									PlayersToLogout.AddUnique(PlayerEntry.UniqueId.GetUniqueNetId());
								}
							}
						}

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Public/PartyBeaconHost.h:431

Scope (from outer to inner):

file
class        class APartyBeaconHost : public AOnlineBeaconHostObject

Source code excerpt:

	/** Seconds that can elapse before a reservation is removed due to player not being registered with the session during a travel */
	UPROPERTY(Transient, Config)
	float TravelSessionTimeoutSecs;

	/**
	 * @return the class of the state object inside this beacon
	 */
	virtual TSubclassOf<UPartyBeaconState> GetPartyBeaconHostClass() const { return UPartyBeaconState::StaticClass(); }

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Public/SpectatorBeaconHost.h:248

Scope (from outer to inner):

file
class        class ASpectatorBeaconHost : public AOnlineBeaconHostObject

Source code excerpt:

	/** Seconds that can elapse before a reservation is removed due to player not being registered with the session during a travel */
	UPROPERTY(Transient, Config)
		float TravelSessionTimeoutSecs;

	/**
	* @return the class of the state object inside this beacon
	*/
	virtual TSubclassOf<USpectatorBeaconState> GetSpectatorBeaconHostClass() const { return USpectatorBeaconState::StaticClass(); }