Skip to content

Leaderboards

FRVR.leaderboards is a multi‑leaderboard score store. One game can have any number of boards (by mode, by time window, by difficulty).

await FRVR.leaderboards.postScore('endless_mode', 42000);

Returns when the score is accepted. Use a cache policy to bypass the default “only send if better than last” check.

const entry = await FRVR.leaderboards.getLeaderboardEntry('endless_mode', playerId);
// { playerId, score, rank, name, photo }
const entries = await FRVR.leaderboards.getLeaderboardEntries(
  'endless_mode',
  friendIds,
);
const board = await FRVR.leaderboards.getLeaderboard('endless_mode', 50, 0);
// { leaderboardId, entries: [{ playerId, score, rank, … }], total, … }

For “which of my friends are in the 30‑50k bracket”:

const entries = await FRVR.leaderboards.getTimelineEntries({
  id:       'endless_mode',
  interval: 'weekly',       // or 'all_time', 'daily', …
  minScore: 30000,
  maxScore: 50000,
  limit:    100,
});

Typically your FRVR dashboard defines these, but you can create one at runtime:

await FRVR.leaderboards.create('endless_mode', {
  title:           'Endless Mode',
  refreshInterval: 'weekly',
});

Every read/write accepts an optional ScoreCachePolicy. Defaults are sensible — override only when you’re doing something specific like live‑updating a ranked lobby.

if (!FRVR.leaderboards.isSupported()) hideLeaderboardUI();

Some channels route through platform leaderboards (Google Play Games, Game Center) and don’t expose the full FRVR API. isSupported() tells you whether you can use the methods above.