Skip to main content
Multiplayer

Online Services (OSSv2)

warning

Requires EOSCore 2.3.0 and later, and Unreal Engine 5.7 and later.

EOSCore 2.3.0 adds the module OnlineServicesEOSCore, an implementation of the engine's Online Services (OSSv2) interfaces on top of EOS. Use it when your game calls UE::Online::GetServices() instead of the Online Subsystem (OSSv1).

It supports Auth, Presence, Lobbies and Sessions. The other OSSv2 interfaces (friends, user info, stats, achievements, leaderboards, title file, user file, commerce and external UI) are not implemented yet. Keep using the Online Subsystem or the Blueprint nodes for those.

Auth is available in Blueprints too, see Blueprint nodes. Presence, Lobbies and Sessions are C++ only for now.

Requirements​

  • Unreal Engine 5.7 or later. On older engines, including UE 4.27, only the Blueprint node classes are compiled, and they fail with not_implemented.
  • The EOSCore Online Subsystem must be enabled and configured as before, see Configuring Online Subsystem. OSSv2 uses the EOS platform of the Online Subsystem, and the Online Subsystem keeps ticking it.
  • The engine plugin Online Services is enabled. EOSCore references it as an optional plugin. If your own module uses the Online Services headers, also list the plugin in your .uproject and add OnlineServicesInterface to the dependencies of your module:
{ "Name": "OnlineServices", "Enabled": true }
PrivateDependencyModuleNames.Add("OnlineServicesInterface");

Getting the services​

EOSCore registers itself as EOnlineServices::Epic with priority 10, so it is used instead of the engine's own EOS services when both are enabled.

#include "Online/OnlineServices.h"
#include "Online/Auth.h"

UE::Online::IOnlineServicesPtr Services = UE::Online::GetServices(UE::Online::EOnlineServices::Epic);
UE::Online::IAuthPtr Auth = Services->GetAuthInterface();

Use RegistryPriority or ServicesEnumEntry below to change how it is registered. When both EOSCore and the engine's OnlineServicesEOS module are loaded, the one with the higher priority wins.

Configuration​

Add the keys you need to DefaultEngine.ini. All of them are optional.

[OnlineServices.EOSCore]
bEnabled=true
ServicesEnumEntry=Epic
RegistryPriority=10

[OnlineServices.EOSCore.Auth]
bExternalAuthUsesEpicAccount=false
bAutoCreateConnectUser=true

[OnlineServices.EOSCore.Lobbies]
BucketId=EOSCore

[OnlineServices.EOSCore.Sessions]
BucketId=EOSCore
bUseP2PHostAddress=true
SectionKeyDefaultDescription
[OnlineServices.EOSCore]bEnabledtrueRegisters the EOSCore online services
ServicesEnumEntryEpicThe EOnlineServices value to register as, for example GameDefined_0 to use it next to the engine's EOS services
RegistryPriority10Priority in the online services registry. The highest priority wins
[OnlineServices.EOSCore.Auth]bExternalAuthUsesEpicAccountfalseLogs in to Epic Account Services too when you log in with ExternalAuth
bAutoCreateConnectUsertrueCreates a new Connect user when the external account has none
[OnlineServices.EOSCore.Lobbies]BucketIdEOSCoreBucket of the lobbies. Lobbies from another bucket are not found
[OnlineServices.EOSCore.Sessions]BucketIdEOSCoreBucket of the sessions
bUseP2PHostAddressbIsUsingP2PSockets of the EOSCore net driverUses the EOS P2P address of the host as the session address

Auth​

IAuth::Login logs in with these credential types:

Credentials typeBehaviour
AutoReads -AUTH_TYPE, -AUTH_LOGIN and -AUTH_PASSWORD from the command line (exchangecode and developer). Without them it uses Persistent Auth and falls back to the Account Portal
AccountPortal, PersistentAuth, ExchangeCode, RefreshToken, PasswordLogs in to Epic Account Services, then to Game Services with the Epic id token
DeveloperThe Developer Authentication Tool. CredentialsId is the host (for example localhost:6300) and CredentialsToken is the credential name
ExternalAuthLogs in to Game Services with an external credential, for example a Steam session ticket. DeviceIdAccessToken creates the device id when it does not exist, and CredentialsId is used as the display name
UE::Online::FAuthLogin::Params Params;
Params.PlatformUserId = FPlatformMisc::GetPlatformUserForUserIndex(0);
Params.CredentialsType = UE::Online::LoginCredentialsType::Developer;
Params.CredentialsId = TEXT("localhost:6300");
Params.CredentialsToken.Emplace<FString>(TEXT("Player1"));

Auth->Login(MoveTemp(Params)).OnComplete([](const UE::Online::TOnlineResult<UE::Online::FAuthLogin>& Result)
{
if (Result.IsOk())
{
const UE::Online::FAccountId AccountId = Result.GetOkValue().AccountInfo->AccountId;
}
});
  • Logout, removal of the Persistent Auth token, refresh before the auth expires and QueryExternalAuthToken (Epic id token) are supported.
  • OnLoginStatusChanged fires when the login status changes.
  • Not supported: creating or linking accounts, verified auth tickets and sessions.

Blueprint nodes​

The nodes are in the category EOSCore | Online Services | Auth. They log in through the Online Services, so the account is registered there and can be used from C++ code that calls UE::Online::GetServices(). The existing EOS_Auth_Login and EOS_Connect_Login nodes call the EOS SDK directly and do not register the account in the Online Services.

On engines older than 5.7 the nodes still exist, but Online Services Login and Online Services Logout always fire On Failure with the error code not_implemented.

