RetiPie
SDK

SDK Leaderboards

Declare leaderboard support with retipie.game.configure and submit one score per completed run with retipie.leaderboards.submitScore.

Your game code turns the leaderboard on. There's no switch for it in Slice: the current version declares it through the SDK.

Declare support

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

When RetiPie finds this declaration while analyzing a version, the feed shows the leaderboard button for that version.

Submit scores

Submit one score at the end of a completed run.

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

submitScore(score) returns nothing. The SDK ignores a score that is not a finite number greater than zero, and RetiPie only accepts scores up to 1,000,000,000. Scores are kept to three decimal places, but the board is declared in whole points, so submit integers.

Leaderboards are all-time high score boards. Higher scores rank above lower scores, and each player keeps their best score. Scores count only while the game is actually being played in the app, and only for signed-in players: guests don't appear on leaderboards.

Leaderboards explains what players see and what happens when a new version drops the declaration.

On this page