GameMaker (beta)
Beta: not verified with a real GameMaker export yet. The package's files match the format GameMaker 2024 writes (checked against official YoYo Games packages), and the extension is tested against the real JavaScript SDK with a stand-in for GameMaker's runner, but no GameMaker build made with it has been checked end to end. If something does not work, tell us in the Support chat in your dashboard or at hello@gamealia.app: include your GameMaker version (Help > About), the target (HTML5 or GX.games) and what you expected to happen.
The Gamealia extension adds gamealia_* functions to your project for the HTML5 and GX.games targets. It loads the JavaScript SDK itself (its code injection adds the SDK tag to the exported page, and the extension loads it if the tag is missing), and answers through Async - Social events, as GameMaker's own social and store functions do. It comes with obj_gamealia, a persistent object that starts the SDK, calls gamealia_loading_stop() and mutes the game's audio while the portal asks it to. For other targets the functions are not exported: keep Gamealia calls in the HTML5 build.
Install
- Download gamealia.yymps (GameMaker 2024 or newer).
- In GameMaker: Tools > Import Local Package, pick
gamealia.yympsand Add All, then Import. You get the Gamealia extension, obj_gamealia and obj_gamealia_demo (an optional example: a rewarded ad and a cloud save; delete it when you no longer need it). - Put obj_gamealia in your first room. It is persistent, so one instance lives through every room.
The AI assistant tools (gamealia init in the CLI, or the MCP server) detect a GameMaker project (.yyp) and print these steps; they never edit GameMaker files.
Minimal flow
obj_gamealia already calls gamealia_init() and, when the SDK answers, gamealia_loading_stop(). In your own objects:
// When a round starts (and again after a pause menu or an ad)
gamealia_gameplay_start();
// Game over / level end / pause menu
gamealia_gameplay_stop();
// At a natural break (between levels): play resumes in the gamealia_ad event
gamealia_gameplay_stop();
gamealia_ad_midgame();
// "Watch an ad for +10 coins"
reward_request = gamealia_ad_rewarded();
Results arrive in the Async - Social event of every object that has one:
// Async - Social event
switch (async_load[? "type"]) {
case "gamealia_ad":
if (async_load[? "request"] == reward_request && async_load[? "rewarded"] == 1) coins += 10;
gamealia_gameplay_start();
break;
case "gamealia_locale_change":
scr_set_language(async_load[? "locale"]);
break;
}
Show your texts in gamealia_locale() ("en", "es", "pt-BR", ...: use your closest language) and follow gamealia_locale_change. Give a reward only when rewarded is 1.
obj_gamealia settings
Set them in the object's Create event, or as Variable Definitions on the instance in the room:
| Variable | Default | What it does |
|---|---|---|
manual_loading_stop | false | true: call gamealia_loading_stop() yourself once the game is playable (after your own loading screen). |
auto_mute | true | The portal's mute (during ads, the player's mute button) sets audio_master_gain(0) and back. |
auto_pause | true | global.gamealia_paused follows the portal's pause and resume: check it in your Step events. |
It also keeps global.gamealia_locale up to date.
Functions and events
Functions marked "request id" start a request and return its id at once; the answer is the Async - Social event in the second table, with async_load[? "request"] equal to that id and async_load[? "error"] empty when it worked. Booleans are 1 or 0; lists and objects are JSON strings (json_parse them).
| Function | Returns | What it does |
|---|---|---|
gamealia_init() | request id | Loads the SDK if the page does not have it and starts it. Answers with gamealia_init (environment, locale, device, ...). Call once, in the first room (obj_gamealia does it). |
gamealia_is_ready() | real | 1 after gamealia_init answered. |
gamealia_environment() | string | "gamealia" on the portal, "mock" when testing locally, "" before init. |
gamealia_locale() | string | The portal language ("en", "es", "pt-BR", ...). Follow it, and gamealia_locale_change. |
gamealia_device() | string | "desktop", "mobile" or "tablet". |
gamealia_device_class() | string | "mobile", "tablet" or "desktop" |
gamealia_is_mobile() | real | 1 on phones and tablets. |
gamealia_country() | string | Two-letter country code, or "". |
gamealia_app() | string | "android" or "ios" inside the Gamealia app, "" in a browser. |
gamealia_game_id() | string | The game's id on Gamealia. |
gamealia_os_name() | string | "Windows", "Mac OS", "iOS", "Android", "Chrome OS", "Linux" or "unknown". |
gamealia_os_version() | string | The OS major version ("17"), or "". |
gamealia_browser_name() | string | "Chrome", "Edge", "Firefox", "Safari", "Mobile Safari", "Opera", "Samsung Browser", "Yandex" or "unknown". |
gamealia_browser_version() | string | The browser major version ("120"), or "". |
gamealia_init_json() | string | The whole init() result as JSON (json_parse it): joinParams, instantMultiplayer, chatOff, user and the rest. |
gamealia_loading_start() | real | Loading started (optional). |
gamealia_loading_stop() | real | The game is playable (required once; obj_gamealia calls it unless manual_loading_stop is true). |
gamealia_gameplay_start() | real | Play started or resumed (required). |
gamealia_gameplay_stop() | real | Play stopped: game over, menu, pause, level end (required). |
gamealia_happy_time() | real | A moment of joy (level cleared, record). |
gamealia_set_progress(percent) | real | Progress through the game, 0-100. |
gamealia_set_context(json) | real | Where the player is, as a JSON object string ({"level":3}); "" clears it. |
gamealia_report_error(message) | real | Report a handled error to the developer dashboard. |
gamealia_track(category, what, action) | real | Analytics event: category, what, action ("" when none). |
gamealia_ad_midgame() | request id | Midgame ad at a natural break. Answers with gamealia_ad (kind "midgame", shown, reason). |
gamealia_ad_rewarded() | request id | Rewarded ad. Answers with gamealia_ad (kind "rewarded", shown, rewarded, reason): give the reward only when rewarded is 1. |
gamealia_ad_check_adblock() | request id | Answers with gamealia_adblock (adblock 0/1). |
gamealia_ad_request_banner(id, size, anchor_x, anchor_y, pos_x, pos_y) | request id | In-game banner drawn by the portal over the game (menus, level end; never during play). size "728x90", "300x250", "320x50", "468x60" or "320x100"; the point anchor_x/anchor_y of the banner (0..1) goes to pos_x/pos_y of the game screen (0..1, y from the top). Answers with gamealia_banner (id, ok, reason, size). Banners show once ads are live on Gamealia: until then ok is 0 and reason "not-live". |
gamealia_ad_request_responsive_banner(id, anchor_x, anchor_y, pos_x, pos_y, max_width, max_height) | request id | Like gamealia_ad_request_banner with the largest standard size that fits max_width x max_height px (0 = the whole screen). Answers with gamealia_banner. |
gamealia_ad_clear_banner(id) | real | Removes the banner (before play starts again). |
gamealia_ad_clear_all_banners() | real | Removes every banner. |
gamealia_ad_playing() | real | 1 while an ad plays (between gamealia_ad_start and gamealia_ad_end). |
gamealia_user_get() | request id | Reads the signed-in player again. Answers with gamealia_user. |
gamealia_user_signed_in() | real | 1 when the player has a Gamealia account and is signed in. |
gamealia_user_id() | string | The player's id, or "". |
gamealia_user_name() | string | The player's username, or "". |
gamealia_user_avatar() | string | The player's avatar URL, or "". |
gamealia_user_token() | request id | Signed token for your own server. Answers with gamealia_token (token, "" when signed out). |
gamealia_user_login() | request id | Opens the portal's sign-in. Answers with gamealia_user. |
gamealia_data_load() | request id | Loads the saved data (cloud when signed in, local otherwise). Answers with gamealia_data (ok, json); then read keys with gamealia_data_get. |
gamealia_data_get(key) | string | A saved value from the last load/set: strings as they are, numbers and objects as JSON, "" when missing. |
gamealia_data_get_number(key) | real | A saved number, 0 when missing or not a number. |
gamealia_data_has(key) | real | 1 when the key is saved. |
gamealia_data_set(key, text) | real | Saves a string value. |
gamealia_data_set_number(key, value) | real | Saves a number. |
gamealia_data_set_json(key, json) | real | Saves a JSON value (json_stringify of a struct or array). |
gamealia_data_remove(key) | real | Deletes a key. |
gamealia_data_clear() | real | Deletes every key. |
gamealia_room_join_code() | string | The room an invite link asks to join, or "". |
gamealia_room_join_key() | string | The private key of that invite, or "". |
gamealia_room_publish(json) | real | Lists the player's room: JSON {code, name, players, max, inProgress, visibility}. |
gamealia_room_unpublish() | real | Removes the listed room. |
gamealia_room_invite_link(code) | request id | Answers with gamealia_invite_link (link). |
gamealia_room_show_invite(code) | real | Opens the portal's invite dialog for a room code. |
gamealia_room_join_pass(code) | request id | Proof of the invite for your server ("" for the current invite). Answers with gamealia_join_pass (pass). |
gamealia_room_join_failed(reason, code) | real | Tell the portal a join failed: reason ("wrong-key", "full", "closed", "in-progress") and code ("" for the current one). |
gamealia_presence_set(text) | real | What the player is doing, shown to friends. |
gamealia_friends_list() | request id | Answers with gamealia_friends (ok, count, json: the array of friends). |
gamealia_friends_invite(friend_id, code) | request id | Invites a friend id to a room code. Answers with gamealia_friend_invite (delivered). |
gamealia_leaderboard_submit(board, value) | request id | Submits a score to a board. Answers with gamealia_score (ok, best, rank). |
gamealia_leaderboard_get(board, options_json) | request id | Board id and options JSON ({"scope":"global","season":"current","limit":10}; scope global/country/friends, season current/all; or ""). Answers with gamealia_leaderboard (json, total). |
gamealia_leaderboard_show(board) | real | Opens the portal's leaderboard ("" for the default board). |
async_load[? "type"] | Fields |
|---|---|
gamealia_locale_change | locale |
gamealia_ad_start | - |
gamealia_ad_end | - |
gamealia_pause | - |
gamealia_resume | - |
gamealia_mute | - |
gamealia_unmute | - |
gamealia_user_change | signed_in, id, username |
gamealia_room_join | code, key |
gamealia_friends_change | - |
JavaScript-only features
Chat, store and the other extras of the SDK reference have no GML functions. To use them, add your own JavaScript file to the extension (or a second extension) and call window.Gamealia.chat.* / window.Gamealia.store.* from it; send results back with GMS_API.send_async_event_social({ type: "my_event", ... }).
Export
- Pick the HTML5 target (or GX.games) and Build > Create Executable, as a zip or a folder.
- Upload that folder, with
index.htmlat its root (or the zip as it is). - Keep the export's own files:
html5game/(the runner script,gamealia_gm.jsand your assets). Do not replaceindex.htmlwith a custom page unless it keeps the Gamealia script tag; if you use an included file as the page, add<script src="https://gamealia.app/sdk/v1.js"></script>to its head.
Already use another portal's GameMaker extension?
Remove it (or leave it out of the HTML5 build) and move its calls to the Gamealia ones: loading done, gameplay start and stop, midgame and rewarded ads, with the results read in the Async - Social event. If that extension's SDK was loaded from a script tag in a custom index.html, our compatibility shim can take its place, as the migration guides explain.
Common autotest failures
gameplay_start/gameplay_stop: nogamealia_gameplay_start()/gamealia_gameplay_stop()calls.loading_stop: obj_gamealia is not in the first room, ormanual_loading_stopis true and the call is never reached.sdk_loaded: the build was made before the extension was imported, or a customindex.htmldropped the SDK tag. Build again.translations: texts set once fromgamealia_locale()without handlinggamealia_locale_change.
Problems or questions: the Support chat in your dashboard, or hello@gamealia.app (Support).