PresenceKeyMapName

PresenceKeyMapName

#Overview

name: PresenceKeyMapName

The value of this variable can be defined or overridden in .ini config files. 3 .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 PresenceKeyMapName is to provide a configurable key for mapping the current map name in the game’s rich presence system. This variable is used to update the player’s online presence information with the name of the map they are currently playing.

PresenceKeyMapName is primarily used in the CommonUser plugin, specifically within the UCommonUserBasicPresence class, which is a GameInstanceSubsystem. This subsystem is responsible for managing and updating the basic presence information for players in the game.

The value of this variable is set in the configuration files for the CommonUser plugin. It is defined as a UPROPERTY with the Config specifier, which means it can be modified in the project’s configuration files without changing the source code.

PresenceKeyMapName interacts with other presence-related variables, such as PresenceKeyGameMode. These variables are used together to construct a comprehensive presence update for the player, including information about the game mode and map they are currently playing.

Developers must be aware that this variable is used in conjunction with the OnNotifySessionInformationChanged function, which is called when session information changes. The map name is truncated before being added to the presence update, so developers should ensure that important information is contained within the truncation limit.

Best practices when using this variable include:

  1. Ensuring that the configuration value for PresenceKeyMapName matches the expected key on the backend services that process presence information.
  2. Keeping map names concise and meaningful, as they may be truncated when used in presence updates.
  3. Coordinating with backend services to ensure that the presence information is being correctly interpreted and displayed.
  4. Considering localization requirements for map names in presence information.
  5. Regularly testing the presence system to ensure that map name updates are being correctly propagated to all relevant platforms and services.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/Custom/Steam/DefaultEngine.ini:46, section: [/Script/CommonUser.CommonUserBasicPresence]

Location: <Workspace>/Projects/Lyra/Config/Custom/SteamEOS/DefaultEngine.ini:102, section: [/Script/CommonUser.CommonUserBasicPresence]

Location: <Workspace>/Projects/Lyra/Config/Custom/SteamEOS/DefaultGame.ini:11, section: [CommonSessionSubsystem]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Projects/Lyra/Plugins/CommonUser/Source/CommonUser/Private/CommonUserBasicPresence.cpp:80

Scope (from outer to inner):

file
function     void UCommonUserBasicPresence::OnNotifySessionInformationChanged

Source code excerpt:

				UpdatedPresence.StatusStr = *SessionStateToBackendKey(SessionStatus);
				UpdatedPresence.Properties.Emplace(PresenceKeyGameMode, GameMode);
				UpdatedPresence.Properties.Emplace(PresenceKeyMapName, MapNameTruncated);

				for (const ULocalPlayer* LocalPlayer : GetGameInstance()->GetLocalPlayers())
				{
					if (LocalPlayer && LocalPlayer->GetPreferredUniqueNetId().GetUniqueNetId() != nullptr)
					{
						Presence->SetPresence(*LocalPlayer->GetPreferredUniqueNetId().GetUniqueNetId(), UpdatedPresence);

#Loc: <Workspace>/Projects/Lyra/Plugins/CommonUser/Source/CommonUser/Private/CommonUserBasicPresence.cpp:107

Scope (from outer to inner):

file
function     void UCommonUserBasicPresence::OnNotifySessionInformationChanged

Source code excerpt:

					UpdateParams.Mutations.StatusString.Emplace(*SessionStateToBackendKey(SessionStatus));
					UpdateParams.Mutations.UpdatedProperties.Emplace(PresenceKeyGameMode, GameMode);
					UpdateParams.Mutations.UpdatedProperties.Emplace(PresenceKeyMapName, MapNameTruncated);

					Presence->PartialUpdatePresence(MoveTemp(UpdateParams));
				}
			}

		}

#Loc: <Workspace>/Projects/Lyra/Plugins/CommonUser/Source/CommonUser/Public/CommonUserBasicPresence.h:52

Scope (from outer to inner):

file
class        class UCommonUserBasicPresence : public UGameInstanceSubsystem

Source code excerpt:

	/** Maps the "Map Name" rich presence entry to a backend key*/
	UPROPERTY(Config)
	FString PresenceKeyMapName;

	void OnNotifySessionInformationChanged(ECommonSessionInformationState SessionStatus, const FString& GameMode, const FString& MapName);
	FString SessionStateToBackendKey(ECommonSessionInformationState SessionStatus);
};