bLogoutOnSessionTimeout
bLogoutOnSessionTimeout
#Overview
name: bLogoutOnSessionTimeout
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 10
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of bLogoutOnSessionTimeout is to control whether players should be automatically logged out when their session times out. This variable is primarily used in the online subsystem for managing player sessions in multiplayer games.
This setting variable is primarily used by the OnlineSubsystemUtils plugin, specifically in the PartyBeaconHost and SpectatorBeaconHost classes. These classes are responsible for managing player connections and sessions in multiplayer game environments.
The value of this variable is typically set in the constructor of both APartyBeaconHost and ASpectatorBeaconHost classes, where it is initialized to true. However, it can be overridden during runtime based on command-line parameters. In non-shipping builds, the value is set to false if the “-NoTimeouts” command-line parameter is present.
bLogoutOnSessionTimeout interacts with other variables such as SessionTimeoutSecs, which determines the duration before a session times out. It also works in conjunction with the State object, which keeps track of player states and pending joins.
Developers must be aware that this variable significantly affects the behavior of multiplayer sessions. When set to true, it will automatically remove players from the game if their session times out, which could impact user experience if not managed properly.
Best practices when using this variable include:
- Carefully considering the implications of enabling or disabling automatic logouts.
- Ensuring that timeout durations (SessionTimeoutSecs) are appropriately set to balance between network issues and security.
- Implementing proper player notification systems to inform users about impending timeouts.
- Testing thoroughly with both enabled and disabled states to ensure the game behaves correctly in all scenarios.
- Considering different timeout behaviors for different types of players (e.g., pending joins vs. active players).
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:2389, section: [/Script/OnlineSubsystemUtils.PartyBeaconHost]
- INI Section:
/Script/OnlineSubsystemUtils.PartyBeaconHost
- Raw value:
true
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseEngine.ini:2394, section: [/Script/OnlineSubsystemUtils.SpectatorBeaconHost]
- INI Section:
/Script/OnlineSubsystemUtils.SpectatorBeaconHost
- Raw value:
true
- Is Array:
False
#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:14
Scope (from outer to inner):
file
function APartyBeaconHost::APartyBeaconHost
Source code excerpt:
Super(ObjectInitializer),
State(NULL),
bLogoutOnSessionTimeout(true),
bIsValidationStrRequired(true)
{
ClientBeaconActorClass = APartyBeaconClient::StaticClass();
BeaconTypeName = ClientBeaconActorClass->GetName();
PrimaryActorTick.bCanEverTick = true;
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/PartyBeaconHost.cpp:30
Scope (from outer to inner):
file
function void APartyBeaconHost::PostInitProperties
Source code excerpt:
#if !UE_BUILD_SHIPPING
// This value is set on the CDO as well on purpose
bLogoutOnSessionTimeout = FParse::Param(FCommandLine::Get(), TEXT("NoTimeouts")) ? false : true;
#endif
}
bool APartyBeaconHost::InitHostBeacon(int32 InTeamCount, int32 InTeamSize, int32 InMaxReservations, FName InSessionName, int32 InForceTeamNum, bool bInEnableRemovalRequests)
{
UE_LOG(LogPartyBeacon, Verbose, TEXT("InitHostBeacon TeamCount:%d TeamSize:%d MaxSize:%d"), InTeamCount, InTeamSize, InMaxReservations);
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/PartyBeaconHost.cpp:184
Scope (from outer to inner):
file
function void APartyBeaconHost::Tick
Source code excerpt:
PlayerEntry.ElapsedTime += DeltaTime;
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
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/PartyBeaconHost.cpp:203
Scope (from outer to inner):
file
function void APartyBeaconHost::Tick
Source code excerpt:
}
if (bLogoutOnSessionTimeout)
{
// Logout any players that timed out
for (int32 LogoutIdx = 0; LogoutIdx < PlayersToLogout.Num(); LogoutIdx++)
{
bool bFound = false;
const FUniqueNetIdPtr& UniqueId = PlayersToLogout[LogoutIdx];
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/SpectatorBeaconHost.cpp:14
Scope (from outer to inner):
file
function ASpectatorBeaconHost::ASpectatorBeaconHost
Source code excerpt:
Super(ObjectInitializer),
State(NULL),
bLogoutOnSessionTimeout(true),
bIsValidationStrRequired(true)
{
ClientBeaconActorClass = ASpectatorBeaconClient::StaticClass();
BeaconTypeName = ClientBeaconActorClass->GetName();
PrimaryActorTick.bCanEverTick = true;
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/SpectatorBeaconHost.cpp:30
Scope (from outer to inner):
file
function void ASpectatorBeaconHost::PostInitProperties
Source code excerpt:
#if !UE_BUILD_SHIPPING
// This value is set on the CDO as well on purpose
bLogoutOnSessionTimeout = FParse::Param(FCommandLine::Get(), TEXT("NoTimeouts")) ? false : true;
#endif
}
bool ASpectatorBeaconHost::InitHostBeacon(int32 InMaxReservations, FName InSessionName)
{
UE_LOG(LogSpectatorBeacon, Verbose, TEXT("InitHostBeacon MaxSize:%d"), InMaxReservations);
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/SpectatorBeaconHost.cpp:141
Scope (from outer to inner):
file
function void ASpectatorBeaconHost::Tick
Source code excerpt:
PlayerEntry.ElapsedTime += DeltaTime;
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
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/SpectatorBeaconHost.cpp:159
Scope (from outer to inner):
file
function void ASpectatorBeaconHost::Tick
Source code excerpt:
}
if (bLogoutOnSessionTimeout)
{
// Logout any players that timed out
for (int32 LogoutIdx = 0; LogoutIdx < PlayersToLogout.Num(); LogoutIdx++)
{
bool bFound = false;
const FUniqueNetIdPtr& UniqueId = PlayersToLogout[LogoutIdx];
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Public/PartyBeaconHost.h:422
Scope (from outer to inner):
file
class class APartyBeaconHost : public AOnlineBeaconHostObject
Source code excerpt:
/** Do the timeouts below cause a player to be removed from the reservation list */
UPROPERTY(Config)
bool bLogoutOnSessionTimeout;
/** Do party members require validation strings. */
UPROPERTY(Config)
bool bIsValidationStrRequired;
/** Seconds that can elapse before a reservation is removed due to player not being registered with the session */
UPROPERTY(Transient, Config)
float SessionTimeoutSecs;
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Public/SpectatorBeaconHost.h:239
Scope (from outer to inner):
file
class class ASpectatorBeaconHost : public AOnlineBeaconHostObject
Source code excerpt:
/** Do the timeouts below cause a player to be removed from the reservation list */
UPROPERTY(Config)
bool bLogoutOnSessionTimeout;
/** Do spectators require validation strings. */
UPROPERTY(Config)
bool bIsValidationStrRequired;
/** Seconds that can elapse before a reservation is removed due to player not being registered with the session */
UPROPERTY(Transient, Config)
float SessionTimeoutSecs;