Leaderboards can be a fun way to drive competition among your players, both for your most hardcore fans (who will be fighting for the top spot in a public leaderboard) and for your more casual players (who will be interested in comparing their progress to their friends’).
When you create a leaderboard, the Megamify will take care of managing most aspects of this leaderboard for you. The typical process works like this:
- At the end of a game (or at an appropriate moment that you’ve determined), the game submits the player’s score to one or more leaderboards you’ve created for the game.
- Megamify checks if this score is better than the player’s current leaderboard entry for the daily, weekly, or all-time score. If it is, Megamify updates the corresponding leaderboards with the new score.
- Megamify sends a score report back to the game client. This report tells the client whether this is a new daily, weekly, or all-time high score. If it isn’t, Megamify will tell the client what the current daily, weekly, or all-time high score is for this player.
- To retrieve a player’s results for a leaderboard, you can request a time frame (daily, weekly, or all-time), and specify whether or not the user wants to see a social or public leaderboard. Megamify performs all the necessary filtering, and then sends the results back to the client.
- In cases where there are a lot of scores to report, Megamify sends back only the data for the top leaderboard scores. You can also retrieve raw score data for the top scores or the scores adjacent to the player’s.
Games can have multiple leaderboards, there currently is no max amount.
Leaderboard time frames¶
Megamify automatically creates daily, weekly, and all-time versions of every leaderboard that you create. There’s no need for you to create separate leaderboards for each time frame.
Daily leaderboards reset at UTC-7 (that is, “midnight Pacific Daylight Time”) all year long.
Weekly leaderboards reset at midnight between Saturday and Sunday, in the same timezone as daily leaderboards (UTC-7).
Player names that you retrieve directly using the client libraries may contain Unicode characters (for example, if the name has non-English characters). If you are implementing your own version of a leaderboard UI that uses decorative fonts, make sure that your UI can display these names correctly.
To create and manage leaderboards, you’ll want to be familiar with these leaderboard attributes:
These basic elements are associated with every leaderboard:
- ID is a unique string that the Google Play Console will generate for you. You’ll use this unique ID to refer to the leaderboard in your game clients.
- Name is a short name of the leaderboard (for example, “High Scores” or “Level 3”). This can be up to 100 characters.
- Icon is a square icon that will be associated with your leaderboard. For best practices when creating your leaderboard icons, see the Icon Guidelines section below.
- List order is the order in which the leaderboard will appear when a player views the leaderboards associated with your game.
- Limits are optional values that define the lower and upper limits of scores that are allowed in the leaderboard. This can help you discard score submissions that are clearly fraudulent. You can also use Players.hide to hide players that you believe have submitted fraudulent scores from all leaderboards in your app.
Leaderboards can have one of two ordering types:
- Larger is better leaderboards are the default. This is typically what you would see in most games where players earn points.
- Smaller is better leaderboards are occasionally used in cases where a smaller score would be better. The most common examples of this type of leaderboard are in racing games, where the score represents the player’s time to finish the race.
Icons should be created as 512 x 512 PNG or JPEG files. Your icons will be scaled down in most game clients, so you should avoid creating icons with too much fine detail. You can submit icons with an alpha channel, and the transparency will be retained.
Creating a leaderboard¶
To create a leaderboard, select the Leaderboard button on the left, then click the New Leaderboard button.
Then, simply fill out the information required for this leaderboard.
Click Save, and your leaderboard will be made available.