These requirements keep your game running well on every device, loading quickly and not interfering with other games on the same origin. Most of them are checked automatically by wsg validate and wsg build at release time; the operations team checks the rest during review.
Bundle structure
A bundle is a static folder with index.html at its root:
dist/
├─ index.html required, at the root of the build folder
├─ game.js
├─ assets/
│ ├─ sprites.webp
│ └─ music.ogg
└─ ...- Relative paths. The bundle is served under
https://games.leonogames.com/<slug>/<version>/, so every file must be loaded with a relative path (./game.js,assets/music.ogg), never with an absolute one such as/assets/.... With Vite, setbase: './'; with other bundlers, set the public path to empty or./. - The only exception is the SDK file, loaded from the root path
/sdk/v1/wsg-sdk.js. - Size: at most 20 MB and 300 files in total;
index.htmlat most 200 KB.wsg buildwarns when the bundle passes 3 MB; aim for less than 3 MB so it loads quickly on 4G. - File types. The games origin sets
Content-Typefrom the file extension: HTML, JS, CSS, JSON, images (png,jpg,webp,avif,gif,svg), audio (mp3,ogg,m4a,wav), video (mp4,webm), fonts (woff2,woff,ttf,otf),wasm(application/wasm) and a few engine formats (atlas,fnt,glsl,bin). Other extensions are served asapplication/octet-stream. The games origin doesn't add aContent-Encodingheader, so don't submit pre-compressed.bror.gzfiles that expect the browser to decompress them. - Immutable. A released version never changes and is cached for a year. To fix a bug, release a new version.
No requests to other origins
Your game may only load resources from its own bundle and the SDK file. Fonts, CDN libraries, analytics, third-party ad SDKs, remote config… must all be bundled or removed.
wsg build scans index.html and every .js file for http:// or https:// URLs outside the games origin and the SDK, and reports them as warnings (--strict turns them into errors). URL strings that are never requested (XML namespaces, library banners) are listed too; the operations team reviews each case.
Note
A game that needs its own server (multiplayer, its own cloud saves) must agree on it with the operations team first. That server must enable CORS for the https://games.leonogames.com origin and authenticate players with the portal's token. See Player authentication.
Player data
- Data you need to keep (records, progress, settings) belongs in
WSG.storage: it is tied to the player and to your game, up to 100 KB. - The games origin is shared by every game.
localStorage,sessionStorageand IndexedDB on it can be read and written by other games, and the browser may clear them. Use them only as a cache, with keys prefixed by your slug (tap-rush:cache). - Don't use
document.cookie.
Behavior inside the iframe
The portal embeds your game with these attributes:
<iframe
src="https://games.leonogames.com/<slug>/<version>/index.html?wsg=1&host=<portal origin>&lang=<vi|en>&v=<version>"
sandbox="allow-scripts allow-same-origin allow-pointer-lock allow-forms"
allow="autoplay; fullscreen; gamepad; clipboard-write; accelerometer; gyroscope"
referrerpolicy="strict-origin"
></iframe>What that means for your game:
- No popups:
window.open()andtarget="_blank"links open nothing. UseWSG.share()for sharing. - No navigating the parent page: setting
window.top.locationis blocked. Don't touchwindow.toporwindow.parent; everything goes through the SDK. - No system dialogs:
alert(),confirm()andprompt()don't show. Draw your own dialogs in the game. - No downloads, no orientation lock (
screen.orientation.lock()fails), no camera, microphone or location. - Allowed: fullscreen, gamepads, motion sensors, clipboard writes, pointer lock, forms.
- Keep the URL. Don't redirect to another page inside your bundle: the
wsgandhostquery parameters would be lost and the SDK would fall back to standalone.
The iframe frame on the portal follows the orientation in game.json: portrait is 9:16, landscape is 16:9, and any fills the play area. On phones the portal offers a "Fullscreen" button for the play area.
Display and controls
- Work well in any frame from 320×568 to 1920×1080 and when the frame changes size (device rotation, entering fullscreen). Listen to the
resizeevent. - No page scrolling, no text selection, no zooming. Use this meta tag and CSS:
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover"
/>
<style>
html,
body {
margin: 0;
height: 100%;
overflow: hidden;
touch-action: none;
user-select: none;
-webkit-user-select: none;
}
</style>- Respect the safe area (notches, navigation bars) with
env(safe-area-inset-top),env(safe-area-inset-bottom)…, especially when the game runs fullscreen. Keep important buttons away from the edges. - Support every control type you declare in
controls. Touch targets should be at least about 44 px. - In-game text follows
WSG.getLocale(); the portal currently offers Vietnamese and English.
Load fast
- Reach the menu within 3 seconds on a 4G connection. Report progress with
loadingProgress()and callloadingFinished()when ready; the portal hides the game behind its loading overlay until then (for at most 30 seconds). - Keep the bundle small: compress images (WebP), keep audio short and compressed (OGG, M4A, MP3), and load later levels on demand instead of everything up front.
- Don't block the main thread for long at startup; cap
devicePixelRatio(for example at 2) so low-end devices stay smooth.
Audio
- Only play audio after the player's first tap or click (iOS and browser autoplay policies). Create or
resume()yourAudioContextright inside the tap handler. - Mute on
audio(false)orpause; unmute onaudio(true)orresume, while still respecting the player's own mute choice. - Provide an in-game mute button and save the choice with
WSG.storage.
Pausing
- On
pause(tab hidden, an ad is coming, the portal opens the leaderboard): stop the game loop, clocks, physics and timers, and mute. - On
resume: continue without counting the time spent paused. For fast-paced games, consider showing a "Tap to continue" screen instead of resuming instantly. - Test it by switching tabs: the SDK emits
pause/resumein standalone mode too.
No console errors
The normal play flow must not log any errors to the console. Common culprits:
favicon.ico404: add<link rel="icon" href="data:," />to your<head>.- Asset 404s caused by absolute paths or wrong letter case (the games origin is case-sensitive).
- Unhandled Promise rejections, for example
WSG.storage.set()going over the limit. http://resources blocked on anhttps://page (mixed content).
Checklist before you submit
-
index.htmlat the root of the build folder; every path relative; the SDK loaded from/sdk/v1/wsg-sdk.js. - No requests to any other origin.
- Bundle at most 20 MB (ideally under 3 MB), at most 300 files,
index.htmlat most 200 KB. -
await WSG.init({ gameId: '<slug>' })before any other call. -
loadingFinished()when the menu appears; the menu appears within 3 seconds on 4G. -
gameplayStart()when the player takes control,gameplayStop()when the round ends; the score is submitted within 10 seconds after that and is a non-negative integer. -
limitsderived from the design; the in-game score never goes abovemaxScore. - Stop and mute on
pauseoraudio(false); continue onresume. - Rewarded ads only reward when
rewarded === true; interstitials cope withcooldown. - Data worth keeping goes to
WSG.storage; no cookies;localStorageonly as a cache with slug-prefixed keys. - No popups, no
alert(), no navigating the parent page, no redirecting to another URL. - Works from 320×568 to 1920×1080, in the declared
orientation, without scrolling or zooming, respecting the safe area. - Audio only plays after the first tap.
- No console errors in normal play (check in standalone mode).
-
thumbnail.pngis 512×512 and at most 150 KB;game.jsonpasseswsg validate. - Test hooks on
window.__WSG_TEST__(recommended, see Testing).
