Platform Interface

Interface that grants access to all other interfaces.

The Platform Interface sits at the heart of the Epic Online Services (EOS) SDK and holds the handles you need to access every other interface and keep them all running. When your application starts up, you can initialize the SDK and get a handle to the Platform Interface. This handle is usable for the lifetime of the SDK.

Initializing the SDK

The first step to using the Epic Online Services (EOS) SDK is to initialize it. During initialization, your code will identify your product and have the opportunity to set up custom memory allocation functions.

Configuring and Creating the SDK

Initialize the EOS SDK by calling EOS_Initialize with an EOS_InitializeOptions data structure. Populate the structure as follows:

Property

Value

ApiVersion

EOS_INTIALIZE_API_LATEST

ProductName

The name of the product using the SDK. The name string must not be empty and supports a maximum of 64 characters in length.

ProductVersion

The product version of the application using the SDK

Reserved

NULL

AllocateMemoryFunction

Your custom malloc function, of type EOS_AllocateMemoryFunc, or NULL

This function must return pointers that honor memory alignment.

ReallocateMemoryFunction

Your custom realloc function, of type EOS_ReallocateMemoryFunc, or NULL

ReleaseMemoryFunction

Your custom free function, of type EOS_ReleaseMemoryFunc, or NULL

SystemInitializeOptions

A field for any system-specific initialization. If provided then the information will be passed to the EOS<em><system></em>InitializeOptions structure, where <system> is the system being initialized.

EOS_Initialize returns an EOS_EResult to indicate success or failure. The value will be EOS_Success if the SDK initialized successfully; otherwise, the value will indicate an error, such as EOS_AlreadyConfigured. After initializing the SDK, you can create a Platform Interface.

Logging Callbacks

The SDK logs useful information at various levels of verbosity. Registering a callback with EOS_Logging_SetCallback will allow access to this output. Implement a function of type EOS_LogMessageFunc to receive the EOS_LogMessage data structure.

  • Category: The category of the log message (see EOS_ELogCategory)

  • Message: The message itself

  • Level: The verbosity of the log message (see `EOS_ELogLevel)

You may use EOS_Logging_SetLogLevel to adjust logging detail level.

Platform Interface

The Platform Interface provides access to all other EOS SDK interfaces, and keeps them running. Once you have created the platform interface, you can use it to retrieve handles to other interfaces, or tell it to run its per-frame update code, known as ticking.

Creating the Platform Interface

Create the Platform Interface by calling the EOS_Platform_Create function with an EOS_Platform_Options structure containing the following information:

Property

Value

ApiVersion

EOS_PLATFORM_OPTIONS_API_LATEST

Reserved

NULL

ProductId

The Product ID of the game, provided by Epic Games

SandboxId

The Sandbox ID of the game, provided by Epic Games

ClientCredentials

The Client ID and Client Secret pair assigned to the host application

Publicly exposed applications, such as the end-user game client, will use different credentials than a trusted game server backend.

EncryptionKey

256-bit Encryption Key for file encryption in hexadecimal format (64 hex chars)

OverrideCountryCode

The override country code for the logged-in user

OverrideLocaleCode

The override local code for the logged-in user

DeploymentId

The Deployment ID of the game, provided by Epic Games

Flags

Platform creation flags, expressed as a bitwise-or union of EOS_PF_ flags

bIsServer

EOS_FALSE for a client, EOS_TRUE for a server

CacheDirectory

Absolute path to the folder that is going to be used for caching temporary data

Upon success, EOS_Platform_Create will return a handle to the Platform Interface, of type EOS_HPlatform.

In applications that support multiple views, such as editors, you may want to create multiple Platform Interface handles. This is not necessary to support multiple users playing on the same device, such as splitscreen games. The SDK supports multiple Platform Interface instances, each with its its own internal state. Other interfaces that you retrieve will be unique to the Platform Interface from which you retrieve them. Do not attempt to initialize more than one instance of the SDK itself.

Using the Platform Interface

Once you have an EOS_HPlatform handle, you can use it to gain access to the other EOS SDK interfaces through their handle access functions:

Interface

Access Function

Achievements

EOS_Platform_GetAchievementsInterface

Authentication

EOS_Platform_GetAuthInterface

Connect

EOS_Platform_GetConnectInterface

ECOM

EOS_Platform_GetCEcomInterface

Friends

EOS_Platform_GetFriendsInterface

Lobby

EOS_Platform_GetLobbyInterface

Metrics

EOS_Platform_GetMetricsInterface

P2P

EOS_Platform_GetP2PInterface

Player Data Storage

EOS_Platform_GetPlayerDataStorageInterface

Presence

EOS_Platform_GetPresenceInterface

Sessions

EOS_Platform_GetSessionsInfoInterface

Stats

EOS_Platform_GetStatsInterface

User Info

EOS_Platform_GetUserInfoInterface

In addition to gaining access to the other interfaces, the Platform Interface keeps them all running. Call EOS_Platform_Tick from your game's main loop every frame to make sure that asynchronous functions continue updating.

Restarting the App with the Launcher

By passing an EOS_HPlatform handle into EOS_Platform_CheckForLauncherAndRestart, EOS will check whether the app was launched through the Launcher. If it wasn't, it will restart the app through the Launcher. This returns an EOS_EResult with the following codes:

  • EOS_Success: The app is being relaunched with the Launcher. The current app process must be terminated as soon as possible to make way for the newly launched process.

  • EOS_NoChange: If the app was already launched through the Launcher, no additional action needs to be taken.

  • EOS_UnexpectedError: The LauncherCheck module failed to initialize, or the module tried and failed to restart the app.

This function is only relevant for apps that are published on the store and therefore are already accessible through the Launcher.

Shutting Down the SDK

To close the game, you must release the memory held by the Platform Interface as well as the global state held by the SDK. First, pass your EOS_HPlatform handle to the EOS_Platform_Release function to shut it down. After that, you can call EOS_Shutdown to complete the process and shut down.

Once you call EOS_Shutdown, you will not be able to reinitialize the EOS SDK, and any further calls to it will fail.