Sessions

UPulseOnlineSessionSubsystem runs the session requests on the game session service of the backend (IPulseOnlineGameSessionService, Backends) and provides the session events (OnCreateSessionComplete, OnJoinSessionComplete, OnSessionInformationChanged, OnUserRequestedSession, OnDestroySessionRequested, OnPreClientTravel, OnTravelFailure). The results of OnCreateSessionComplete, OnJoinSessionComplete and OnUserRequestedSession are FPulseResults with the reason of the backend (see Results as Pulse results).

Get Session State tells what the game instance does for presence and UI: Matchmaking while a matchmaking request runs, else InGame while the game phase of Pulse Foundation is InGame (also in a game without a session) and OutOfGame in every other phase. OnSessionInformationChanged fires with the state, the game mode and the map whenever a request reports new session information and whenever the state changes with the game phase. Get Session Game Mode and Get Session Map Name return the last reported values.

Game sessions and lobbies

A game session is the game players join and travel to: host, search, connect string, reservation beacons, listen URL options. A lobby is a group of players with attributes and member data but without a game server, such as the party (Party); lobbies are the IPulseOnlineLobbyService. Both use the same structs and the local name of the session (NAME_GameSession, NAME_PartySession). A backend may build its game sessions on lobbies of its online service (EOS, OSSv2 of the add-on PulseOnlineOSSv2): bUseLobbies of a host request is a hint to the game session service.

Each service answers only for its own kind, the same with every backend (OSS, OSSv2, Mock): IsInLobby, GetLobbySnapshot and LeaveLobby of the lobby service see only lobbies, IsInSession, GetSessionSnapshot and LeaveSession of the game session service only game sessions (leaving a session of the other kind does nothing and succeeds), and a lobby search returns only lobbies, a game session search only game sessions. The kind is the one the session was created or joined with, else its PULSE_SESSION_TYPE (Party is a lobby), else the local name.

The subsystem follows both services: OnSessionChanged reports changes of game sessions and lobbies by their local name, and invites and “join game” of the platform overlay (OnUserRequestedSession, the invites of the social subsystem) come from both. Joining by type (JoinSessionByType of the social subsystem) joins a party lobby as party and everything else as game session. GetSessionService() and GetLobbyService() return the services of the active backend.

Requests

Request Purpose
UPulseOnlineHostSessionRequest Create a session and optionally travel to MapID or Level (listen server; Level needs no Asset Manager entry). On a dedicated server without owning player; set bTravelAfterCreate = false when the server is already in its map.
UPulseOnlineFindSessionsRequest Search sessions. Results, GetBestResult() (highest ScoreResult, by default the lowest ping; matchmaking overrides it). Filters: ExtraFilters, MinOpenSlots (client side), bDedicatedOnly, bOnlyPulseGameSessions. Cancellable.
UPulseOnlineFindSessionByKeyRequest Find a session by its PULSE_SESSION_KEY (used by party follow).
UPulseOnlineJoinSessionRequest Join, reserve slots through the reservation beacon (optionally for party members), travel. Leaves an existing session with the same name first; leaves again on failure.
UPulseOnlineQuickPlayRequest Find → join the best result, or host with HostRequest. Cancellable.
UPulseOnlineLeaveSessionRequest End/destroy and wait until done (also waits for a session that is still being created).

Factories with the defaults of the settings: CreateHostSessionRequest, CreateFindSessionsRequest, CreateJoinSessionRequest, CreateQuickPlayRequest, CreateLeaveSessionRequest, plus the generic CreateRequest. Each takes an optional request class, see Own request classes; the classes go through the request class table of the settings, also for the sub-requests of Quick Play. Quick Play keeps a HostRequest its class or the game set and makes one of the table otherwise.

Hooks

The host and find requests have Blueprint native events: override them in a Blueprint child (or in C++ with _Implementation, calling the parent first) and put the class into the request class table, so every feature (Quick Play, matchmaking, party matchmaking) uses it.

Request Hook Purpose
Host GatherSessionSettings Advertised settings (the Pulse ones and ExtraSettings); add computed settings.
Host ConfigureCreateParams Last change of what the game session service creates (slots, join policy).
Host GetMaxPlayers Player count of the session (default MaxPlayerCount).
Host GetMapName Map of the session (default MapID, else Level, else the current map).
Find GatherSearchFilters Search filters (the Pulse ones and ExtraFilters).
Find ConfigureSearchParams Last change of what the game session service searches.
Find ScoreResult Score of a result for GetBestResult (default: lowest ping first).
Find AcceptResult Drops a result on the client.

