Skip to content
Docs pages

Developers · Guides

Game requirements

Rules for the bundle, network, data, iframe behavior, display, loading, audio and pausing, plus a checklist before you submit.

On this page

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:

Build folder
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, set base: './'; 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.html at most 200 KB. wsg build warns 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-Type from 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 as application/octet-stream. The games origin doesn't add a Content-Encoding header, so don't submit pre-compressed .br or .gz files 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, sessionStorage and 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:

HTML
<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() and target="_blank" links open nothing. Use WSG.share() for sharing.
  • No navigating the parent page: setting window.top.location is blocked. Don't touch window.top or window.parent; everything goes through the SDK.
  • No system dialogs: alert(), confirm() and prompt() 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 wsg and host query 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 resize event.
  • No page scrolling, no text selection, no zooming. Use this meta tag and CSS:
HTML
<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 call loadingFinished() 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() your AudioContext right inside the tap handler.
  • Mute on audio(false) or pause; unmute on audio(true) or resume, 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/resume in standalone mode too.

No console errors

The normal play flow must not log any errors to the console. Common culprits:

  • favicon.ico 404: 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 an https:// page (mixed content).

Checklist before you submit

  • index.html at 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.html at 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.
  • limits derived from the design; the in-game score never goes above maxScore.
  • Stop and mute on pause or audio(false); continue on resume.
  • Rewarded ads only reward when rewarded === true; interstitials cope with cooldown.
  • Data worth keeping goes to WSG.storage; no cookies; localStorage only 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.png is 512×512 and at most 150 KB; game.json passes wsg validate.
  • Test hooks on window.__WSG_TEST__ (recommended, see Testing).