Online Services (OSSv2)
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
EOSCoreOnline 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
.uprojectand addOnlineServicesInterfaceto 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
| Section | Key | Default | Description |
|---|---|---|---|
[OnlineServices.EOSCore] | bEnabled | true | Registers the EOSCore online services |
ServicesEnumEntry | Epic | The EOnlineServices value to register as, for example GameDefined_0 to use it next to the engine's EOS services | |
RegistryPriority | 10 | Priority in the online services registry. The highest priority wins | |
[OnlineServices.EOSCore.Auth] | bExternalAuthUsesEpicAccount | false | Logs in to Epic Account Services too when you log in with ExternalAuth |
bAutoCreateConnectUser | true | Creates a new Connect user when the external account has none | |
[OnlineServices.EOSCore.Lobbies] | BucketId | EOSCore | Bucket of the lobbies. Lobbies from another bucket are not found |
[OnlineServices.EOSCore.Sessions] | BucketId | EOSCore | Bucket of the sessions |
bUseP2PHostAddress | bIsUsingP2PSockets of the EOSCore net driver | Uses the EOS P2P address of the host as the session address |
Auth
IAuth::Login logs in with these credential types:
| Credentials type | Behaviour |
|---|---|
Auto | Reads -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, Password | Logs in to Epic Account Services, then to Game Services with the Epic id token |
Developer | The Developer Authentication Tool. CredentialsId is the host (for example localhost:6300) and CredentialsToken is the credential name |
ExternalAuth | Logs 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. OnLoginStatusChangedfires 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.
| Node | Description |
|---|---|
Online Services Login | Logs 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 Logout | Logs the account out. Set Destroy Auth to also remove the Persistent Auth token |
Get Online Login Status | NotLoggedIn, UsingLocalProfile, LoggedInReducedFunctionality or LoggedIn for a local user |
Get Online Local Account Id | The account of a local user. Returns false when the user is not logged in |
Get Online Product User Id, Get Online Epic Account Id | Converts 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 Available | True when the module is compiled in, enabled and has an EOS platform |
Online Services Login takes a Login Params struct:
| Field | Description |
|---|---|
Local User Num | Index of the local player, usually 0 |
Login Type | Auto, AccountPortal, PersistentAuth, ExchangeCode, Developer, Password, RefreshToken or ExternalAuth, see the table under Auth |
Id | The DevAuthTool host for Developer (for example localhost:6300), the email for Password, or the display name for a DeviceIdAccessToken login |
Token | The credential name for Developer, the password, the exchange code, the refresh token, or the external token |
External Token Type | Only for ExternalAuth, for example SteamSessionTicket, OpenIdAccessToken or DeviceIdAccessToken |
Scopes | Optional. 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:
- Add
Online Services Loginto Begin Play of your Game Instance or Player Controller. - Break Login Params:
Login Type=Developer,Id=localhost:6300,Token= the credential name in the DevAuthTool. - From On Success, store
Result → Account Idand useResult → Product User Idwith the other EOSCore nodes. - 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. PartialUpdatePresencechanges 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. FindLobbiescan 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 afterCreateLobbycan come back empty.- Not supported:
RestoreLobbiesandModifyLobbySchema.
Sessions
CreateSession, UpdateSessionSettings, LeaveSession, FindSessions, JoinSession, SendSessionInvite, RejectSessionInvite, the getters and all session events, including join requests from the EOS overlay.
CreateSessionneeds aSchemaNameand aNumMaxConnectionslarger than 0.- Custom settings are written as EOS session attributes.
Publicsettings are advertised,Privatesettings are not. FindSessionsadds 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.