Skip to content

Cross-platform

Besides crossplay, another unique feature of the GOG GALAXY SDK is cross-platform. This means users can play with each other despite using different platforms (computers vs. game consoles). Our SDK allows connecting users on Windows/macOS/Linux PCs with users on Playstation 4 and Xbox One.

There are four SignIn…() methods in the GOG GALAXY SDK, which allow user authorization in the following platforms:

The vast majority of work that you have to do as a developer to enable cross-platform gaming is to configure the appropriate backends in the above platforms. Please consult support materials and specialists at those parties to perform necessary steps outlined in this article.

The general rule of thumb is to set up and receive proper credentials and certificates for your game in PlayStation Network and Xbox Developer Portal, then provide the necessary information to us, so that we can modify the ClientID properties of your product in GOG GALAXY environment.

PlayStation 4

Backend Configuration

In order to integrate a PS4 account with the GOG GALAXY SDK, you should configure the PSN backend:

  1. Create a separate product of App Server/Website for a Title. This product should be bound together with the Game (App) product, using PSSDC service.
  2. Having the product configured, you need to request GOG to bind the created product with the GOG GALAXY ClientID. You can achieve this by sending a request to your GOG Product Manager with a generated clientID and clientSecret of a newly created App Server/Website product. After that, the backend setup is complete.

Info

The clientID should be in the following format (the same ID should be passed to the SignInPS4 method from the next paragraph):

xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

The clientSecret should be in the following format:

xxxxxxxxxxxxxxxx

Authorization

The PS4 integration is done the same way as with other platforms, which means that for each PSN user that will try to sign in, GOG will create a connected GOG account.

An appropriate SignInPS4 method has to be called from the IUser interface:

/**
 * Initializes the Galaxy Peer based on PS4 credentials.
 *
 * This call is asynchronous. Responses come to the IAuthListener.
 *
 * @remark Information about being signed in or signed out also comes to
 * the IOperationalStateChangeListener.
 *
 * @param [in] ps4ClientID The PlayStation 4 client ID.
 * @param [in] listener - The listener for a specific operation
*/
virtual void SignInPS4(const char* ps4ClientID, IAuthListener* const listener = NULL) = 0;

A successful authorization ends the same way as normal GOG authorization by calling IAuthListener::OnAuthSuccess. After that, you will be able to use the GOG GALAXY SDK crossplay features such as:

Other interfaces will not work properly, since they rely on the GOG GALAXY desktop application.

PlayStation Certification

When applying for a PS certification, bear in mind these rules:

  • The code should be compiled with the -fPIC -fstack-protector-all -fstack-protector-strong flags.
  • The multiplayer feature has to be limited not to use P2P connections — all the game traffic will be routed via GOG GALAXY servers.

Xbox One / Xbox Live

  1. Generate a Business Partner Certificate and a Relying Party Certificate (please consult Xbox Developer support on how to do that).

  2. Log in to Xbox Developer Portal.

  3. In the Web Services section, create a new WebService.

  4. For this WebService, setup a Business Partner Certificate by adding an endpoint with the following parameters:

    • Host Type: FQDN

    • Protocol: https

    • Host Name: auth.gog.com

    • Port: (leave empty)

    • Path: token

    (The above fields should result in https://auth.gog.com/token address)

    • Check the Requires Single Sign On Token option

    • Token Type: JWT

    • Token definition → Click Add New

    • Use RP_Cert.cer from Relying Party Certificate as the Encryption Certificate

    • Make sure that the delegation token claim is added

  5. Send a request to your GOG Product Manager with the following information allowing us to bind your game with our ClientID:

    • generated Relying Party Certificate

    • generated Business Partner Certificate

    • title_id

    • title_product_id

    • SCID

  6. In case of Xbox Live, you need to obtain an Xbox Secure Token Service (XSTS) token by following these instructions.

After that, the backend setup is complete.

Implementation in Your Game Code

XboxOne

You have to put the following entry in the Package.appxmanifest file in the Applications/Application/Extensions section.

RequireXboxLive states if the game is allowed to run in the offline mode:

<mx:Extension Category="xbox.live">
    <mx:XboxLive TitleId="<title_id>" PrimaryServiceConfigId="<SCID>" RequireXboxLive="false" />
<mx:Extension>

The data (title_id and SCID) can be found in XDP on the Product Instance page.

In addition, the following capability has to be added in the Package.appxmanifest document root (same level as Applications):

<Capabilities>
  <Capability Name="internetClientServer" />
</Capabilities>

Inside the game code itself, you should use the following authorization method of the IUser interface:

/**
 * Initializes the Galaxy Peer based on XBOX ONE credentials.
 *
 * This call is asynchronous. Responses come to the IAuthListener
 * (for all GlobalAuthListener-derived and optional listener passed as argument).
 *
 * @remark Information about being signed in or signed out also comes to
 * the IOperationalStateChangeListener.
 *
 * @param [in] xboxOneUserID - The XBOX ONE user ID.
 * @param [in] listener - The listener for a specific operation.
 */
virtual void SignInXB1(uint32_t xboxOneUserID, IAuthListener* const listener = NULL) = 0;

Where the xboxOneUserID parameter is an index of the signed in Xbox Live user on a console (as it is possible to have multiple Xbox Live users signed in).

Here you can find an example of finding the first signed in Xbox user:

Windows::Xbox::System::User^ loggedInUser = nullptr;
for (int i = 0; i < Windows::Xbox::System::User::Users->Size; ++i, loggedInUser = nullptr)
{
    loggedInUser = Windows::Xbox::System::User::Users->GetAt(i);
    if (loggedInUser->IsSignedIn)
        break;
}

if (!loggedInUser)
{
    Logger::Log("SignInXB1: there is no logged in user");
    return false;
}
galaxy::api::User()->SignInXB1(loggedInUser->Id);

Xbox Live

/**
 * Initializes the Galaxy Peer based on XBOX LIVE tokens.
 *
 * This call is asynchronous. Responses come to the IAuthListener
 * (for all GlobalAuthListener-derived and optional listener passed as argument).
 *
 * @remark Information about being signed in or signed out also comes to
 * the IOperationalStateChangeListener.
 *
 * @param [in] token - The XSTS token.
 * @param [in] signature - The digital signature for the HTTP request.
 * @param [in] marketplaceID - The Marketplace ID.
 * @param [in] locale - The user locale (e.g.: EN-US, FR-FR).
 * @param [in] listener - The listener for specific operation.
 */
virtual void SignInXBLive(const char* token, const char* signature, const char* marketplaceID, const char* locale, IAuthListener* const listener = NULL) = 0;