Platform service

Some games run on two online services at once: EOS as the main backend for sessions, parties, the login and crossplay, and Steam as the platform the player started the game from. The player’s Steam account, Steam friends, the Steam overlay with its invites and the Steam avatars belong to the platform, not to the main backend.

IPulseOnlinePlatformService is that second platform, next to the main backend. A backend extension registers it (for Steam: the plugin PulseOnlineSteam), other code uses it without knowing which platform it is (PulseOnlineEOS logs in with the platform ticket and finds avatars by the platform id of a player). A project with only one online service does not need it.

What the platform offers

Function What it does
GetPlatformName() Name of the platform (“Steam”, “MockPlatform”)
IsPlatformAvailable(LocalUserNum) True while the platform can be used (its client runs, the user is logged in there)
GetLocalPlatformUserId(LocalUserNum), GetLocalDisplayName(LocalUserNum) The account of the local user at the platform (a Steam ID as text)
RequestLoginTicket(LocalUserNum, Identity, OnComplete) A login ticket for a service that accepts the platform as identity provider (EOS Connect, an own backend)
QueryFriends(LocalUserNum, OnComplete) Friends at the platform with online state, “plays this game” and rich presence
SetPresence(LocalUserNum, Presence, OnComplete) Rich presence at the platform
QueryAvatar(LocalUserNum, PlatformUserId, Size, OnComplete) Avatar of a platform user, as pixels, encoded image or URL (see Avatars)
SetJoinInfo(LocalUserNum, JoinInfo) What friends join through the overlay (“join game”, accepted invites), usually the lobby id of the party or match at the main backend
ShowInviteOverlay(LocalUserNum) Opens the invite dialog of the overlay for that join info
OnJoinRequested() The user accepted an invite or “join game” in the overlay: local user and join info
ConsumeLaunchJoinInfo() The join the game was started with (Steam: +connect_lobby), returned once

Every asynchronous call completes exactly once, like all services (Backends). Get the service with Pulse::Online::GetService<IPulseOnlinePlatformService>(WorldContext); it is null while no platform is registered.

Several platforms

A backend keeps a list of platforms (e.g. Steam and Discord under EOS). RegisterService with a platform adds it to the list; a platform with the same GetPlatformName replaces the earlier one. GetService<IPulseOnlinePlatformService>() returns the first platform of the list (the order of the registration: the extension with the lower priority comes first), so code that knows only one platform keeps working.

Function of UPulseOnlineBackend What it does
GetPlatformService(Name) The platform with that name, or null.
GetPlatformServiceNames() The names of all platforms, in the order of the list (Blueprint too).
UnregisterPlatformService(Name) Removes one platform; the next one becomes the first.

UnregisterService of the platform service name removes all of them. The cheat PulseOnlineStatus lists the platforms.

Registering a platform

A platform comes with a backend extension (UPulseOnlineBackendExtension, see Backends): derive a class from IPulseOnlinePlatformService (the interface already declares the service name) and register it in the extension. Keep the platform ids stable (a Steam ID, not a name), because other code maps them to accounts of the main backend.

Steam

The plugin PulseOnlineSteam registers Steam as the platform whenever the online subsystem Steam runs, alone or as native platform service under EOS:

  • Login tickets come from the online subsystem Steam: a Web API ticket for an identity (EOS: epiconlineservices), an auth session ticket without one.
  • The join info is the rich presence key connect (+pulse_join <info>). “Join game” and accepted invites of the overlay fire OnJoinRequested; a game started that way finds the join info on its command line (ConsumeLaunchJoinInfo). ShowInviteOverlay opens the invite dialog of the Steam overlay with that connect string.
  • +connect_lobby (an invite into a Steam lobby while Steam is the main service) belongs to the online subsystem Steam: it reports the join to the lobby or game session service (by the type of the session), and Pulse Online joins once the player is logged in.
  • Avatars are the small (32), medium (64) and large (184) Steam avatars; players who are no friends are asked for first.

PulseOnlineEOS uses the platform under EOS: the login method EOS Platform Ticket, the party lobby (else a game lobby) as join info (pulse:party:<id>), joins of the overlay into that EOS lobby, and avatars of EOS players through their Steam account (EOS Connect mapping).

Mock platform

The Mock backend has a simulated platform, MockPlatform, so code that uses the platform can be built and tested without Steam:

  • Every local user of every game instance has a platform user (MockPlatform_<instance>_<local user>), also before the login.
  • The other platform users are its friends (with bEverybodyIsFriend), with the rich presence they set.
  • Avatars are test pictures, like the Mock avatars of the main backend; bMockAvatars turns both off.
  • Login tickets are readable: MockPlatformTicket:<platform id>:<identity>.
  • AcceptMockPlatformInvite(FromPlatformUserId, LocalUserNum) on the Mock backend accepts the overlay invite of another platform user: OnJoinRequested fires with its join info. SetMockLaunchJoinInfo(JoinInfo) or the start parameter -PulseMockPlatformJoin=<info> set what ConsumeLaunchJoinInfo returns.
  • bMockPlatform = false makes the platform unavailable; FailNextOperation fails PlatformTicket, PlatformFriends, PlatformPresence or PlatformAvatar.

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