Every request also has CheckRequest (Requests).

Blueprint: Add a setting and change the slots of every hosted session

  1. Blueprint child of Pulse Online Host Session Request → override Gather Session Settings (Settings, by reference): Parent: Gather Session Settings → Add (Settings, Key MYGAME_DIFFICULTY, Value Make Pulse Online Setting Advertisement).
  2. Override Configure Create Params (Params, by reference): Set Members in Pulse Online Create Session Params (Private Slots 1).
  3. Override Get Max Players: return the player count of the chosen mode.
  4. Project Settings > Pulse > Online > Request Classes: Pulse Online Host Session Request → the Blueprint. Quick Play, matchmaking and party matchmaking host with it.

Every session Pulse Online creates carries PULSE_SESSION_TYPE = Game and a unique PULSE_SESSION_KEY.

Blueprint: All session requests

Blueprint: Host a listen server session

Blueprint: Search sessions and join the best one

Blueprint: Quick play (join or host)

UPulseOnlineJoinSessionRequest::TravelOptions adds URL options to the travel, e.g. ?PulsePassword=... for password servers (Server Browser and Administration). Reconnecting after a crash or a lost connection is described in Connection and Reconnect.

Dedicated server

UPulseOnlineHostSessionRequest* host = SessionSubsystem->CreateHostSessionRequest(nullptr);
host->bUseLobbies = false;
host->bTravelAfterCreate = false; // the server is already in its map
host->MaxPlayerCount = 16;
host->ExtraSettings.Add(TEXT("MYGAME_NAME"), FPulseOnlineSettingAdvertisement::Make(FPulseOnlineSetting::Make(GameName)));
UPulseOnlineSessionSettingsLibrary::SetHostMigration(host, false);
host->TryStart(this);

Clients filter for it:

UPulseOnlineFindSessionsRequest* search = SessionSubsystem->CreateFindSessionsRequest(PlayerController);
search->bUseLobbies = false;
UPulseOnlineSessionSettingsLibrary::FilterDedicatedOnly(search);
search->ExtraFilters.Add(TEXT("MYGAME_NAME"), FPulseOnlineSearchFilter::Make(FPulseOnlineSetting::Make(GameName)));

Private sessions

Set bPrivateSession on the host request to create an invite-only session: it is not advertised in searches, cannot be joined via presence and all slots are private connections (EOS treats any public connection as publicly advertised). Players join through an invite, so bAllowInvites must stay on (the request fails validation otherwise). bShouldAdvertise is ignored for private sessions. With OSSv2 the lobby is created as InvitationOnly and the session as InviteOnly.

UPulseOnlineHostSessionRequest* host = SessionSubsystem->CreateHostSessionRequest(PlayerController);
host->bPrivateSession = true;
host->TryStart(this);

A session with bShouldAdvertise off that is not private is hidden but joinable: not in searches, only private slots, joinable through invites and by its id (EOS: a lobby with the permission JoinViaPresence). FindSessionById of the game session service (Mock, OSS backend; the others answer NotSupported) finds it, and UPulseOnlineFindSessionByKeyRequest tries its SessionId first. A game the leader hosts for the party is such a session (see Party).

Reservation beacons

With bUseReservationBeacons the host runs an APartyBeaconHost (created after the map load, recreated after every travel) and publishes its port as SETTING_BEACONPORT. A join reserves a slot for the joining player and all AdditionalReservationMembers before it travels. Party matchmaking fills them with the party members; following members skip the reservation. Only backends that support it use it (SupportsReservationBeacons: the OSS backend).

The engine’s beacon host requires a validation string from the party leader (APartyBeaconHost::bIsValidationStrRequired). Pulse Online sends the session key (PULSE_SESSION_KEY) of the target session. To send an own value (e.g. an auth ticket that a custom beacon host checks), set UPulseOnlineSessionSubsystem::ReservationValidationProvider.

The reservation beacon and the beacon transport of the party share one beacon listener (AcquireBeaconListener), two listeners would compete for the same port / P2P channel.

Presence

Only one session should carry presence. While the player is in a party, the party has presence and game session joins are made without presence.

The rich presence text (status and properties friends see) comes from UPulseOnlinePresenceSubsystem, see Presence.


This site uses Just the Docs, a documentation theme for Jekyll.