Skip to content
PEERLESSDocs

Player identity

Use the game-scoped player ID, display names, guests and your own accounts.

The player object

Inside PEERLESS, init() returns the current player:

const { player } = await Peerless.init();
// { playerId, playerName, gameId, guest, developerPlayerId }

playerId is stable for this player in this game only. The same person has a different ID in another game, and no platform account ID, email or billing detail is ever shared with games.

Map to your own accounts

If your game has its own accounts, map the platform ID during initialization. Return an existing or newly linked ID from your backend:

const context = await Peerless.init({
  mapPlayerIdentity: async (player) => {
    const response = await fetch("/api/link-peerless", {
      method: "POST",
      body: JSON.stringify({ playerId: player.playerId }),
    });
    return (await response.json()).accountId;
  },
});
console.log(context.player.developerPlayerId); // your account ID

The mapping changes nothing about the platform credential. Authenticate and store aliases on your server, and never merge players by display name or email.

Runtime credentials

Peerless.runtime() returns the current identity plus a short-lived token for your backend:

FieldMeaning
playerId · playerName · guestWho is playing.
gameId · buildId · grantIdWhat is being played, and the launch.
mode · endpoint · endpointsNetworking mode and server addresses, when supplied.
token · expiresAtA short-lived credential. Request a fresh one instead of storing it.
intentThe verified party launch, or null for a solo launch.

Servers verify tokens with the provider helper. See Dedicated and managed servers.

Guests

Guests can play free games and join party invitations without creating an account. They receive a game-scoped player ID like everyone else. When a guest registers and verifies the same identity, their ID, scores and achievement progress continue. Signing in to a different, existing account switches identities and does not merge guest progress.

Guests have an empty friends list but can belong to a party. Paid games, chat, purchases and Creator studio require a verified account.