Skip to content
PEERLESSDocs

Social features and player panels

Open the hosted party, friends and chat panels, or draw your own player cards and party frames.

Use the hosted panels

The PEERLESS player already has party, friends, chat and profile panels. Open them from your own buttons instead of rebuilding those flows:

const context = await Peerless.init();
if (context.capabilities.socialUI) {
  partyButton.onclick = () => Peerless.ui.open("party");
  friendsButton.onclick = () => Peerless.ui.open("friends");
  chatButton.onclick = () => Peerless.ui.open("chat");
  profileButton.onclick = () => Peerless.ui.open("profile");
}

ui.open() accepts menu, party, friends, chat, profile, settings, achievements and leaderboards. It resolves to true when the panel opens and false in standalone mode or when the overlay is off. Multiplayer keeps running while a panel is open; see overlay events to pause input.

Draw your own party frames

social.onChange() delivers a snapshot right away and then whenever it changes, polling every five seconds while subscribed:

const context = await Peerless.init();
let stopSocial, stopErrors;
if (context.capabilities.social) {
  stopErrors = Peerless.on("social-error", (error) => showSocialError(error.message));
  stopSocial = Peerless.social.onChange(({ me, friends, party }) => {
    renderPlayerCard(me);
    renderFriends(friends);
    renderPartyFrames(party?.members ?? []);
  });
}
// On scene shutdown:
stopSocial?.();
stopErrors?.();

A failed refresh emits social-error and keeps the last good snapshot, so frames never flicker away during a network hiccup.

One-shot reads

MethodResult
social.snapshot(){ me, friends, party }
social.me()The current player's card, including guest.
social.friends()Accepted friends with presence, activity and statusText.
social.party()The current party, or null when solo.
social.profile(playerId)A card for yourself, a friend or a party member. Other IDs are rejected.

Data you receive

  • Player card: playerId, playerName, avatarUrl, avatarFrame, nameStyle, membershipBadge and profileUrl.
  • Friend: a card plus presence (online, looking_for_party, away, busy or offline). Invisible friends appear offline; ignored players are excluded both ways.
  • Party: id, leaderId, selectedGameId and members with ready.

IDs match the game-scoped IDs in runtime credentials and session rosters. Email, credentials, billing and account settings are never included.