GMBK Creators

GMBK SDK

A tiny script that connects your HTML5 game to GMBK: cloud saves, scores, haptics and pause handling. Inside the app it's injected automatically; include the file so your game also runs in a normal browser while you build it, where it falls back to localStorage.

Download gmbk-sdk.js

Quick start

<script src="gmbk-sdk.js"></script>
<script>
  let progress = { level: 1, best: 0 };

  GMBK.load().then((saved) => {
    if (saved) progress = saved;
    startLevel(progress.level);
    GMBK.ready();
  });

  function onPoints(score) {
    GMBK.setScore(score);           // live score (Daily leaderboard)
  }

  function onLevelComplete(score) {
    progress.level += 1;
    progress.best = Math.max(progress.best, score);
    GMBK.save(progress);
    GMBK.reportScore(score);
  }

  GMBK.onPause(() => music.pause());
  GMBK.onResume(() => music.play());
</script>

API

GMBK.ready()
Call once your game is loaded and playable. GMBK hides its loading screen.
await GMBK.load()
Returns this player’s saved progress, or null. Signed-out players get whatever they saved this session.
await GMBK.save(data)
Saves any JSON value (max 256 KB). Resolves { persisted }: false when the player is signed out (GMBK asks them to sign in). Call it at checkpoints, not every frame; writes are throttled.
await GMBK.clearSave()
Deletes this player’s save for your game.
GMBK.reportScore(n)
Records a score for leaderboards and your analytics.
GMBK.setScore(n)
The current score while a run is in progress. Call it every time the score changes; it’s cheap. It drives the score display and live leaderboard when your game is picked for the Daily.
GMBK.gameOver({ score })
Marks the end of a run. In the Daily, this ends the player’s attempt, so call it exactly when the run is really over.
GMBK.haptic('light')
Device haptics: 'light' | 'medium' | 'heavy' | 'success' | 'error'.
GMBK.onPause(fn) / GMBK.onResume(fn)
Called when the player pulls out the GMBK tab or scrolls away. GMBK already freezes requestAnimationFrame, WebAudio and media while paused; use these for timers or anything else.
GMBK.onUser(fn)
Receives { signedIn, displayName } now and whenever it changes.
GMBK.inApp
true inside the GMBK app, false when testing in a normal browser.

Supported engines

GMBK runs any game that builds for the web (HTML5 + WebAssembly), which covers nearly every engine. Upload the engine's web export folder as a zip; precompressed builds (.br / .gz) are served with the right headers, and threaded builds get cross-origin isolation for SharedArrayBuffer.

Unity
Build Settings → WebGL. Brotli, Gzip or uncompressed all work. Call the SDK via a .jslib plugin.
Godot
Export → Web. Godot 4 single-threaded and threaded exports both work; .pck files are supported.
GameMaker
Target HTML5 (or GX.games/WASM). Zip the output folder.
Defold
Project → Bundle → HTML5.
Construct 3
Export → Web (HTML5). Disable offline/service-worker support.
Phaser, PixiJS, Three.js, Babylon.js
Ship your production build folder with index.html at the top.
PICO-8
export mygame.html, then zip the .html and .js.
C, C++, Rust (Emscripten / wasm-bindgen)
Compile to WebAssembly with an HTML shell page.

Bundle rules

How games get reviewed

Every upload is scanned automatically. Clean games go live immediately. Uploads that trip a rule (external scripts, obfuscated code, credential prompts) are held for a person to review, and players can report games from the Info screen; enough reports send a game back to review.