Start a browser game with Phaser
A tiny Phaser 3 game with a local ControllerHost, QR lobby and two phone controllers. Move with the left stick or D-pad, dash with the bottom face button, and collect the gold disc. Scores survive a phone leaving and resuming.
Tested: Phaser 3.90.0, Node 22.22.0 and headless Chrome 156 on macOS arm64. Two browser phones exercised movement, dash, separate seats, feedback messages and reconnects. Real phones and physical feedback still need device checks.
Contents
Install and run
Use the unpacked SDK archive, or a source checkout after npm ci. Keep examples/phaser-arena beside examples/local-common. From the SDK root, with Node 22 or newer:
node examples/phaser-arena/server.mjs
Open the game and QR lobby. Phaser is loaded from the exact 3.90.0 CDN URL, with no build step. This is the starter's only extra runtime dependency. For offline use, download that file outside the checkout and set PHASER_FILE to its absolute path; the host serves it as /phaser.js.
See phone input
For real phones on the same Wi-Fi, replace this example IP with the computer's reachable address:
PUBLIC_ORIGIN=http://192.168.1.20:49700 node examples/phaser-arena/server.mjs
Open the LAN URL on the shared display and scan its QR with both phones. Enter a name and tap Play. Move the left stick or D-pad: each phone moves its own circle. Collect the gold disc to increase its score. Tap the bottom face button to dash. Choose Gamepad in MENU if needed. See shared setup for firewall/address checks and trusted local HTTPS for iPhone motion. This game needs only touch controls.
Check two phones
node --test examples/phaser-arena/test.mjs
The test uses the SDK driver and two isolated phone pages in one installed headless Chrome. Real stick and dash touches collect a disc, move each assigned player, and deliver a cue and rumble with receipts. It checks leave, same-seat reload/resume, removal, invitation/QR rotation and process cleanup. Screenshots are optional; capture settings and hardware limits apply.
server.mjs owns the authoritative simulation; client.mjs draws its public snapshots with Phaser. ../local-common/runtime.mjs contains the five lifecycle handlers. Type remove p1 in the server terminal to free a seat. Ctrl+C stops the simulation and server.
Use it in your game
Keep input and score under each playerId. Freeze input on leave; remove the game record on removed. This starter runs your own Node host and serves matching SDK files. It needs no desktop companion or hosted relay. For a static browser game using the hosted relay, use Web games. Before release, read Ship a game.