Mobile
AI Summary
A short gist of this page, generated for you.
Powered by AI. Summaries can miss nuance — when in doubt, read the page.
A large share of players are on phones. A game that does not play well on a phone will struggle.
#Touch controls
- Provide a touch-first control scheme. Do not make the player imagine WASD on a phone.
- Touch targets should be at least 44 × 44 px.
- Show what is pressed — give feedback on touch start, not only on touch end.
- Support multi-touch if your game needs movement and another action at once.
canvas.addEventListener("touchstart", onTouchStart, { passive: false });
canvas.addEventListener("touchmove", onTouchMove, { passive: false });
canvas.addEventListener("touchend", onTouchEnd, { passive: false });#Layout
- Letterboxing is fine when the game is forced into the wrong orientation.
- Reserve a safe area at the top and bottom for notches and home indicators.
- Test on a 16:9 phone in portrait and a 19.5:9 phone in landscape.
- Use
dvhunits in CSS to handle the mobile address bar.
.game {
width: 100vw;
height: 100dvh;
}#Orientation
You choose landscape, portrait or both when you upload the game. Pick the one your game is really designed for — it decides how the game is presented on phones.
#iOS quirks
Disable text selection on the canvas:
csscanvas { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }An
AudioContextstarts suspended until the player touches the screen. Resume it on first input:javascriptfunction unlockAudio() { audioCtx.resume(); } document.addEventListener("touchend", unlockAudio, { once: true });Prevent pinch-zoom with a viewport tag:
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">.
#Android quirks
- Browser versions vary a lot. Test in Chrome and Samsung Internet.
- Devices with little memory can crash if peak memory goes over 512 MB.
#Performance
- Keep the number of pixels you draw each frame down — phone GPUs are weak.
- Halve particle counts on touch devices.
- Do not ship 4K textures for a game that displays at 720p.
#The Funox mobile app
Your game can also run inside the Funox mobile app. You do not need to change anything: the same SDK calls work, and ads are shown by the app itself.