Skip to main content

Module leaderboard

Module leaderboard 

Source
Expand description

Leaderboard protocol: submit scores, fetch boards, paginate results.

Speaks JSON over HttpClient (needs the http feature for real network access). The expected server API:

  • POST {base}/scores with {"player_id", "name", "score", "metadata", "checksum"?, "replay_id"?}, answered with {"rank", "score"}.
  • GET {base}/scores?period=&class=&page=&page_size= answered with either a JSON array of entries or {"entries": [...], "total": N}.
  • GET {base}/scores/{player_id} answered with one entry.

An entry is {"rank", "player_id" (or "id"), "name", "score", "metadata"?, "timestamp"?, "replay_url"?}; numbers may also be strings.

Structs§

LeaderboardClient
High-level leaderboard API built on top of HttpClient.
LeaderboardFilter
Which part of the board to fetch.
ScoreEntry
One row of a leaderboard.
ScoreSubmission
A score to send to the board.

Enums§

LeaderboardEvent
Results from LeaderboardClient::drain_events.