Getting to the first frame fast
This guide shows how to cut your game's load time so players reach gameplay before they give up. Most players who leave never saw your game, and every second before the first playable frame costs plays. Neither load time nor download size is a scored number in basic launch metrics, but both drive the scored ones: a slow start lowers conversion (the share of views that play for a minute) and play time. The upload validator also errors on an initial download above 50 MB, see build validation. Examples assume const SDK = window.ZokoGames.SDK; as in the SDK introduction; terms are in the glossary.
Set a budget#
- Initial download under 20 MB if you want mobile placement, under 50 MB at the very most. See technical requirements. "Initial download" is the files the game needs before the first frame, not the whole zip.
- Time to gameplay of about 10 seconds or less on 4G, which is what the requirements checklist asks for. This is a target a reviewer will test by eye; the portal does not measure it for you.
Measure with the browser's network panel on a cold cache and with throttling set to "Fast 4G".
Split what you load#
- Boot (a few hundred KB): a small page with your logo and a progress bar. Show it as fast as possible.
- Level 1: only what the first minute of play needs.
- Everything else: after the player is playing.
async function start() {
await SDK.init(); // never rejects; SDK.environment may be "disabled" (see below)
await SDK.game.loadingStart(); // the portal shows its thin loading bar over your game
await loadCoreAssets((done, total) => {
SDK.game.loadingProgress((done / total) * 100); // optional; fine to call often (coalesced)
}); // level 1 only
await SDK.game.loadingStop(); // removes the bar
showMainMenu(); // or go straight into play
loadRestInBackground(); // levels, music, extra skins
}loadingStart and loadingStop are optional but cheap: the portal draws a progress bar for you (indeterminate until you call loadingProgress, which takes 0 to 100). Calling gameplayStart also removes the bar. Your own loading screen is fine as well; do not show two bars.
What to expect: on the portal you see a thin bar across the top of the game area while loading. In local mode (your own localhost page) the calls resolve and nothing is drawn, so test the bar in the Preview tool. If the SDK is disabled (the page is not on localhost and not inside the portal frame) every call throws sdkDisabled; guard with if (SDK.environment !== "disabled") for standalone runs.
Cut bytes#
- Textures. Use atlases, power-of-two sizes where your engine needs them, and a compressed format (WebP, or Basis/KTX2 where supported). Halve texture sizes that are only shown small.
- Audio. Use Opus or AAC, mono for effects, and a lower bitrate for music. Stream music instead of preloading it.
- Code. Minify, tree-shake, drop unused engine modules and dependencies, and compress with Brotli or Gzip.
- Fonts. Subset to the glyphs you use.
- Video. Do not ship video intros.
Cut waiting#
- Do not make the player click through a splash screen, a language picker and a menu before they play. For full launch new players must reach gameplay in at most one click.
- Start downloading the next scene while the player reads the current one.
- Defer your own analytics and other non-essential scripts until after the first
gameplayStart. - Avoid synchronous work in the boot path; a long task freezes the progress bar and looks like a hang.
Show progress honestly#
A bar that moves smoothly is better than one that jumps. If a stage cannot report progress, animate to a stage boundary and wait there.
Check for regressions#
Re-measure on each release. A "small" new asset pack can double the initial download without anyone noticing.