GameMaker Online Leaderboard Tutorial
Want your players to compete for the highest score? This beginner-friendly guide explains how online leaderboards work and how to connect your GameMaker project to GMDB.
Get started freeRead GMDB documentationWhat you will build
- A game that sends scores to an online leaderboard
- A screen that requests and displays player rankings
- A hosted leaderboard managed from your GMDB dashboard
Step 1: Create your GMDB project
Register for a free GMDB account, add your GameMaker game to the dashboard and enable or configure its leaderboard service. Keep the project identifier and any required credentials ready.
Step 2: Submit a score
After a player finishes a round, send their score using the documented GMDB leaderboard submission endpoint. Use the HTTP request function in GameMaker to make the request.
Step 3: Request the leaderboard
GameMaker can make an asynchronous HTTP request to the public leaderboard endpoint. The following example demonstrates the request-and-response pattern. Replace the URL with the documented leaderboard URL and query parameters for your project.
Controller object — Create Event
leaderboard_request = -1;
leaderboard_json = "";
// Replace with your project-specific URL from GMDB docs.
var _url = "https://www.gmdb.co.uk/data/get_leaderboard.php";
leaderboard_request = http_get(_url);Controller object — Async HTTP Event
if (async_load[? "id"] == leaderboard_request) {
if (async_load[? "status"] == 0) {
leaderboard_json = async_load[? "result"];
show_debug_message(leaderboard_json);
// Parse the returned JSON using json_parse() after
// confirming the response structure in the docs.
} else {
show_debug_message("Leaderboard request failed");
}
}The request above is an illustration of GameMaker HTTP handling, not a complete configured GMDB integration. A real request needs the correct project details and any required parameters.
Step 4: Display the scores
Parse the documented JSON response using json_parse(), iterate over the returned scores, and draw each player name and score in your leaderboard interface.
Common problems
- Empty leaderboard: confirm your project identifier and that scores have been submitted.
- HTTP error: check the full URL, request method and authentication.
- Unexpected JSON: log the raw response before attempting to parse it.
Build it faster with GMDB
GMDB provides hosted online services for GameMaker projects. Create a free account, configure your project, and follow the service documentation to connect your game.
Open GMDB dashboard