Leaderboards
GD-Sync includes a built-in leaderboard system that allows users to submit scores to global leaderboards and compete with other players.
To use leaderboards, first create a database in the control panel. Once the database is created, go to your API key and link the database to it.
GD-Sync’s leaderboard system revolves around the built-in player account system. Only players that are logged-in can use leaderboards. Please look at Cloud Storage for more information.
Scores
To submit a score to a leaderboard, use GDSync.leaderboard_submit_score(leaderboard : String, score : int). This returns a response code from ENUMS.LEADERBOARD_SUBMIT_SCORE_RESPONSE_CODE.
To delete a score from a leaderboard, use GDSync.leaderboard_delete_score(leaderboard : String). This returns a response code from ENUMS.LEADERBOARD_DELETE_SCORE_RESPONSE_CODE. Scores can also be removed directly from the control panel.
Each user can only have one score on a leaderboard, and submitting a new score will overwrite the previous one.
A valid login session is required for the score to be accepted.
Browsing
Leaderboards and their submitted scores can be browsed using GDSync.leaderboard_browse_scores(leaderboard : String, page_size : int, page : int). This returns a dictionary in the defined format, along with a response code from ENUMS.LEADERBOARD_BROWSE_SCORES_RESPONSE_CODE. GD-Sync also includes a built-in template that demonstrates how to create a leaderboard browser.To retrieve the score and rank of a specific user, use GDSync.leaderboard_get_score(leaderboard : String, username : String). This returns a dictionary in the defined format, with a response code from ENUMS.LEADERBOARD_GET_SCORE_RESPONSE_CODE.
A valid login session is required to browse and retrieve scores.