bUseLobbiesDefault
bUseLobbiesDefault
#Overview
name: bUseLobbiesDefault
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of bUseLobbiesDefault is to set the default behavior for using lobbies in online session management within the Unreal Engine’s CommonUser plugin. This variable is primarily used in the context of session hosting and searching.
The CommonUser plugin, specifically the CommonSessionSubsystem, relies on this setting variable. It’s part of the online multiplayer infrastructure, used to determine whether lobbies should be utilized by default when creating or searching for online sessions.
The value of this variable is set in the configuration files, as indicated by the UPROPERTY(Config) decorator in the CommonSessionSubsystem class declaration.
This variable interacts with the bUseLobbies property of both UCommonSession_HostSessionRequest and UCommonSession_SearchSessionRequest objects. It’s used to initialize these objects’ bUseLobbies property when creating new host or search session requests.
Developers must be aware that this variable affects the default behavior of session creation and searching. If set to true, it will cause the system to use lobbies by default, which may have implications for how players join and interact in multiplayer sessions.
Best practices when using this variable include:
- Ensure it’s set appropriately in the configuration files based on the game’s multiplayer architecture.
- Be consistent in its usage across the project to avoid confusion.
- Consider allowing it to be overridden at runtime if needed for different game modes or scenarios.
- Document any changes to this default value, as it can significantly affect the multiplayer experience.
- Test thoroughly with both true and false values to ensure the game’s online functionality works correctly in both scenarios.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:391, section: [/Script/CommonUser.CommonSessionSubsystem]
- INI Section:
/Script/CommonUser.CommonSessionSubsystem
- Raw value:
true
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Projects/Lyra/Plugins/CommonUser/Source/CommonUser/Private/CommonSessionSubsystem.cpp:429
Scope (from outer to inner):
file
function UCommonSession_HostSessionRequest* UCommonSessionSubsystem::CreateOnlineHostSessionRequest
Source code excerpt:
UCommonSession_HostSessionRequest* NewRequest = NewObject<UCommonSession_HostSessionRequest>(this);
NewRequest->OnlineMode = ECommonSessionOnlineMode::Online;
NewRequest->bUseLobbies = bUseLobbiesDefault;
return NewRequest;
}
UCommonSession_SearchSessionRequest* UCommonSessionSubsystem::CreateOnlineSearchSessionRequest()
{
#Loc: <Workspace>/Projects/Lyra/Plugins/CommonUser/Source/CommonUser/Private/CommonSessionSubsystem.cpp:441
Scope (from outer to inner):
file
function UCommonSession_SearchSessionRequest* UCommonSessionSubsystem::CreateOnlineSearchSessionRequest
Source code excerpt:
NewRequest->OnlineMode = ECommonSessionOnlineMode::Online;
NewRequest->bUseLobbies = bUseLobbiesDefault;
return NewRequest;
}
void UCommonSessionSubsystem::HostSession(APlayerController* HostingPlayer, UCommonSession_HostSessionRequest* Request)
{
#Loc: <Workspace>/Projects/Lyra/Plugins/CommonUser/Source/CommonUser/Private/CommonSessionSubsystem.cpp:841
Scope (from outer to inner):
file
function void UCommonSessionSubsystem::QuickPlaySession
Source code excerpt:
QuickPlayRequest->OnSearchFinished.AddUObject(this, &UCommonSessionSubsystem::HandleQuickPlaySearchFinished, JoiningOrHostingPlayerPtr, HostRequestPtr);
HostRequestPtr->bUseLobbies = bUseLobbiesDefault;
QuickPlayRequest->bUseLobbies = bUseLobbiesDefault;
NotifySessionInformationUpdated(ECommonSessionInformationState::Matchmaking);
FindSessionsInternal(JoiningOrHostingPlayer, CreateQuickPlaySearchSettings(HostRequest, QuickPlayRequest));
}
TSharedRef<FCommonOnlineSearchSettings> UCommonSessionSubsystem::CreateQuickPlaySearchSettings(UCommonSession_HostSessionRequest* HostRequest, UCommonSession_SearchSessionRequest* SearchRequest)
#Loc: <Workspace>/Projects/Lyra/Plugins/CommonUser/Source/CommonUser/Public/CommonSessionSubsystem.h:313
Scope (from outer to inner):
file
class class UCommonSessionSubsystem : public UGameInstanceSubsystem
Source code excerpt:
/** Sets the default value of bUseLobbies for session search and host requests */
UPROPERTY(Config)
bool bUseLobbiesDefault = true;
protected:
// Functions called during the process of creating or joining a session, these can be overidden for game-specific behavior
/** Called to fill in a session request from quick play host settings, can be overridden for game-specific behavior */
virtual TSharedRef<FCommonOnlineSearchSettings> CreateQuickPlaySearchSettings(UCommonSession_HostSessionRequest* Request, UCommonSession_SearchSessionRequest* QuickPlayRequest);