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

  1. Download gamealia.yymps (GameMaker 2024 or newer).
  2. In GameMaker: Tools > Import Local Package, pick gamealia.yymps and 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).
  3. 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:

VariableDefaultWhat it does
manual_loading_stopfalsetrue: call gamealia_loading_stop() yourself once the game is playable (after your own loading screen).
auto_mutetrueThe portal's mute (during ads, the player's mute button) sets audio_master_gain(0) and back.
auto_pausetrueglobal.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).

FunctionReturnsWhat it does
gamealia_init()request idLoads 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()real1 after gamealia_init answered.
gamealia_environment()string"gamealia" on the portal, "mock" when testing locally, "" before init.
gamealia_locale()stringThe 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()real1 on phones and tablets.
gamealia_country()stringTwo-letter country code, or "".
gamealia_app()string"android" or "ios" inside the Gamealia app, "" in a browser.
gamealia_game_id()stringThe game's id on Gamealia.
gamealia_os_name()string"Windows", "Mac OS", "iOS", "Android", "Chrome OS", "Linux" or "unknown".
gamealia_os_version()stringThe OS major version ("17"), or "".
gamealia_browser_name()string"Chrome", "Edge", "Firefox", "Safari", "Mobile Safari", "Opera", "Samsung Browser", "Yandex" or "unknown".
gamealia_browser_version()stringThe browser major version ("120"), or "".
gamealia_init_json()stringThe whole init() result as JSON (json_parse it): joinParams, instantMultiplayer, chatOff, user and the rest.
gamealia_loading_start()realLoading started (optional).
gamealia_loading_stop()realThe game is playable (required once; obj_gamealia calls it unless manual_loading_stop is true).
gamealia_gameplay_start()realPlay started or resumed (required).
gamealia_gameplay_stop()realPlay stopped: game over, menu, pause, level end (required).
gamealia_happy_time()realA moment of joy (level cleared, record).
gamealia_set_progress(percent)realProgress through the game, 0-100.
gamealia_set_context(json)realWhere the player is, as a JSON object string ({"level":3}); "" clears it.
gamealia_report_error(message)realReport a handled error to the developer dashboard.
gamealia_track(category, what, action)realAnalytics event: category, what, action ("" when none).
gamealia_ad_midgame()request idMidgame ad at a natural break. Answers with gamealia_ad (kind "midgame", shown, reason).
gamealia_ad_rewarded()request idRewarded ad. Answers with gamealia_ad (kind "rewarded", shown, rewarded, reason): give the reward only when rewarded is 1.
gamealia_ad_check_adblock()request idAnswers with gamealia_adblock (adblock 0/1).
gamealia_ad_request_banner(id, size, anchor_x, anchor_y, pos_x, pos_y)request idIn-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 idLike 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)realRemoves the banner (before play starts again).
gamealia_ad_clear_all_banners()realRemoves every banner.
gamealia_ad_playing()real1 while an ad plays (between gamealia_ad_start and gamealia_ad_end).
gamealia_user_get()request idReads the signed-in player again. Answers with gamealia_user.
gamealia_user_signed_in()real1 when the player has a Gamealia account and is signed in.
gamealia_user_id()stringThe player's id, or "".
gamealia_user_name()stringThe player's username, or "".
gamealia_user_avatar()stringThe player's avatar URL, or "".
gamealia_user_token()request idSigned token for your own server. Answers with gamealia_token (token, "" when signed out).
gamealia_user_login()request idOpens the portal's sign-in. Answers with gamealia_user.
gamealia_data_load()request idLoads 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)stringA saved value from the last load/set: strings as they are, numbers and objects as JSON, "" when missing.
gamealia_data_get_number(key)realA saved number, 0 when missing or not a number.
gamealia_data_has(key)real1 when the key is saved.
gamealia_data_set(key, text)realSaves a string value.
gamealia_data_set_number(key, value)realSaves a number.
gamealia_data_set_json(key, json)realSaves a JSON value (json_stringify of a struct or array).
gamealia_data_remove(key)realDeletes a key.
gamealia_data_clear()realDeletes every key.
gamealia_room_join_code()stringThe room an invite link asks to join, or "".
gamealia_room_join_key()stringThe private key of that invite, or "".
gamealia_room_publish(json)realLists the player's room: JSON {code, name, players, max, inProgress, visibility}.
gamealia_room_unpublish()realRemoves the listed room.
gamealia_room_invite_link(code)request idAnswers with gamealia_invite_link (link).
gamealia_room_show_invite(code)realOpens the portal's invite dialog for a room code.
gamealia_room_join_pass(code)request idProof of the invite for your server ("" for the current invite). Answers with gamealia_join_pass (pass).
gamealia_room_join_failed(reason, code)realTell the portal a join failed: reason ("wrong-key", "full", "closed", "in-progress") and code ("" for the current one).
gamealia_presence_set(text)realWhat the player is doing, shown to friends.
gamealia_friends_list()request idAnswers with gamealia_friends (ok, count, json: the array of friends).
gamealia_friends_invite(friend_id, code)request idInvites a friend id to a room code. Answers with gamealia_friend_invite (delivered).
gamealia_leaderboard_submit(board, value)request idSubmits a score to a board. Answers with gamealia_score (ok, best, rank).
gamealia_leaderboard_get(board, options_json)request idBoard 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)realOpens the portal's leaderboard ("" for the default board).
async_load[? "type"]Fields
gamealia_locale_changelocale
gamealia_ad_start-
gamealia_ad_end-
gamealia_pause-
gamealia_resume-
gamealia_mute-
gamealia_unmute-
gamealia_user_changesigned_in, id, username
gamealia_room_joincode, 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

  1. Pick the HTML5 target (or GX.games) and Build > Create Executable, as a zip or a folder.
  2. Upload that folder, with index.html at its root (or the zip as it is).
  3. Keep the export's own files: html5game/ (the runner script, gamealia_gm.js and your assets). Do not replace index.html with 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: no gamealia_gameplay_start() / gamealia_gameplay_stop() calls.
  • loading_stop: obj_gamealia is not in the first room, or manual_loading_stop is true and the call is never reached.
  • sdk_loaded: the build was made before the extension was imported, or a custom index.html dropped the SDK tag. Build again.
  • translations: texts set once from gamealia_locale() without handling gamealia_locale_change.

Problems or questions: the Support chat in your dashboard, or hello@gamealia.app (Support).