GMDB
Free GameMaker tutorial

GameMaker Cloud Save PHP Tutorial

Save player progress online instead of relying only on local save files. Learn the basic GameMaker-to-PHP flow and how GMDB simplifies cloud storage.

Get started freeRead GMDB documentation

How GameMaker cloud saves work

Your GameMaker game creates save data, sends it over HTTPS to a server, and retrieves it when the player returns. A PHP backend can validate requests and store data in MySQL. GMDB offers a hosted cloud-save service so you do not need to build the entire backend yourself.

Step 1: Prepare your player data

Store values such as level, coins and progress in a GML struct. Encode the struct as JSON before sending it to your cloud-save endpoint.

var _save = {
    level: 3,
    coins: 120,
    checkpoint: "forest"
};
var _json = json_stringify(_save);
show_debug_message(_json);

Step 2: Authenticate the player

GMDB cloud saves use an authenticated request. Obtain the player access token through the documented login flow, then send the token in the Authorization: Bearer header. Do not place your database password or administrative API secret in a distributed game.

Step 3: Send a save request

The example below shows how to construct a JSON POST with an authorization header. Adjust the request body to match the current GMDB cloud-save documentation.

// _token must be a valid player access token.
// _json must match the current GMDB save schema.
var _headers = ds_map_create();
ds_map_add(_headers, "Content-Type", "application/json");
ds_map_add(_headers, "Authorization", "Bearer " + _token);

var _url = "https://www.gmdb.co.uk/data/cloud-save.php";
var _request = http_request(_url, "POST", _headers, _json);
ds_map_destroy(_headers);

Store the returned request ID and process the response in the Async HTTP Event, just as with other GameMaker HTTP calls.

Step 4: Load and restore progress

Call the documented cloud-save retrieval operation, verify that the HTTP request succeeded, parse the JSON response, and assign validated values back to your game state. Do not assume a save exists for a new player.

Common problems

The GML snippet illustrates the HTTP mechanism. The precise GMDB save payload and retrieval operation must be taken from the live API documentation.

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

← Browse all tutorials