RetiPie

Leaderboards

Turn on a leaderboard by declaring score support in your game code, then submit all-time high scores after each run. No upload setting needed.

RetiPie shows a leaderboard for your game when the game declares leaderboard support through the SDK. There's no setting for it in Slice; your game code decides.

Declare support

Call retipie.game.configure() once when your game starts.

retipie.game.configure({
  leaderboards: {
    default: { order: 'desc', unit: 'points', precision: 0 },
  },
});

When you upload a build, RetiPie opens it in the same sandbox players use and listens for this declaration. When it finds it, the feed shows the leaderboard button for that version. You can see the button on the feed preview in Slice. A game that submits a score while players are playing it also gets the button, so a missing declaration doesn't stop scores from counting.

Submit a score

Submit once per completed run.

function gameOver() {
  retipie.leaderboards.submitScore(Math.floor(score));
}

Leaderboards are all-time high score boards. Higher is better, and the unit is points. Scores must be greater than zero and at most 1,000,000,000. See SDK Leaderboards for the exact rules.

What players see

Each player keeps their best score. Players can view the board for everyone, for their country, or for their friends (players they follow who follow them back). Only signed-in players appear on leaderboards.

New versions

If a later version drops the declaration, the leaderboard button is hidden and the old scores are kept. Declare it again in a new version to bring the board back with its scores.

Analytics is separate

Use analytics for your own telemetry, not for scores.

retipie.analytics.trackEvent('level_failed', {
  level: 4,
  reason: 'spikes',
});

Scores create ranking data that players see, so they belong to retipie.leaderboards, not retipie.analytics. Custom analytics events aren't reported yet; see Analytics.

On this page