Construct 3 (beta)
Beta: not verified with a real Construct export yet. The addon's files (addon.json, aces.json and the language file) are validated against Scirra's official Addon SDK v2 schemas, and the addon is tested against the real JavaScript SDK with a stand-in for Construct's runtime, but no Construct 3 export 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 Construct release (Menu > About), whether "Use worker" is on, and what you expected to happen.
The Gamealia addon is a Construct 3 plugin (Addon SDK v2) that adds a single global object, Gamealia, to your project. It loads the JavaScript SDK, runs init() before your first layout, calls loadingStop() when the first layout starts, pauses and mutes the game while the portal asks it to, and gives you actions, conditions and expressions for ads, player accounts, cloud save, rooms, friends and leaderboards. It works with the project's Use worker setting on or off.
Install
- Download the addon: gamealia.c3addon.
- In Construct 3: Menu > View > Addon manager > Install new addon..., pick
gamealia.c3addon, confirm, and restart Construct when it asks. - In your project, right-click a layout > Insert new object > Gamealia (in "Platform specific"). It is a single global object: add it once, and every event sheet can use it.
The addon adds https://gamealia.app/sdk/v1.js to the exported index.html for you (and loads it at runtime if the tag is missing). Off the portal, in Construct's preview, the SDK runs in mock mode: fake ads, a local save, nothing is sent.
Minimal flow
| When | Event |
|---|---|
| The game is loaded | nothing to do: init and Loading stop are automatic |
| Texts | Gamealia.Locale ("en", "es", "pt-BR"...), and Gamealia > On locale changed to translate again |
| Play starts (a level, a round) | Gamealia > Gameplay start |
| Play stops (game over, pause menu, level end) | Gamealia > Gameplay stop |
| A natural break | Gamealia > Request midgame ad |
| Reward button | Gamealia > Request rewarded ad; give the reward in On rewarded ad completed |
Ad actions are asynchronous: put System > Wait for previous actions to complete after them, or continue the game in On ad finished. While an ad plays the portal pauses and mutes the game.
Properties
| Property | Default | What it does |
|---|---|---|
| Manual loading stop | off | Off: Loading stop is called when the first layout starts. On: call it yourself once the game is playable (after your own loading screen). |
| Mute audio automatically | on | Silences the page's audio while the portal mutes the game (ads, the player's mute button). If a sound still plays, turn it off and use On mute / On unmute with Audio > Set silent. |
| Pause automatically | on | Sets the time scale to 0 while the portal pauses the game and restores it on resume. Off: handle On pause / On resume yourself. |
Actions, conditions and expressions
| Area | Actions | Conditions and triggers | Expressions |
|---|---|---|---|
| General | Loading start, Loading stop, Gameplay start, Gameplay stop, Happy time, Set progress, Set context, Clear context, Report error, Track event | On init, On locale changed, Is on Gamealia, Is mobile, Is instant multiplayer, Is chat off | Locale, Environment, GameId, Device, DeviceClass, Country, App, OsName, OsVersion, BrowserName, BrowserVersion, LastError |
| Ads | Request midgame ad, Request rewarded ad, Check adblock, Request banner, Request responsive banner, Clear banner, Clear all banners | On ad started, On ad ended, On ad finished, On rewarded ad completed, On rewarded ad skipped, Is ad playing, Has adblock, On banner shown, On banner failed | LastAdShown, LastAdRewarded, LastAdReason, BannerId, BannerReason, BannerSize |
| Pause and audio | On pause, On resume, On mute, On unmute, Is paused, Is muted | ||
| Player account | Request login, Refresh user, Request token | On user changed, On login finished, On token received, Is signed in | Username, UserId, AvatarUrl, Token |
| Cloud save | Load data, Set data, Set data (JSON), Remove data, Clear data | On data loaded, Has data | Data(key) |
| Rooms and invites | Publish room, Unpublish room, Show invite, Request invite link, Request join pass, Join failed, Set presence status | On room join, On invite link ready, On join pass ready, Has join code | JoinCode, JoinKey, JoinParam(name), InviteLink, JoinPass |
| Friends | Request friends list, Invite friend | On friends list ready, On friend invite sent, On friends changed, Was invite delivered | FriendCount, FriendId(i), FriendName(i), FriendAvatarUrl(i), FriendOnline(i), FriendPlaying(i), FriendRoomCode(i) |
| Leaderboards | Submit score, Get leaderboard, Show leaderboard | On score submitted, On leaderboard ready, Was score accepted | LastBest, LastRank, LeaderboardCount, LeaderboardTotal, LeaderboardName(i), LeaderboardValue(i), LeaderboardRank(i), LeaderboardIsMe(i), MyRank |
Each one maps to the JavaScript SDK call of the same name (SDK reference). A few details:
- Cloud save: run Load data once (for example in On init), then read
Gamealia.Data("key"). Numbers and texts come back as they are; arrays and objects come back as JSON (use Set data (JSON) withArray.AsJSONorDictionary.AsJSON, and Load on the Array or Dictionary to read them). - Player accounts: guests must be able to play. Request token gives a token for your own server; see Player accounts.
- Rooms: when Has join code is true at start (or in On room join), join the room
Gamealia.JoinCodein your own netcode; see Multiplayer. - Leaderboards: boards are set up in the dashboard; see Leaderboards.
- Lists (friends, leaderboard entries) are 0-based: loop with System > Repeat
FriendCounttimes and useloopindex.
JavaScript-only features
Chat, store and the other extras of the SDK reference have no actions. Call them from a script in your event sheet with Use worker set to No (Project properties > Advanced), because only then do your scripts run in the page next to globalThis.Gamealia:
const r = await globalThis.Gamealia.chat.join("global");
Export
- Menu > Project > Export > Web (HTML5).
- Unzip the export and upload that folder, with
index.htmlat its root (or zip it as it is). - Keep the export's own files:
scripts/,data.json,workermain.js, the service worker andoffline.json. Gamealia serves every version at its own URL, so offline caching cannot show an old version.
Already use another portal's Construct plugin?
If that plugin loads the other portal's SDK from a script tag in the exported index.html, our compatibility shim can take its place, as the migration guides explain. Most Construct plugins load their SDK themselves, though: then replace it with the Gamealia addon and move its events to the Gamealia ones (same idea: loading, gameplay start and stop, midgame and rewarded ads).
Common autotest failures
gameplay_start/gameplay_stop: no Gameplay start / Gameplay stop actions in your events.loading_stop: Manual loading stop is on and the action is never reached.sdk_loaded: the export was made before the addon was added, orindex.htmlwas replaced by a custom one without the SDK tag. Export again.translations: texts set once fromGamealia.Localewithout On locale changed.
Problems or questions: the Support chat in your dashboard, or hello@gamealia.app (Support).