--- name: port description: Make an existing single-player web game multiplayer in a Homie studio. Reads the game (loop, input, state, camera), grades the port easy, medium, hard or not a fit and says why, adds netplay public rooms (bots in empty seats, join in progress, host handoff, rounds), phone touch controls, a stable camera and the big-screen view, proves it with the owner tests (held and alternating directions, real touch on iPhone WebKit and Android Chrome, a late joiner, a killed host, two fresh browsers finishing a round), then deploys it to the studio's own Cloudflare and lists it. Use when someone says "make this multiplayer", "make my game multiplayer on Homie", "port this game to my studio", or points at a single-player web game. --- # Make a game multiplayer (port) A port is done when strangers who press Play land in the same live room, each browser renders the game itself, bots fill the empty seats, rounds end and restart, the controls mean the same thing every second on a phone and a computer, and the checks below pass on the live site. Take as long as it needs; quality is the bar, not speed. Never call it done on a guess: the checks say, or you say plainly what still fails. The person should not have to type anything after asking. Find what you need, decide, and keep going. Stop only for something only they can give: the one Cloudflare approval, a licence question, or a game that is not a fit. **Finish in this turn.** A port takes a long time; stay with it until it is live and checked. Never end your turn, schedule a wake-up, or hand back "it is running" while a check, a build or a deploy is still going: wait for it by polling (a short `sleep` then `tail` of its log, repeated) and keep working. When your turn ends, the processes you started (the dev server, a running check) end with it, and a half-ported game is left behind. ## 0. Find the game and the studio - **The game** is the folder they named, or the current folder if it holds an `index.html`. Otherwise look one level down for the only folder with one. - **The studio** is the folder with `studio.json`: here or above, else next to the game (`find .. -maxdepth 2 -name studio.json`). One found: use it. None: set one up first with the `studio-setup` skill (name it after the person's game), then come back. Several: use the one the person named, or ask which. - **The toolkit.** In the studio, `npx --no-install homie-studio port plan ` must work. If it says unknown command, the studio's `@homie-rocks/studio` is older than the port toolkit: call the Homie MCP tool `game_port` for the pinned package and install it exactly as it says, then run `npm install`. Without the connector, `npx -y @homie-rocks/studio@latest upgrade` says what to change (the `studio-setup` skill, "An existing studio that is behind"). ## 1. Read it and grade it (before changing anything) ```sh npx --no-install homie-studio port plan ``` The plan is a draft from reading files: engine, loop, input, camera, physics, storage, audio, size, licence, risks, and a grade. Now read the code yourself: the main loop, where input is read, what the state is (player, enemies, pickups, level, score), how the camera moves, what "game over" is. Then write `PORT.md` in the game (template: [references/PORT-TEMPLATE.md](references/PORT-TEMPLATE.md)) with: - **the grade** — easy, medium, hard (fast physics, precise timing, huge state), or **not a fit** — and one paragraph of why, in plain words; - the multiplayer design: what a round is, what the host owns, what each browser owns, what bots do, how a late joiner comes in, what the big screen shows; - the movement mode: **owner** for action games (each browser moves its own body at once, the host bounds it), **host** for turn-based and grid games (the host's rules move bodies from intents); - controls on keys and on touch, and the camera rule (below). Tell the person the grade and why in two or three lines, then go on. If it is **not a fit** (it needs its own server, WebAssembly threads, or its licence forbids it), stop there and explain what would make it portable. The port toolkit is in beta: a game that is not a fit today, or a port the checks cannot judge, is worth a port request at https://github.com/homie-rocks/homie/issues/new/choose (the game's public address and licence, the grade and why; no keys or private addresses). Licence: a game you did not make must carry a licence that allows changing and publishing it (MIT, Apache-2.0, BSD, ISC...). Keep the licence file with the game. No licence, or a licence that forbids it: port it for private testing only and say so. ## 2. Bring it into the studio ```sh npx --no-install homie-studio port import --id [--name ""] ``` It copies the game to `games//` untouched except: the port toolkit loads first in `` (sandbox shims, first-touch audio, `window.HomiePort`) and the viewport is phone-safe. `game.json` says how it builds: `static` (the folder as it is, for plain `