Leono Games is a mobile-first portal for HTML5 games that play instantly in the browser. Players jump in with a guest account, compete on daily, weekly and all-time leaderboards, and watch ads between rounds or in exchange for in-game rewards. These docs are for studios and developers who want to bring their games to the portal: how to use the SDK, what a game must do, how to test it, and how to submit and release it.
You don't need to know what the portal is built with. Your game only has to be a static bundle (HTML, JS, assets) that loads one SDK file and calls a few functions at the right moments.
How a game runs on the portal
- A separate origin for games. Your bundle is served from the games origin
https://games.leonogames.com, separate from the portal originhttps://leonogames.com. Every version lives at a fixed path,/<slug>/<version>/. - The iframe is created only when the player hits Play. The portal first creates a play session for the player, then builds an
<iframe>pointing to yourindex.htmlwith the query?wsg=1&host=<portal origin>&lang=<vi|en>&v=<version>. - The SDK is the bridge. Your game loads
/sdk/v1/wsg-sdk.js, which also lives on the games origin. When you callWSG.init(), the SDK reads that query, performs a handshake with the portal page overpostMessage, and from then on every feature (player, scores, leaderboards, ads, saved data, sharing) goes through that channel. - Games never call the portal API. The portal page receives requests from your game, calls the API on its behalf and sends the result back. The player cookie, the play session and the anti-cheat rules all stay on the portal side; your game never sees or manages them.
- It runs anywhere. Open your game directly, outside the portal iframe, and the SDK switches to
standalonemode: every API still returns valid results, backed bylocalStorage. You can build and test the game without the portal.
Player's browser
│
├─ Portal page (https://leonogames.com)
│ ├─ calls the portal API: sessions, scores, leaderboards, saved data
│ ├─ shows the loading, pause and ad overlays
│ └─ <iframe sandbox> → https://games.leonogames.com/<slug>/<version>/index.html?wsg=1&host=…
│ │
│ │ two-way postMessage, each side checks the other's origin
│ ▼
└─ Your game (games origin)
├─ index.html, JS, assets — loaded with relative paths
└─ <script src="/sdk/v1/wsg-sdk.js"> → window.WSGWhat you need to do
- Load the SDK and initialize it. Add the script tag and call
await WSG.init({ gameId }). See Quick start. - Report the lifecycle. Call
WSG.loadingFinished()when the game is ready (that is when the portal removes its loading overlay),WSG.gameplayStart()when the player takes control andWSG.gameplayStop()when the round ends. - Submit scores. Call
WSG.leaderboard.submit(score)at the end of a round and declare sensiblelimitsingame.json, because the server uses them to reject cheated scores. See Scores and leaderboards. - Listen to the portal. Stop your loop and mute audio on the
pauseandaudio(false)events, and continue onresume. Show ads at sensible moments. See Ads. - Package and submit. The bundle needs
index.htmlat its root, relative paths, and no requests to other origins. Test it in standalone mode, then send a submission withgame.json,thumbnail.pngand your build folder. See Game requirements and Submitting and publishing.
Things worth knowing early
- Scores only count inside gameplay. The server accepts a score while gameplay is running or within 10 seconds after
gameplayStop(), and checks it against your game'slimits: maximum score, minimum play time and maximum scoring rate. - Scores are non-negative integers. Fractions and negative numbers are rejected with the reason
invalid_score. - The games origin is shared by every game.
localStorage, IndexedDB and cookies on it are visible to other games, so don't keep important data there. UseWSG.storage, which is stored per player and per game. - The iframe is sandboxed. It cannot open popups, navigate the parent page, or show
alert()orconfirm(). - SDK updates need no rebuild. The SDK file lives under a major-version path (
/sdk/v1/). Within a major version the SDK stays backward compatible and the portal rolls out fixes for you.
Docs pages
- Quick startTwo ways to begin — add the SDK to an existing HTML5 game built with any engine, or start a new game from the internal Phaser template.
- SDK referenceEvery API of SDK v1 — TypeScript signatures, behavior on the portal and in standalone mode, limits, events and error codes.
- game.jsonThe game manifest reference — every field, its type, default and constraints, the valid categories and tags, and how to choose limits.
- Game requirementsRules for the bundle, network, data, iframe behavior, display, loading, audio and pausing, plus a checklist before you submit.
- Scores and leaderboardsThe score submission flow, leaderboard periods, player XP, the anti-cheat rules in order, tips for choosing limits, and player authentication with JWT.
- AdsInterstitial and rewarded ads — when to show them, the cooldown, handling reasons, pausing and muting, and rewarding only when the player watched to the end.
- Engines and frameworksIntegrate the SDK from Phaser or plain canvas JavaScript, and call it from Unity WebGL, Construct and Godot through a JavaScript bridge.
- TestingRun your game in standalone mode, mirror the production layout on your machine, run it on the portal, and use test hooks, the conformance game and a Playwright smoke test.
- Submitting and publishingWhat goes into a submission, how games are stored on R2 and served, caching, versions, the review process, and the wsg commands for internal teams.
- Bridge protocolThe low-level postMessage protocol between a game and the portal, for when you can't use the SDK file — envelope, requests, events, origin checks, timeouts and error codes.
- FAQCommon integration problems and how to fix them — falling back to standalone, calling before init, CSP blocking embeds, mixed content, audio, rejected scores.
Addresses for this environment
Addresses in these docs are filled in for the environment you are reading them on:
| Component | Address |
|---|---|
| Portal (website) | https://leonogames.com |
| Games origin | https://games.leonogames.com |
| SDK file | https://games.leonogames.com/sdk/v1/wsg-sdk.js |
| Portal API | https://api.leonogames.com |
| JWT public keys (JWKS) | https://api.leonogames.com/.well-known/jwks.json |
