Presence
UPulseOnlinePresenceSubsystem (game instance subsystem, module PulseOnlineSocial) pushes the rich presence of all local players: what friends see next to the name.
- Source of the session state:
UPulseOnlineSessionSubsystem. It reportsOutOfGame,MatchmakingandInGame(EPulseOnlineSessionState) with game mode and map.InGameandOutOfGamefollow the game phase of Pulse Foundation:InGamewhile the game is played (also alone, without a session),OutOfGamein Boot, menus and while a level loads.Matchmakingis reported by the matchmaking requests and wins over the phase. A game without a phase source (Game Phase Source set to none) gets the states the session requests report, as before. - Status per game phase: a text for a phase (
Menu.Title,InGame.Cutscene) wins over the text of the session state, so friends see “Title screen” or “Watching a cutscene” without code. - Dynamic at runtime: the status of each session state and of each phase, own custom statuses with priorities, own properties and placeholders.
- Rate limited: changes are collected and pushed at most every
Presence Min Update Intervalseconds, and only when something changed. The presence services (EOS in particular) throttle presence updates. - Not created on dedicated servers.
Settings
Project Settings → Pulse → Online → Social → Presence:
| Setting | Default | Meaning |
|---|---|---|
| Enable Presence | true | Creates the subsystem. |
| Presence Status Out Of Game / Matchmaking / In Game | MainMenu / Matchmaking / InGame | Status text per session state. |
| Presence Status Per Phase | empty | Status text per game phase (Pulse.Phase.*); wins over the session state except while matchmaking. |
| Presence Key Game Mode / Map Name / Phase | GameMode / MapName / empty | Properties that receive game mode, map name and game phase. Empty = not sent. |
| Presence Min Update Interval | 1 | Seconds between two pushes. |
Status texts can contain placeholders: {GameMode}, {MapName}, {State}, {Phase} (the game phase without Pulse.Phase., e.g. Menu.Title) and every presence property, e.g. Frees island {Island}. Unknown placeholders stay in the text.
What is shown
- Custom status with the highest priority (on equal priority the one set last), if any.
- Otherwise the status of the game phase, unless matchmaking runs: the most specific phase with a text wins (
Menu.TitlebeforeMenu), a runtime text (SetStatusForPhase) before the setting of the same phase. - Otherwise the status of the session state: runtime override (
SetStatusForSessionState) or the setting.
Properties: game mode and map name of the session and the game phase (when their keys are set), then your own properties (SetPresenceProperty), then the properties of the shown custom status. Later entries win on equal keys.
Using it
UPulseOnlinePresenceSubsystem* presence = GameInstance->GetSubsystem<UPulseOnlinePresenceSubsystem>();
// Change the in-game text for the rest of the session.
presence->SetStatusForSessionState(EPulseOnlineSessionState::InGame, TEXT("Exploring {MapName}"));
// A text for a phase of the game; its sub-phases show it too.
presence->SetStatusForPhase(Pulse::Foundation::Tags::Phase_Menu_Title, TEXT("On the title screen"));
// Properties, also usable as placeholders.
presence->SetPresenceProperty(TEXT("Island"), TEXT("7"));
// Custom statuses: several systems can set their own, the highest priority is shown.
presence->SetCustomStatus(TEXT("Island"), TEXT("Frees island {Island}"), 10, {});
presence->SetCustomStatus(TEXT("Boss"), TEXT("Fights the boss of island {Island}"), 20, { { TEXT("Boss"), TEXT("1") } });
presence->ClearCustomStatus(TEXT("Boss")); // back to "Frees island 7"
Also: ResetStatusForSessionState, ResetStatusForPhase, GetStatusForPhase, RemovePresenceProperty, ClearPresenceProperties, ClearAllCustomStatuses, HasCustomStatus, GetCurrentPresence (what is pushed), ForcePresenceUpdate and the event OnPresenceUpdated(Presence). Everything is available in Blueprint.
Blueprint: Presence while freeing an island
Get Game Instance Subsystem(Pulse Online Presence Subsystem) →Set Presence Property(KeyIsland, Value = island number as string).- Island entered →
Set Custom Status(IdIsland, StatusFrees island {Island}, Priority 10). - Boss fight starts →
Set Custom Status(IdBoss, StatusFights the boss of island {Island}, Priority 20). Boss defeated →Clear Custom Status(Boss). - Island left →
Clear Custom Status(Island): the status of the session state is shown again.
Notes
- If the project still enables CommonUser, leave its
bEnableSessionsBasedPresence([/Script/CommonUser.CommonUserBasicPresence]) off, otherwise both push. - A property removed with
RemovePresencePropertyis deleted by the OSSv2 (add-on PulseOnlineOSSv2) and Mock backends; OSSv1 has no delete, so it is sent once with an empty value. - Presence is pushed for every local player that is logged in online. A player that logs in later gets it right after the login (
OnLoginStateChangedofUPulseOnlineUserSubsystem). - EOS limits the status text to 255 characters and the number of properties per user; keep both short.