bRequiresPushToTalk
bRequiresPushToTalk
#Overview
name: bRequiresPushToTalk
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 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of bRequiresPushToTalk is to control the voice chat behavior in Unreal Engine games, specifically whether voice communication requires a push-to-talk key binding or is always enabled.
This setting variable is primarily used by the Online Subsystem and the Game Session module within Unreal Engine. It is referenced in the OnlineSubsystemUtils plugin and the core Engine module.
The value of this variable is set in the DefaultGame.ini configuration file, under the [/Script/Engine.GameSession] section. It can also be modified through the UGameSessionSettings class, which suggests it can be changed programmatically or through engine settings.
The bRequiresPushToTalk variable interacts with other voice-related settings such as MaxLocalTalkers and MaxRemoteTalkers, which are part of the overall voice chat system configuration.
Developers must be aware that this setting affects the user experience for voice communication in multiplayer games. When set to true, players will need to use a specific key or button to activate their microphone, while setting it to false allows for open microphone communication.
Best practices when using this variable include:
- Clearly documenting the chosen setting in the game’s user interface or manual, so players understand how voice chat works.
- Considering the game’s genre and target audience when deciding on the default value.
- Potentially allowing players to toggle this setting in-game for personal preference.
- Ensuring that the push-to-talk key binding is properly set up and configurable if bRequiresPushToTalk is true.
- Testing voice communication thoroughly with both settings to ensure a smooth experience for players.
- Being mindful of performance and bandwidth implications, especially when set to false (always-on voice).
When implementing voice chat features, developers should also consider privacy concerns and provide options for players to mute or disable voice chat if desired.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseGame.ini:70, section: [/Script/Engine.GameSession]
- INI Section:
/Script/Engine.GameSession
- 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/OnlineSubsystemUtils.cpp:351
Scope (from outer to inner):
file
function bool HandleVoiceCommands
Source code excerpt:
}
bool bRequiresPushToTalk = false;
if (!GConfig->GetBool(TEXT("/Script/Engine.GameSession"), TEXT("bRequiresPushToTalk"), bRequiresPushToTalk, GGameIni))
{
UE_LOG_ONLINE_VOICE(Warning, TEXT("Missing bRequiresPushToTalk key in [/Script/Engine.GameSession] of DefaultGame.ini"));
}
int32 MaxLocalTalkers = 0;
if (!GConfig->GetInt(TEXT("OnlineSubsystem"), TEXT("MaxLocalTalkers"), MaxLocalTalkers, GEngineIni))
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/OnlineSubsystemUtils.cpp:405
Scope (from outer to inner):
file
function bool HandleVoiceCommands
Source code excerpt:
UE_LOG_ONLINE_VOICE(Display, TEXT("Max Remote Talkers: %d"), MaxRemoteTalkers);
UE_LOG_ONLINE_VOICE(Display, TEXT("Notification Delta: %0.2f"), VoiceNotificationDelta);
UE_LOG_ONLINE_VOICE(Display, TEXT("Voice Requires Push To Talk: %s"), bRequiresPushToTalk ? TEXT("true") : TEXT("false"));
TArray<FString> OutArray;
VoiceDump.ParseIntoArray(OutArray, TEXT("\n"), false);
for (const FString& Str : OutArray)
{
UE_LOG_ONLINE_VOICE(Display, TEXT("%s"), *Str);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/GameFramework/GameSession.h:46
Scope (from outer to inner):
file
class class AGameSession : public AInfo
Source code excerpt:
/** Is voice enabled always or via a push to talk keybinding */
UPROPERTY(globalconfig)
bool bRequiresPushToTalk;
/** SessionName local copy from PlayerState class. should really be define in this class, but need to address replication issues */
UPROPERTY()
FName SessionName;
/** Initialize options based on passed in options string */
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/GameFramework/GameSession.h:227
Scope (from outer to inner):
file
class class AGameSession : public AInfo
function virtual bool RequiresPushToTalk
Source code excerpt:
* @return true if a push to talk keybinding is required or if voice is always enabled
*/
virtual bool RequiresPushToTalk() const { return bRequiresPushToTalk; }
/** Dump session info to log for debugging. */
ENGINE_API virtual void DumpSessionState();
//=================================================================================
// MATCH INTERFACE
#Loc: <Workspace>/Engine/Source/Runtime/EngineSettings/Classes/GameSessionSettings.h:24
Scope (from outer to inner):
file
class class UGameSessionSettings : public UObject
Source code excerpt:
/** Is voice enabled always or via a push to talk key binding. */
UPROPERTY(globalconfig, EditAnywhere, Category=GameSessionSettings)
uint32 bRequiresPushToTalk:1;
};