Skip to main content

Platform Friends Handling

1. Background

PGOS provides powerful in-game social features for game. But friend interactions between the account platform (Steam, Epic Store, Xbox, PlayStation, etc.) for game are also definitely important. This doc helps the game developers to understand the mechanism, and how to handle friends interaction between PGOS and account platform with the help of Account SDK (INTL SDK), which encapsulate the interfaces of account platforms.

2. Basic Conception

2.1 INTL SDK

An account service which encapsulate the game platform authentication interfaces and provides an unified account for games with Open ID. Game developers need to integrate it by themselves.

2.2 Open ID

When a new player login, INTL SDK would assign a new account with Open ID to identify this player. It's worth nothing that INTL SDK will assign different accounts for the same player if he logs in the game with different platforms, because INTL SDK isn't able to recognize that different platform accounts are owned by the same person.

2.3 Invocation Flow

The following diagram shows the invocation flow between game client and all other sides. In a word, game developers need to handle the game platform things by invoking INTL SDK or integrating platform SDK by themselves.

sequenceDiagram Game Client->>INTL SDK: Login / Get Platform Friends / Call Platform API INTL SDK->>Game Platform: Invoke Platform API Game Client->>PGOS: LoginPGOS(openid, token) / Map OpenID to PlayerID PGOS->>INTL SDK: verify(openid, token)

PGOS doesn't handle the platform things directly, only does the following process:

  • Verify the Open ID and Token to check if they are valid by INTL SDK backend.
  • Help game to map between Open ID and Player ID. So, game is able to check if the platform friends registered and play the game, and who are they in game.

3. Key Cases

3.1 Map the platform friends into PGOS players

You can call BatchOpenIDToPlayerID API in PGOS SDK to do the mapping. The following steps show how to do it:

  1. Call INTL SDK API to get the platform friend list with Open ID.
  2. Call OpenIDToPlayerID API in PGOS SDK to map the Open ID to Player ID. Note: Only the Player IDs that played the game can be mapped. The API would tell you the Open ID list that cannot be mapped.
  3. Then, you can show the platform friends in the game UI, and highlight who played the game, who are not registered the game yet.

3.2 Connect the platform friends in the game

Maybe you want to help player to connect the platform friends in game. Here are a few cases for platform friends:

  • Case A: The platform friends don't play the game (not registered in PGOS) yet.
  • Case B: The platform friends played the game, but they are not in-game friends (friends in PGOS) yet.
  • Case C: The platform friends played the game, and they are in-game friend.

For Case A, if you want to help the player to interact with his platform friends inside the game, you can call INTL SDK API to do the interaction such as Invite into the game.

tip

You should confirm with the INTL SDK team whether the INTL SDK supports this kind API for the specific platform.

For Case B, if you want to help the player to make in-game friend with his platform friends, you can call AddFriend API in PGOS SDK with the player ID that is just mapped. They will be in-game friend once his platform friends accept the AddFriend request.

tip

Considering privacy policy, PGOS would not automatically make in-game friend with the platform friend. The friend request acceptance is critical step for it.

For Case C, generally speaking, just showing the in-game friend status is fine.

3.3 Handle the in-game and platform friend list

We suggest that the game client shows the in-game and platform friend list separately, or shows an all-in-one list and highlight the friend status, such as wether the player played the game, wether they are in-game friends and from which platform.

image-20220915174107188