NodeDescription
Online Services LoginLogs a local user in. Fires On Success with the account, or On Failure with the error. If the user is already logged in, it fires On Success with the existing account
Online Services LogoutLogs the account out. Set Destroy Auth to also remove the Persistent Auth token
Get Online Login StatusNotLoggedIn, UsingLocalProfile, LoggedInReducedFunctionality or LoggedIn for a local user
Get Online Local Account IdThe account of a local user. Returns false when the user is not logged in
Get Online Product User Id, Get Online Epic Account IdConverts the account to the ids that the other EOSCore nodes use
Is Valid (Online Account Id), To String (Online Account Id)Helpers for the account id
Is Online Services AvailableTrue when the module is compiled in, enabled and has an EOS platform

Online Services Login takes a Login Params struct:

FieldDescription
Local User NumIndex of the local player, usually 0
Login TypeAuto, AccountPortal, PersistentAuth, ExchangeCode, Developer, Password, RefreshToken or ExternalAuth, see the table under Auth
IdThe DevAuthTool host for Developer (for example localhost:6300), the email for Password, or the display name for a DeviceIdAccessToken login
TokenThe credential name for Developer, the password, the exchange code, the refresh token, or the external token
External Token TypeOnly for ExternalAuth, for example SteamSessionTicket, OpenIdAccessToken or DeviceIdAccessToken
ScopesOptional. Empty uses BasicProfile, FriendsList and Presence

Both nodes return a Result with Account Id, Product User Id, Epic Account Id, Error Code and Error Message. The Epic Account Id is empty for ExternalAuth logins without an Epic account.

Example with the Developer Authentication Tool:

  1. Add Online Services Login to Begin Play of your Game Instance or Player Controller.
  2. Break Login Params: Login Type = Developer, Id = localhost:6300, Token = the credential name in the DevAuthTool.
  3. From On Success, store Result → Account Id and use Result → Product User Id with the other EOSCore nodes.
  4. From On Failure, print Result → Error Message.

The nodes use the default Online Services instance. In a PIE session with several clients, all clients share it, so log in with one client at a time or test with standalone processes.

Presence​

QueryPresence, BatchQueryPresence, GetCachedPresence, UpdatePresence, PartialUpdatePresence and OnPresenceUpdated.

  • Presence needs a local user that logged in with an Epic account.
  • The status string is stored as the EOS rich text.
  • Properties are stored as EOS presence records (at most 32 keys and 255 characters per value). They come back as strings.
  • The joinability is stored in the record EOSCore_Joinability.
  • PartialUpdatePresence changes the status string and the rich text together when you set only one of them.

Lobbies​

CreateLobby, FindLobbies, JoinLobby, LeaveLobby, InviteLobbyMember, DeclineLobbyInvitation, KickLobbyMember, PromoteLobbyMember, ModifyLobbyJoinPolicy, ModifyLobbyAttributes, ModifyLobbyMemberAttributes, GetJoinedLobbies, GetPresenceLobby, IsPresenceLobby, GetReceivedInvitations and all lobby events, including join requests from the EOS overlay.

  • Attributes (string, int64, double and bool) are written directly as EOS lobby attributes. You do not need a lobby schema. The schema id is stored in the attribute EOSCORE_SCHEMA.
  • FindLobbies can filter by attribute, and find a lobby by id or by target user. EOS needs a few seconds to index a new lobby, so a search right after CreateLobby can come back empty.
  • Not supported: RestoreLobbies and ModifyLobbySchema.

Sessions​

CreateSession, UpdateSessionSettings, LeaveSession, FindSessions, JoinSession, SendSessionInvite, RejectSessionInvite, the getters and all session events, including join requests from the EOS overlay.

  • CreateSession needs a SchemaName and a NumMaxConnections larger than 0.
  • Custom settings are written as EOS session attributes. Public settings are advertised, Private settings are not.
  • FindSessions adds a filter for the bucket automatically.
  • Not supported: LAN sessions and StartMatchmaking.
UE::Online::FCreateSession::Params Params;
Params.LocalAccountId = AccountId;
Params.SessionName = TEXT("GameSession");
Params.SessionSettings.SchemaName = TEXT("MySchema");
Params.SessionSettings.NumMaxConnections = 4;
Params.SessionSettings.JoinPolicy = UE::Online::ESessionJoinPolicy::Public;
Params.SessionSettings.CustomSettings.Add(TEXT("MAPNAME"), UE::Online::FCustomSessionSetting{ UE::Online::FSchemaVariant(TEXT("Arena")), UE::Online::ESchemaAttributeVisibility::Public, 0 });

Sessions->CreateSession(MoveTemp(Params)).OnComplete([](const UE::Online::TOnlineResult<UE::Online::FCreateSession>& Result)
{
});

Connecting to the host​

IOnlineServices::GetResolvedConnectString returns the address to travel to, for lobbies and for sessions:

  • For P2P lobbies and sessions it returns the P2P address of the host, EOS:<ProductUserId>:GameSession:<port>. Use it with the EOSCore net driver, see Online Subsystem Setup.
  • For other sessions it returns the host address of the session.
UE::Online::FGetResolvedConnectString::Params Params;
Params.LocalAccountId = AccountId;
Params.LobbyId = LobbyId;
const UE::Online::TOnlineResult<UE::Online::FGetResolvedConnectString> Result = Services->GetResolvedConnectString(MoveTemp(Params));

Limits​

  • The Online Services and the Online Subsystem share one EOS platform and one login. Logging out through the Online Services also logs the user out of the Online Subsystem, and the other way around.
  • EOS allows one lobby with presence per user, as in the Online Subsystem.
  • The module is tested on UE 5.8 only.