# Splitscreen Club developer docs > Splitscreen Club puts local multiplayer games in one room: players pick a game, keep their controller and profile, and go back to the room with Back. These docs show how to connect a game made in any engine and share it through the platform. Start with Share your game. # Bring your game to the couch Splitscreen Club puts local multiplayer games in one room. Players pick a game, keep their controller and profile, and return to the room with Back. Your game keeps its engine and runs in its own process. **To share a game, follow [Share your game](https://splitscreen.club/docs/share).** It is the whole path in six steps, from connecting your engine to the store, with a command and a "done when" for each step. The rest of these docs is reference for one of those steps. ## Pick your engine Starting a new game? The [Game playbook](https://splitscreen.club/docs/playbook) gets you from an idea to the store with a Godot template, headless tests and one-command publishing. | Engine | Starting point | What is included | | --- | --- | --- | | [Warp / Luau](https://splitscreen.club/docs/warp) | The `warp` runtime, our own open-source engine | Lifecycle, seats, controllers, window, names and colours built in; Luau scripts with hot reload, no compiling | | [LÖVE / Lua](https://splitscreen.club/docs/love) | Shared party runner | Lifecycle, controller mapping, window handling and faces | | [Bevy](https://splitscreen.club/docs/bevy) | Bevy plugin and demo game | Lifecycle, controllers per seat, window and audio handling, settings, faces and phone screens | | [Rust](https://splitscreen.club/docs/rust) | Rust SDK | Typed protocol events; your engine handles input consumption and rendering | | [Godot 4](https://splitscreen.club/docs/godot) | Godot addon | Lifecycle, controllers per seat, window handling, settings, faces and phone screens | | [C / C++](https://splitscreen.club/docs/c) | Single-header adapter | TCP transport and lifecycle; no controller stream or face decoder yet | | [Unity](https://splitscreen.club/docs/unity) | Unity package and the Orb Rush demo | Lifecycle, controllers per seat, window handling, settings, faces, phone screens and saves; new, not yet tested on hardware | | [Unreal Engine 5](https://splitscreen.club/docs/unreal) | Unreal plugin and the Dash Derby demo | Lifecycle, controllers per seat, window handling, world pause, settings, faces, phone screens and saves; new, not yet built in CI | | [Other engines](https://splitscreen.club/docs/other-engines) | Wire protocol | Implement the connection and engine adapter yourself | These are implementation starting points, not certifications. [Engine support](https://splitscreen.club/docs/engines) compares every engine feature by feature and lists the open work. ## What a good integration does Prepare a playable frame while hidden and silent. Show it when the host says Start. Pause simulation and audio when players return to the lobby, then resume the same state. Keep processing host messages throughout. Controllers follow player seats. Faces, names and colours follow player IDs. Your game owns the rounds and score screens; finishing a round does not end the Splitscreen Club session. Read [Game lifecycle](https://splitscreen.club/docs/lifecycle), then [Controllers & players](https://splitscreen.club/docs/controllers). Add [faces and colours](https://splitscreen.club/docs/faces) once play is reliable. ## Have a game already? [Add your game in the developer portal](https://splitscreen.club/developers). Sign in with your email; a title, a short pitch and a player count are enough to start. We can help with integration, or you can follow [Share your game](https://splitscreen.club/docs/share) yourself. ## For AI agents Read [Share your game](https://splitscreen.club/docs/share) first. [llms.txt](https://splitscreen.club/docs/llms.txt) lists every page and [llms-full.txt](https://splitscreen.club/docs/llms-full.txt) has all of them as Markdown in one file. ## How these docs stay current These pages are built from Markdown in the public repository. Code excerpts are read from source, not pasted copies. CI checks generated pages, internal links and watched implementation files. The Rust example compiles against the SDK; the C example compiles against the header. The Bevy demo is built with Bevy and passes the conformance harness in CI. The Unity demo's rules play against a fake host without Unity, and its Unity code compiles against Unity's reference assemblies. The Unreal plugin's protocol core passes its unit tests and the conformance harness in CI; its Unreal code is not compiled there yet. An implementation change makes the docs check fail until someone reviews and regenerates the affected pages. This catches drift; it cannot prove every explanation is correct. Godot snippets are source-checked, not runtime-certified. Physical controller and window tests still matter. # Share your game This page is the whole path from a local multiplayer game on your machine to a game that groups can play in Splitscreen Club. Follow the steps in order. Each step ends with **Done when**: do not move on before that is true. The other pages are reference for one step; this page links to them where you need them. People and AI agents can follow it the same way. Every step runs from the command line. An agent can read all docs at once in [llms-full.txt](https://splitscreen.club/docs/llms-full.txt). ## What you need - A game for 1 to 8 players on one screen, played with controllers. - A Windows build of it. Hosts run on Windows today; you can add `mac` and `linux` builds next to it. - An email address, for the [developer portal](https://splitscreen.club/developers). You do not need Splitscreen Club support in your game to start. You can send a game first and add support later, or ask us to help (step 1). ## 1. Tell us about the game Sign in to the [developer portal](https://splitscreen.club/developers) with your email and choose **Add your game**. A title, a one-line pitch and a player count are enough. From here you have two equal options: - **Do it yourself** (or with your AI tools): continue with step 2. - **Let us help**: ask in the game's **Help** tab. We agree on repository access and AI use first, prepare the changes in a pull request, and you review and merge it. Your repository can stay private. **Done when** the game is in the portal with its id, such as `my-game`. Use that id everywhere below. ## 2. Connect your engine Splitscreen Club starts your game as a separate program and talks to it over a local connection: it tells the game who plays on which seat, sends each seat's controller, and says when to prepare, start, pause, resume and stop. Your engine's SDK does that work. Pick your engine: | Engine | Guide | You add | | --- | --- | --- | | Warp (Luau) | [Warp / Luau](https://splitscreen.club/docs/warp) | nothing: the `warp` runtime does it. The quickest start for a new game | | Godot 4 | [Godot](https://splitscreen.club/docs/godot), or start from the [template](https://splitscreen.club/docs/playbook) | the `sdk/godot` addon | | Unity | [Unity](https://splitscreen.club/docs/unity) | the `sdk/unity` package | | Unreal Engine 5 | [Unreal](https://splitscreen.club/docs/unreal) | the `sdk/unreal/GameNight` plugin | | Bevy | [Bevy](https://splitscreen.club/docs/bevy) | the `gamenight-bevy` crate | | LÖVE / Lua | [LÖVE](https://splitscreen.club/docs/love) | your game as a module of the shared runner | | Rust, no engine | [Rust](https://splitscreen.club/docs/rust) | the `gamenight-sdk` crate | | C / C++ | [C / C++](https://splitscreen.club/docs/c) | the `sdk/c/gamenight.h` header | | Anything else | [Other engines](https://splitscreen.club/docs/other-engines) | your own adapter for the [protocol](https://splitscreen.club/docs/protocol) | [Engine support](https://splitscreen.club/docs/engines) says per engine what the SDK does and what you still write yourself. Whatever the engine, the game must do five things. They are what players notice: 1. **Start in the game.** No title screen or player setup: the room already picked the game and the players. 2. **Read each seat's own controller** from the SDK, never a joystick index. See [Controllers & players](https://splitscreen.club/docs/controllers). 3. **Prepare hidden, show on Start.** Load while hidden and silent, report ready, take the screen when the host says Start. See [Game lifecycle](https://splitscreen.club/docs/lifecycle). 4. **Pause and resume the same state.** Back (Select) takes everyone to the room; your game freezes, also its audio and timers, until it is resumed. Never use Back for anything else. Start opens your own menu. 5. **Keep playing rounds.** Show a result briefly and start the next round. Players leave with Back, not through a game over screen. Add players' [faces and colours](https://splitscreen.club/docs/faces) and [settings](https://splitscreen.club/docs/settings) once this works. **Done when** your game starts inside Splitscreen Club, every seat moves its own player, and Back and Resume work. ## 3. Test it Run the certifier against your built game. It plays the host: it seats players, sends controller input and runs the whole lifecycle several times. ```sh git clone https://github.com/ontola/gamepad-party cd gamepad-party cargo run --release -p gamenight-certify -- my-game --players 2 --report report.json -- path/to/MyGame.exe ``` Everything after `--` is the command that starts your game. Then play it once with real controllers: two people, unplug a pad, press Back and Resume a few times, switch to another game and back. The certifier cannot see your screen or your pads. More checks: [Test your integration](https://splitscreen.club/docs/testing). **Done when** the certifier reports no failures and the real-controller round went right. ## 4. Upload a preview build A preview is private: only you and your testers see it. In the portal, open your game, then **API keys**, and create a key. Store it as `GAMENIGHT_API_TOKEN` (in your shell, or as a CI secret). Then upload a ZIP of the exported game: ```sh curl -O https://splitscreen.club/developers/gamenight-publish.py python3 gamenight-publish.py push --game my-game --platform windows --file dist/my-game-windows.zip --entrypoint MyGame.exe --version 0.1.0 ``` `--entrypoint` is the executable's path inside the ZIP. Every upload needs a new `--version`. To upload from GitHub Actions on every push instead, see [Connect GitHub Actions](https://splitscreen.club/docs/publishing#connect-github-actions). **Done when** the portal's **Builds** tab shows the build as ready. ## 5. Fill the store page Put two things in your repository: - `gamenight.json`, the facts about the game: ```json { "$schema": "https://raw.githubusercontent.com/ontola/gamepad-party/main/catalog/schema.json", "id": "my-game", "title": "My Game", "tagline": "One line that says why it is fun with friends.", "developer": "Your name", "players": { "min": 1, "max": 4 }, "match_minutes": 5, "price": "free", "tags": ["party", "co-op"], "integration": { "level": "integrated", "protocol": 1 } } ``` - `assets/gamenight/` with `cover.png` (portrait 360x480), `icon.png` (128x128) and `gameplay.png` (16:9). - `preview.json`, the recipe for five seconds of real gameplay. `python3 gamenight-publish.py clip --publish` renders and uploads it (see the [store clip guide](https://splitscreen.club/docs/store-clip#keep-the-recipe-not-the-video)). Then, in that folder: ```sh python3 gamenight-publish.py store ``` Edit these files and run `store` again to change the page. Do not copy the text or media anywhere else. **Done when** the portal's **Store page** tab shows your title, clip and art. ## 6. Playtest, review, publish 1. **Playtest.** In the **Playtest** tab, create an invite link and send it to friends. When you or a tester joins a Splitscreen Club table with a phone, the table gets your preview. Afterwards every phone asks how it went; the answers appear in the tab. 2. **Send for review.** In the **Review** tab. We play the exact build and check that you may distribute it. 3. **Publish.** Once approved, choose **Publish to players**. Every host picks it up from the catalog; nothing needs to change in any Splitscreen Club repository. Later versions: upload a new build (step 4) and publish it. Rolling back is choosing an older build. Details, the API and pricing: [Publish a game](https://splitscreen.club/docs/publishing). **Done when** your game is on the shelf in Splitscreen Club rooms. ## For AI agents - Read this page first, then only the guide for your engine from step 2. [llms-full.txt](https://splitscreen.club/docs/llms-full.txt) has every page as Markdown in one file; [llms.txt](https://splitscreen.club/docs/llms.txt) lists them. - Work through the steps in order and check each **Done when** yourself, with commands and screenshots, before you report a step as finished. - Where [Engine support](https://splitscreen.club/docs/engines) says "You" or "No", write that part against the [protocol](https://splitscreen.club/docs/protocol). Do not invent SDK functions. - Never put the `GAMENIGHT_API_TOKEN` in the repository, a log or a pull request. Publishing to players (step 6) is for the game's owner to approve. # Game playbook How to go from an idea to a game in the Splitscreen Club store quickly. It is written for AI coding agents as much as for people: every step can run headless, from the command line, without someone watching the screen. ## Start from the template ```sh git clone https://github.com/ontola/gamepad-party python3 gamepad-party/scripts/new-godot-game.py my-game my-game "My Game" cd my-game && git init && git add -A && git commit -m "Start My Game" ``` You get a small, working Godot 4 couch game with: | Part | What it does | | --- | --- | | `main.gd` | the game: Splitscreen Club lifecycle, seats, faces, settings and a Start menu, bots, dev flags | | `gamenight.json` | the game's metadata: title, tagline, developer, players, tags; the only place you edit them | | `tests/lifecycle.py` | a fake Splitscreen Club host drives prepare, start, controller input, pause, resume, dispose | | `tools/capture_preview.sh`, `tools/encode_preview.py` | the five-second store clip, frame by frame | | `.github/workflows/ci.yml` | tests, Windows export, release, store page | | `AGENTS.md` | the commands and rules for whoever works on it next | The Splitscreen Club addon is installed from the SDK. CI fails when your copy falls behind; run `python3 gamepad-party/sdk/godot/sync.py my-game` to update it. Keep one repository per game. Replace the orb game with yours one step at a time, and keep the tests green after every step. Other engines work too (see [Engine support](https://splitscreen.club/docs/engines)). For Unity, copy the Orb Rush project in `examples/unity-demo` instead; the [Unity guide](https://splitscreen.club/docs/unity) walks through it and its headless test. ## The loop Run all three after every change: ```sh godot --headless --import # parse errors godot --headless --fixed-fps 60 --path . -- --sim 4000 --seed 1 # bots play a round python3 tests/lifecycle.py --godot godot # fake Splitscreen Club host ``` - **Import first.** A GDScript parse error makes later headless runs hang instead of failing. Look for `SCRIPT ERROR` or `Parse Error`. - **Bots play the real game.** The sim counts what happened (dashes, pickups, rounds) and fails when something never did. Add a counter for every mechanic you build, so a broken mechanic fails CI. - **The fake host checks what players notice.** Extend `tests/lifecycle.py` for each control: send controller frames, wait for the trace line. Put rules that need many cases (damage tables, combinations) in plain scripts and test them with `godot --headless --script`. ## Make it deterministic from day one Seed the global RNG once from `--seed` and move the simulation only in `_physics_process`. With `--fixed-fps`, the same seed then replays the same run: the template's sim prints a state hash, and its store clip comes out bit for bit the same. A second unseeded `RandomNumberGenerator`, or gameplay that reads the clock, breaks this quietly. Retrofitting it into a big game is much harder than starting with it. ## See the game without a person Build flags for everything you would otherwise set up by hand: - `--shot out.png --frames 90`: bots play and frame 90 is saved. Render under `xvfb-run` for a real GPU path. - `--players N`, `--seed N`, and as the game grows: where to start (a level, metres along a path), what to spawn round the players, a closer camera. - `GAME_TRACE=1` prints what happens, for tests and for debugging. Look at the screenshots yourself after visual changes. Text over characters and HUD clutter read badly on a TV; let shapes and colour carry the state. ## Make 3D models Image-to-3D tools (Tripo, Meshy, Hunyuan3D, Hyper3D) give a quick first shape but rarely exactly what you want, and an agent driving Blender tends to lose detail. What works better for hard-surface models (props, vehicles, buildings): 1. Generate a rough model from a concept image with one of those tools. 2. Import it into the Godot project as a reference only. 3. Have the agent build a new model next to it in Godot itself, from CSG shapes or a `SurfaceTool`/`ArrayMesh` in code, adding the details and proportions you need. No Blender, no plugin or MCP is required. 4. Render it with `--shot` from a few angles, compare it with the reference and iterate. A second agent that only reviews the screenshots catches more than the builder checking its own work. Bake CSG into a plain mesh (`CSGShape3D.bake_static_mesh()`) before it ships: CSG is slow at runtime. Code-built meshes need no baking and stay easy to change; most of our games already build their models this way. Rigged characters (bones, weight painting) still need a real modelling tool. From an [r/aigamedev workflow post](https://www.reddit.com/r/aigamedev/comments/1xa3gju/new_crazy_workflow_for_making_3d_assets/), October 2026. ## Design for the couch Players sit on a sofa, a few metres from the TV, holding controllers, and switch games often. The template does all of this; keep it as you build. - **Start playing at once.** No title screen, no setup screen before the first round. The lobby already picked the game and the players. - **Settings live in the Start menu, and in Splitscreen Club.** Declare every option with `GameNight.declare_settings` and apply `setting_changed`, so players can change them from the Splitscreen Club app, the lobby, or by asking an LLM. Show the same settings in a small menu on Start. Apply a change from the next round when changing it mid-round would be unfair. The menu sends its changes with `GameNight.set_setting`, so the app shows them too. - **The Start menu follows one layout.** The game's name heads it every time Start opens it, also mid-game, so everyone in the room learns what they are playing. Then Resume, then New round (apply options), then the settings. No button hints in the menu (choose, change, select, resume): a highlighted row and ‹ › around its value speak for themselves. - **The Start menu shows the controls.** Draw the button mapping beside the menu, or add a Controls row that opens it. This is the one place a player who joined mid-game, or never played before, can look up what each button does. During play there are still no control hints. - **Keyboard support is a plus.** Not every room has a controller for everyone, so let one player play on the keyboard when you can, and say so with `"keyboard": true` under `players` in `gamenight.json`, so the catalog records which games work that way. - **Leave Back alone.** Back (Select) returns to the party; Splitscreen Club handles it and pauses your game. Never bind it to anything in the game. - **Use the players' colours, names and faces.** Each player picks them once in Splitscreen Club. Colour the player's character, draw their face on it with the SDK's `face.gd`, and name them where it matters, such as the results screen. - **Don't flood the screen.** No text over characters, no labels on every thing. A clock, a score per player and clear shapes and colours read from the sofa; menus and explanations do not. No control hints during play either: players figure out A and B in seconds. - **Rounds keep going.** Show the result briefly, call `notify_finished`, then start the next round. Players leave with Back, not with a game over screen. Let players keep moving while the result shows. - **A calm camera.** Everyone shares one screen: keep the camera still or slow, keep players leashed together so nobody leaves the frame, and snap (don't glide) when someone teleports or respawns. - **Punish the failure, not the action.** Trying something should never hurt; missing it may. Keep the visible causes of failure to a few that everyone can read at a glance. - **Fewer, clearer mechanics.** Cut mechanics that look alike but behave differently; simple spatial rules win. - **Start sparse.** Effects, screen shake and audio beds were toned down in every playtest. Add spectacle when a playtest asks for it. - **Asymmetric games:** private information goes to each player's phone (see Phone screens in the [protocol](https://splitscreen.club/docs/protocol)), shared state stays on the TV, and the TV shows what the phone players chose. - **Bots fill empty seats.** The host can seat AI players, so a game works with one person. The same bots run your sim and your store clip. - **Controllers follow seats.** Read `GameNight.frame_for_seat(seat)` when Splitscreen Club launched the game, never joystick indices. - **Prepare quietly.** Load everything in Prepare while hidden, then call `notify_ready`. Start shows it; Pause freezes play, timers and audio. More detail: [Game lifecycle](https://splitscreen.club/docs/lifecycle), [Controllers & players](https://splitscreen.club/docs/controllers), [Faces & colours](https://splitscreen.club/docs/faces) and [Game settings](https://splitscreen.club/docs/settings). ## The store clip The store needs a five-second clip of real gameplay. Read the [gameplay preview guide](https://github.com/ontola/gamepad-party/blob/main/docs/gameplay-previews.md): quick, varied, readable cuts. ```sh GODOT=godot tools/capture_preview.sh /tmp/takes python3 tools/encode_preview.py /tmp/takes assets/gamenight ``` Each take is the real game with bots, rendered with `--write-movie` at a fixed 30 FPS, so it is slow to record but exact. The cut list in `encode_preview.py` is the whole edit, and encoding is bit-exact. Write down the seeds and commit next to the clip, so anyone can make it again. Add `cover.png` (portrait 360x480), `icon.png` (128x128) and `gameplay.png` (16:9) to `assets/gamenight/`. ## Release and store page 1. [Register the game](https://splitscreen.club/developers) in the developer portal and create a publish key. Save it as the `GAMENIGHT_API_TOKEN` secret of the repository. The first stable release needs Splitscreen Club's distribution approval. 2. Run the CI workflow by hand with `release` set to `v0.1.0`. It tests, exports Windows, publishes the GitHub release and fills the store page. 3. Or fill the store page from your machine: ```sh GAMENIGHT_API_TOKEN=gn_pub_... python3 gamenight-publish.py store ``` It reads `gamenight.json` and uploads what is in `assets/gamenight/`. See [Publish a game](https://splitscreen.club/docs/publishing) for builds, channels and review. Everything players see lives in Splitscreen Club production, filled from your repository by these commands. Do not add the game to `ontola/gamepad-party`'s `catalog/games` or to any store file in another repository: installed hosts get stable releases from the hosted catalog. Store visibility (listed or hidden) is a Splitscreen Club staff setting. ## Pitfalls we hit - Game data copied into other repositories drifts. Bombing Bugs ended up with its tagline in three places. Edit `gamenight.json` and `assets/gamenight/` only, and let the publish commands carry them to production. - Headless Godot hangs on a parse error; untyped values from arrays and dictionaries are the usual cause. Give them a type (`var c: Vector3 = ...`). - Agents often cannot push git tags. Release with the workflow input instead. - Never run a downloaded script with your publish key in CI. Check out a pinned copy of `ontola/gamepad-party` and run its `scripts/gamenight-publish.py`. - The first frames of a `--write-movie` take can show the engine warming up. Start cuts at frame 20 or later. - A big level needs the camera close enough to read on a phone; check the clip at phone size. - Test the exported build, not only the project: files under `tests/` are left out of exports, and game code that loads them breaks only there. The template's CI runs the lifecycle test against the exported pack. - On Windows, a test host that reads Godot through `stdout=PIPE` can stall the game once the pipe fills. Write the output to a file (the template does), and pick a free port instead of a fixed one. - `secrets: inherit` does not pass secrets to a reusable workflow in another organisation. Pass each secret by name. - Build versions are immutable: give every preview upload a unique version, such as one with the CI run id. - TVs often run at 120 Hz: turn on physics interpolation (`physics/common/physics_interpolation`), or motion judders. - Prewarm shaders and particles during Prepare, before `notify_ready`, so the first seconds of play don't stutter. # Engine support Which engines Splitscreen Club supports, how far, and where to start. Pick the row for your engine, then follow its guide. If your engine is not listed as **Full**, read its open work before you start: you write that part yourself. ## Support levels - **Full**: an SDK in this repository handles the connection, lifecycle, per-seat controllers and the game window. Released games use it and CI runs its contract tests. - **New**: an SDK covers everything Full does, but no released game uses it yet. Its open work below says what CI checks and what still needs hardware. - **Partial**: an SDK handles the connection and lifecycle. You wire controllers, windows or faces into your engine yourself. - **Protocol only**: no SDK. Write an adapter against the [protocol](https://splitscreen.club/docs/protocol). | Engine | Level | Start with | Games using it | | --- | --- | --- | --- | | [Warp / Luau](https://splitscreen.club/docs/warp) | Full | `warp new`, no SDK to add | Neon Siege, Dead Miles, Relay Keepers, Stack Together, Neon Trails | | [Godot 4](https://splitscreen.club/docs/godot) | Full | [Godot template](https://splitscreen.club/docs/playbook) and `sdk/godot` addon | Spaceracer, Ballkickers, Spellstorm, Hexstead, Downhill Rush, Bombing Bugs, The Builders, Growing Guns, Frog Fighter, The Voice and the Will | | [LÖVE / Lua](https://splitscreen.club/docs/love) | Full | Shared party runner | Blast Party, Neon Trails, Neon Siege, Volley Trouble, Stack Together, Bubble Buddies | | [Bevy](https://splitscreen.club/docs/bevy) | New | `gamenight-bevy` plugin and the Star Catch demo | Star Catch (demo) | | [Rust](https://splitscreen.club/docs/rust) | Partial | `gamenight-sdk` crate | Terminal demo game | | [C / C++](https://splitscreen.club/docs/c) | Partial | `sdk/c/gamenight.h` | None yet (transport example only) | | [Unity](https://splitscreen.club/docs/unity) | New | `sdk/unity` package and the Orb Rush demo | Orb Rush (demo) | | [Unreal Engine 5](https://splitscreen.club/docs/unreal) | New | `sdk/unreal` plugin and the Dash Derby demo | Dash Derby (demo) | | Other engines | Protocol only | [Wire protocol](https://splitscreen.club/docs/other-engines) | Mineclonia (Luanti, game-specific adapter) | ## Features per engine "SDK" (or "Runtime" for Warp) means it is done for you. "You" means the protocol carries it but your game code must handle it. "No" means the SDK cannot do it yet. | Feature | Godot 4 | LÖVE | Bevy | Rust | C / C++ | Unity | Unreal | Warp (Luau) | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | Connect, hello and launch token | SDK | SDK | SDK | SDK | SDK | SDK | SDK | Runtime | | Prepare, Ready, Start, Pause, Resume, Dispose | SDK | SDK | SDK (`gameplay_runs`) | SDK | SDK | SDK | SDK (also pauses the world) | Runtime | | Controller input per seat | SDK (`frame_for_seat`, `just_pressed`, deadzones) | SDK | SDK (`pad`, `just_pressed`, deadzones) | You (typed frames) | No | SDK (`FrameForSeat`, `JustPressed`, deadzones) | SDK (`GetPad`, `JustPressed`, deadzones) | Runtime (`input[id]`) | | Hidden preparation and taking the screen | SDK (`GameNightScreen`) | SDK | SDK (`managed_window`) | You | You | SDK (`GameNightScreen`; no hiding on Linux) | SDK (`bAutomaticScreen`) | Runtime | | Match settings from the lobby and phone | SDK | SDK | SDK | SDK | SDK | SDK | SDK | No | | Player names, colours and faces | SDK (`face.gd`) | SDK (`shared.face`) | SDK (`avatar_image`) | You (avatar decoding included) | No | SDK (`GameNightFaces`) | SDK (`DrawFace`, `GetFaceTexture`) | Runtime (names and colours; no faces) | | [Phone screens](https://splitscreen.club/docs/phone-screens) for each player | SDK (`declare_companion_folder`) | SDK (`mode.phone`) | SDK (`declare_companion_folder`) | SDK | No | SDK (`DeclarePhoneScreen`) | SDK (`DeclareCompanionFolder`) | No | | Performance diagnostics | SDK | SDK | SDK | You (manual samples) | No | SDK | SDK | No | | Headless contract test in CI | Yes | Yes | Yes, the demo through `gamenight-certify` with Bevy | Yes | Compile only | Yes, without Unity (dotnet) | Protocol core only, without Unreal | Yes, a fake host in `cargo test -p warp` | | Keep the SDK copy current | `sync.py` and CI check | Pinned game sources | Cargo revision | Cargo revision | Copy the header | Package Manager git URL | Copy the plugin folder | Ship a newer `warp.exe` | ## Open work This list doubles as the roadmap for engine support. - **Unity**: the package and the Orb Rush demo are new. CI runs the SDK core and the demo rules against a fake host and `gamenight-certify` with dotnet, and compiles the Unity layer against reference assemblies, but no Unity build has been tested on hardware yet: window handling, faces on screen and pads. Linux has no window hiding. The Input System code path is not compiled in CI. - **Unreal**: the plugin and the Dash Derby demo are new. CI unit tests the plugin's C++ protocol core and runs `gamenight-certify` against it headless, but has no Unreal build: the module and the demo are not compiled there, and window handling, audio, the world pause, faces on screen and pads are not tested on hardware yet. - **C / C++**: the header has no controller tokens, controller frames, colours or faces, and no phone screens. Games still have to parse those messages themselves. - **Bevy**: the plugin and the Star Catch demo are new. CI builds them with Bevy and runs the demo through `gamenight-certify` on Linux with software rendering, but Windows and macOS window behaviour, the Windows foreground helper, audio devices and physical pads are not tested on hardware yet. - **Warp (Luau)**: match settings, phone buttons and phone screens, faces and performance samples are not exposed to Luau yet. There is no prebuilt `warp` download yet: build it from source. - **Rust without an engine**: the SDK delivers typed events; input, windows and faces are left to the game. - **Godot 4**: Godot has no package manager, so each game vendors the addon. Run `sdk/godot/sync.py` and the CI check to keep copies current. ## For agents and code generators Use this page to choose an approach, then read only the guide for that engine. Do not invent an SDK where the table says "You" or "No": implement that part against the [protocol reference](https://splitscreen.club/docs/protocol) and the [controller rules](https://splitscreen.club/docs/controllers). Before calling an integration done, run the [integration checks](https://splitscreen.club/docs/testing). # Integrating your game with Splitscreen Club Splitscreen Club supplies the party, seats and lifecycle. Your game owns gameplay, rounds and results. Players can stay in a game until they choose another one. Start from the [shared LÖVE runner](https://github.com/ontola/gamenight-games/blob/main/love-party/README.md) for a Lua game. The [wire reference](https://splitscreen.club/docs/protocol) defines messages; the [release requirements](https://github.com/ontola/gamepad-party/blob/main/contract/requirements.json) define what must work. A successful handshake alone is not a complete integration. ## Submit a game Start in the [developer portal](https://splitscreen.club/developers). Sign in with your email and announce your game: a title, a short pitch and a player count are enough. No protocol integration is required to start. Questions go to the portal's **Help** tab; replies appear there and in your inbox. We can help with integration, or you can use this guide with your own developers or AI tools. For assisted work, agree repository access, code handling and any AI use first. Private repositories can stay private. Splitscreen Club prepares a pull request; you review and merge it, then supply the resulting build for testing. When ready for review, open your game in the portal and use its **Review** tab. Submit one platform build with a version, player limits and controls. Its SHA-256 is required before approval. The portal keeps private feedback and revisions; each revised build needs a new review. Code access does not grant distribution permission. Staff review the package, rights and test evidence before approving catalog publication. Listing is free. The first flow supports free releases; commercial interest is accepted, but purchases, payouts and timed trials are not enabled by submitting a game. Run the [contract checks](https://splitscreen.club/docs/testing) before review and share their results. Also test physical controllers, joining/leaving, pause/resume and returning to the lobby on each supported platform. Automated test coverage varies by engine and runner; untested requirements are not passes. Do not treat the certifier as a complete controller or commercial trial test environment. ## Connect The host launches your process with `GAMENIGHT=1`, `GAMENIGHT_ADDR`, `GAMENIGHT_GAME_ID` and `GAMENIGHT_TOKEN`. In managed mode, skip your title, sign-in and controller-assignment screens. Keep standalone behavior separate. Connect to the address over WebSocket, or send newline-delimited JSON over TCP. Both transports use the same port, normally `127.0.0.1:7912`. ```json {"type":"hello","role":"game","game":"my-game","token":""} ``` The host returns `welcome` with `protocol_version` and the party snapshot. Use the token supplied for this launch. One connected process serves one title; that process may receive several sessions over its lifetime. ## Prepare before taking the screen On `prepare`, retain the session ID, seats, player profiles and settings. Load assets, compile shaders and prepare a real frame before replying `ready`. Keep the window hidden and audio silent. Do not steal focus during launch. ```json {"type":"progress","session":"","percent":40,"label":"Loading arena"} {"type":"ready","session":""} ``` Progress is optional. Ready must mean that Start can show playable content without another loading screen. Do not require player input to finish preparing. Keep the connection and lifecycle handling active while hidden or paused. A long load (a large world, a first-time shader build) needs more care: report a stage at least every five seconds, keep handling roster changes and `dispose` while loading, and when the roster changes during loading, prepare for the latest one rather than queueing every request. See [Performance](https://splitscreen.club/docs/performance#load-everything-before-ready). On `start`, show the prepared window and begin play. On `pause`, stop simulation, timers and audio, then hide the game so the lobby can appear. On `resume`, show the same game state and continue. Pause and resume are required for release, including when the game is showing results rather than active gameplay. On `dispose`, stop the session, hide the window, silence audio and release session resources. Wait for another Prepare: the same process usually serves several sessions in one evening, so keep the game running and reuse what you loaded. If the host connection is lost, exit cleanly rather than leaving a game window or background process behind. ## Controllers belong to players A seat is a playable position. Its occupant identifies a player; its `controller` is an opaque host device token. Neither the seat index nor an `ordinal:N` token is an index into SDL or another engine's local gamepad list. Managed bundled games consume the host's `controller_frame` stream and match `controllers[].controller` to `seats[].controller`. Do not enumerate local pads and assign the first pad to the first seat. Enumeration can differ between the host and game, especially after disconnects. Use [the shared input adapter](https://github.com/ontola/gamenight-games/blob/main/love-party/shared/input.lua) or implement [the frame contract](https://splitscreen.club/docs/protocol#bundled-games-authoritative-controller-input). Rust games receive the same stream as `GameEvent::ControllerFrame` from `GameNight::next_event()`. Keep the latest frame and look up each non-AI seat by its `seat.controller` token. An empty frame, absent token or a frame older than 250 ms means neutral input. `controller_input` is a separate activity report for presence and joining; calling it does not supply movement to the game. Process released buttons and disconnected devices; stale input must become neutral. Never assign one device to two players or substitute another player's controller when a device disappears. Standalone input is a separate path. Create bots for `ai` seats and no controllable pawn for `empty` seats. Player profiles are keyed by player ID, not array position. Preserve that association when seats or profiles change. ## Back, focus and fullscreen Back/Select requests the lobby with `request_overlay`. The host pauses the game. From the lobby, Back/Select can resume a paused game. Accept one transition per press, require release, and guard against the same held press reaching the newly focused window. The bundled [Back gate](https://github.com/ontola/gamenight-games/blob/main/love-party/shared/back_gate.lua) requires one second of release before another accepted press. **Never start or resume automatically on window focus.** Focus can change while the host is opening the lobby. Only explicit host Start/Resume commands change the running state. `request_start` exists for an explicit user request, not as a focus-event handler. Use a borderless window covering the display, not exclusive fullscreen. Configure it before reporting Ready so switching does not change display resolution. The bundled [window helper](https://github.com/ontola/gamenight-games/blob/main/love-party/shared/window.lua) prepares off-screen, then hides/shows the window. Its Windows path adds one off-screen pixel row to avoid exclusive-like presentation on affected drivers. Retain that behavior when reusing the helper. Test focus changes on the target OS; one platform's result is not proof for another. ## Rounds continue inside the session Your game shows its own scores, winner names and results screen, then starts the next round. Pause also freezes the results countdown. Do not wait for Splitscreen Club to create a fresh session after every round. You may send `finished` as a round notification. It keeps the active session, pause state and prepared next game intact. It opens voting state but does not force a vote, return to the lobby or advance the playlist. Explicit votes may still request a transition. Play next switches games. Skip only replaces the upcoming game. An explicit replay command creates a new session; an ordinary next round stays in the same session. Do not confuse either with an automatic end-of-match transition. ## Live players and settings After Prepare, send `participation` before Ready to receive `party_updated`. Set `instant_join` to true if your running match can accept new players, or false for a fixed roster. Apply profile changes without resetting the match. Report real human activity through `controller_input`; see the [presence contract](https://splitscreen.club/docs/protocol#player-activity-sleep-and-joining-during-play). `party_state` is the overlay snapshot, not a substitute for the game update API. Every game also receives `players_updated` when someone picks up a profile in the lobby mid-match: same seats, new name, colour, face or `profile_key`. Apply it in place; the session resumes, it is never a restart. `declare_settings` exposes game options. Handle `setting_changed` and document which settings apply immediately or at the next round. See [match settings](https://splitscreen.club/docs/protocol#match-settings). Log protocol errors and ignore unknown fields rather than crashing. ## Player faces and colours Name, clothing colour, skin colour and artwork are separate player fields. Show the actual player name and preserve profile ownership. Draw skin beneath the transparent face artwork; do not recolour the artwork with the clothing tint. ```lua local Face = require("shared.face") Face.drawFace(player, x, y, radius) ``` The [face API](https://splitscreen.club/docs/faces) uses a head centre and radius, preserving hat padding. It supports mirroring, rotation and live artwork changes. Rust integrations use `gamenight_protocol::Avatar::parse` and `head_layout()`. A player portrait is appropriate for vehicles or other non-human characters. Faces, names and colours have separate checks. First-party games must pass all three for release; a colour check does not prove that a face was rendered. ## Artwork for the catalog and lobby Supply separate fields in the shelf entry: ```json { "id":"my-game", "title":"My Game", "cover":"art/cover.png", "icon":"art/icon.png", "screenshot":"art/gameplay.png" } ``` Use a portrait cover for Up next, a square icon for case spines, and a real gameplay screenshot for the TV. They are distinct assets. Colour is an optional accent, not a replacement for artwork. Missing artwork should retain a readable title fallback. Shelf-relative PNG paths are resolved by the host and sent as data URIs. For catalog publication, follow the [catalog guide](https://github.com/ontola/gamepad-party/blob/main/catalog/README.md) and the current manifest validation. Do not put launch paths or credentials in profile messages. ## Verify before shipping Run the [contract checks](https://splitscreen.club/docs/testing) against packaged builds. The versioned requirements distinguish essential play behavior, personalisation and optional party extras. The catalog score uses matching platform/build evidence; source declarations alone do not earn a pass. Also follow the [desktop checklist](https://github.com/ontola/gamepad-party/blob/main/docs/desktop-integration-checklist.md) with real controllers. Test two different profiles, reversed connection order, unplugging a pad, nonzero stick input while the lobby is unfocused, live artwork updates, repeated Back/Resume and several game switches. Synthetic input checks cannot prove physical controller ownership on your machine. # Warp / Luau [Warp](https://github.com/ontola/warp-game-engine) is the open-source (MIT) game engine that Splitscreen Club's own games are made in, such as Neon Siege, Dead Miles and Relay Keepers. Support for Splitscreen Club is built in. With the `warp` executable a game is only Luau scripts, synth sound patches and glTF models: there is nothing to compile, and a file you save reloads in the running game. That makes it the shortest path for a new game, and a good fit for making one with an AI agent. ## What the runtime does for you When Splitscreen Club starts a Warp game, the runtime handles the whole [lifecycle](https://splitscreen.club/docs/lifecycle) without any code from you: - The window stays hidden while the game prepares, and goes fullscreen on Start. - Every seat in the room becomes a player in your game, with the name and colour from their profile. AI seats become bots. - Each player's controller arrives as `input[id]` in your `tick`. - Back goes to the room and pauses the game, Resume continues it, and players who join or leave mid-game do so without a restart. - Start opens a menu with your game's title, Resume and New round. You call `game.finish()` when a match is over, `game.log(text)` to write a line in the room log, and `players.rumble(id, strength, seconds)` to buzz a controller. Not yet available from Luau: match settings in the app, phone buttons and phone screens, and online play. ## Get the warp executable There is no download yet: build it from source with [Rust](https://rustup.rs). ```sh git clone https://github.com/ontola/warp-game-engine cd warp-game-engine cargo build --release -p warp --bin warp ``` The executable is `target/release/warp` (`warp.exe` on Windows). Build on Windows to get the `warp.exe` that you ship. ## Make a game ```sh warp new my-game # a small working starter game warp run my-game # play it, windowed with --windowed warp check my-game # load and run 120 ticks without a GPU: the fastest check ``` A game is a folder: ```text my-game/ game.toml title, players, bots, sky (all optional) main.luau the game: init, tick(dt, input), and more hooks sounds/*.luau synth patches: sounds/pickup.luau is the sound "pickup" assets/ glTF models (.glb, .gltf) scripts/*.json headless playtests types.d.luau the whole API, for reading and editor completion gamenight.json the store facts, as for any game ``` Set `id` in `game.toml` to your game's id from the [developer portal](https://splitscreen.club/developers). The full Luau API, `game.toml` keys and the rules for deterministic games are in the engine's [warp executable guide](https://github.com/ontola/warp-game-engine/blob/main/engine/docs/warp-cli.md). Read `types.d.luau` in your game folder for every function. ## Work with an AI agent `warp run my-game --live` serves the running game over MCP. An agent can then read its state, run Luau in it, edit files (the game reloads and keeps its state), take screenshots and play sounds, while you play. See [live control](https://github.com/ontola/warp-game-engine/blob/main/engine/docs/live-control.md). Without a screen, `warp script my-game my-game/scripts/smoke.json --out out` plays a scripted test, saves frames and sound, and fails when a check fails. Add `KERN_ADAPTER=software` on a machine without a GPU. ## Test and package 1. Play it inside Splitscreen Club, or run the certifier as in [Share your game](https://splitscreen.club/docs/share#3-test-it), with the game's command after `--`: ```sh cargo run --release -p gamenight-certify -- my-game --players 2 -- path/to/warp my-game ``` 2. Package on Windows: the package is `warp.exe` next to a `game/` folder with your game. The engine has a script for it: ```powershell ./engine/crates/warp/tools/package-windows.ps1 -Game my-game -Executable target/release/warp.exe -OutDirectory build/my-game ./build/my-game/warp.exe check build/my-game/game --ticks 600 Compress-Archive -Path build/my-game/* -DestinationPath build/my-game-windows.zip ``` 3. Upload it with `--entrypoint warp.exe` and fill the store page, as in [Share your game](https://splitscreen.club/docs/share#4-upload-a-preview-build) steps 4 to 6. ## In the browser The [browser lobby](https://splitscreen.club/play/) has a curated shelf. It loads Warp games, including Luau games and selected built-in Rust games, and can embed same-origin HTML games with their own browser runtime. A browser release is added to the shelf separately from publishing a desktop build. For a Godot game, [embed its Web export](https://splitscreen.club/docs/godot#embed-a-web-export-in-the-browser-lobby) to use the lobby's players, controllers and pause/resume flow. ## A game in Rust on Warp For more than Luau allows, write the game as a Rust crate on the engine and use its `splitscreen-club` crate for the connection, as Growing Guns, Spellstorm and Sideways do. Start with [Making a game on Warp](https://github.com/ontola/warp-game-engine/blob/main/engine/docs/making-a-game.md). # LÖVE / Lua Use the [shared runner](https://github.com/ontola/gamenight-games/tree/main/love-party) in the separate `ontola/gamenight-games` repository. It handles the Splitscreen Club connection, hidden preparation, pause/resume, window switching and host controller input. The bundled games use this path. ## Run the reference game Install LÖVE 11.5, clone the repository and run from its root: ```sh python scripts/fetch-game-sources.py love ../gamenight-games/love-party ``` The fetch command checks out the revision in `game-sources.json` beside the host repository. For local edits, set `GAMENIGHT_GAMES_DIR` to your game checkout before testing or packaging. This starts the standalone menu. The host supplies `GAMENIGHT=1`, its address, game ID and launch token when launching a managed build. Do not set a made-up token yourself. ## Add your game module Keep simulation in a game module and leave lifecycle handling in the runner. A module defines `new(players, rng)` and `update(state, dt, inputs)`. This is the beginning of the real Neon Trails module: ```lua function M.new(players, rng) local s = { players = players, rng = rng } reset(s) return s end function M.update(s, dt, inputs) if s.intermission then s.intermission = s.intermission - dt if s.intermission <= 0 then reset(s) end return end for i, p in ipairs(s.players) do local c = inputs[i] local dx, dy = 0, 0 if math.abs(c.x) > math.abs(c.y) and math.abs(c.x) > 0.3 then dx = c.x > 0 and 1 or -1 elseif math.abs(c.y) > 0.3 then dy = c.y > 0 and 1 or -1 end if dx ~= 0 or dy ~= 0 then if dx ~= -p.dx or dy ~= -p.dy then p.nextX, p.nextY = dx, dy end end end ``` [Source: games/love-party/games/trails.lua](https://github.com/ontola/gamenight-games/blob/59afa33129507a745b1bcef2a42b59dc0016d105/love-party/games/trails.lua#L30) The input entries belong to the supplied player slots. Do not replace them with `love.joystick.getJoysticks()` in managed mode. The shared input adapter neutralises disconnected devices and frames older than 250 ms. Register a new module in `modes` in [main.lua](https://github.com/ontola/gamenight-games/blob/main/love-party/main.lua), add its renderer and add its ID to `GAMES` in [the packaging script](https://github.com/ontola/gamepad-party/blob/main/scripts/package-love-party.py). These are explicit registries, not automatic plugin discovery. Use an existing game as the full worked example. ## Draw a player face ```lua local Face = require("shared.face") Face.drawFace(player, x, y, 24, { facing = -1 }) ``` `x` and `y` are the centre of the head. The helper draws the skin circle before the transparent artwork, retains space for hats and handles live artwork changes. See [Faces & colours](https://splitscreen.club/docs/faces). ## Keep the shared window path Use `shared.window` and `shared.back_gate`. Prepare before showing the window. Back needs a fresh press after release, and a focus event must never resume a paused game. Keep borderless fullscreen and the helper’s Windows presentation workaround. ## Package and test ```sh python scripts/test-love-simulation.py python scripts/package-love-party.py --output dist/my-party-build ``` The output directory must be new. Packaging builds the registered titles; it does not automatically publish them. Run the [integration suite](https://splitscreen.club/docs/testing) against the resulting packages, then check real controllers and window switching on each target OS. ## Optional performance diagnostics The bundled launcher samples application frame intervals while running and reports them every ten active seconds. It includes GPU, OS and pixel dimensions; CPU and RAM are unavailable. Standalone games send nothing. See the [protocol reference](https://splitscreen.club/docs/protocol#session-diagnostics) for counters, limits and missing-data semantics. These diagnostics contain no accounts, behavioral history or recommendation logic. ## Game settings Use the [settings helper and game reference](https://splitscreen.club/docs/settings) to expose choices, toggles and bounded numbers to the lobby and phone. Validate each change and snapshot round rules when creating a round. # Bevy `gamenight-bevy` is a Bevy plugin that does the Splitscreen Club side of a game for you. Add it next to `DefaultPlugins`, read `GameNightEvent` messages and ask `GameNight` for each seat's controller. The plugin: - connects when Splitscreen Club launched the game and runs standalone otherwise, with the keyboard and every local gamepad as seats, so your input code is the same in both modes; - follows Prepare, Start, Pause, Resume and Dispose, and sends Ready two frames after you call `ready()`, so the first frame of your level exists before Start; - keeps the window hidden and unfocused while warming, shows it borderless fullscreen on Start and Resume and hides it on Pause and Dispose; - pauses every playing `AudioSink` while you are not on the TV and updates at 10 fps while warm or paused, while still hearing Resume; - gives each seat its own controller by host token, with deadzones, press edges and a release required after Start and Resume; - reports activity so nobody is marked asleep, and rumbles a seat's pad; - re-declares your settings, phone buttons, phone screen and text commands after every reconnect, and replays setting changes from your own menu; - reports frame timing every ten seconds of play, with CPU, GPU, OS, memory and window size; - sends F1 to the party (physical Back is the host's own) and exits when the host goes away. The demo game in [`sdk/bevy/demo`](https://github.com/ontola/gamepad-party/blob/main/sdk/bevy/demo/src/main.rs), Star Catch, uses every feature on this page. Each excerpt below is read from it. CI runs it through the [conformance harness](https://splitscreen.club/docs/testing) against a real host on every push. ## Add the plugin The plugin targets Bevy 0.20 (Rust 1.97.1 or newer). Pin a reviewed commit of the public repository: ```toml [dependencies] bevy = "0.20" gamenight-bevy = { git = "https://github.com/ontola/gamepad-party", rev = "YOUR_REVIEWED_COMMIT" } ``` Replace `YOUR_REVIEWED_COMMIT` with an actual commit hash. ## Set up the app Wrap your window in `managed_window`, so a game Splitscreen Club launched starts hidden and unfocused. A window that flashes up while warming steals the TV from the game being played. Run simulation systems only while `gameplay_runs`: that is what freezes play, timers and bots on Pause. ```rust fn main() { let args = Args::parse(); App::new() .add_plugins(DefaultPlugins.set(WindowPlugin { primary_window: Some(managed_window(Window { title: TITLE.into(), resolution: (1280u32, 720u32).into(), ..default() })), ..default() })) .add_plugins(GameNightPlugin::new("bevy-demo")) .insert_resource(ClearColor(Color::srgb(0.06, 0.07, 0.13))) .insert_resource(Match { rules: Rules { round_seconds: args.round.unwrap_or(60), ..default() }, ..default() }) .insert_resource(args) .init_resource::() .add_systems(Startup, (setup, declare)) .add_systems( Update, ( gamenight_events, standalone_start, menu_input, (steer, bots, physics, stars, bombs, round_clock) .chain() .run_if(gameplay_runs) .run_if(menu_closed), (draw_hud, draw_menu, phone_updates, music_volume, shot), ) .chain(), ) .run(); } ``` [Source: sdk/bevy/demo/src/main.rs](https://github.com/ontola/gamepad-party/blob/main/sdk/bevy/demo/src/main.rs#L38) `GameNightPlugin::new` turns the window, audio and throttling on. Set `manage_window`, `fullscreen`, `manage_audio`, `throttle_when_hidden` or `report_activity` to false to handle one of them yourself. ## Follow the session Every message from Splitscreen Club arrives as a `GameNightEvent`. On Prepare, build the level for exactly the seats you were given, then call `ready()`. Opt into live roster changes with `participation(true)` first if new players can join mid-round, as here. Nothing restarts on `RosterChanged` or `PlayersUpdated`: newcomers get a pawn, leavers lose theirs, and a new name, colour or face is painted onto the same pawn. ```rust fn gamenight_events( mut commands: Commands, mut gn: ResMut, mut events: MessageReader, mut game: ResMut, mut menu: ResMut, art: Res, mut images: ResMut>, mut materials: ResMut>, balls: Query<(Entity, &Ball)>, stars: Query, With, With)>>, mut music: Query<&mut AudioSink, With>, ) { // Pawns despawned earlier in this batch (Dispose then Prepare arrive together). let mut gone = Vec::new(); for event in events.read() { match event { GameNightEvent::Prepare { seats, players, .. } => { // Load everything while hidden. New players can drop in mid-round. gn.participation(true); *menu = Menu::default(); let rules = game.rules.clone(); *game = Match { rules, ..default() }; clear(&mut gone, &mut commands, &balls, &stars); spawn_balls( &mut commands, &gn, seats, players, &art, &mut images, &mut materials, &mut game, ); new_round(&mut commands, &mut game, &art); game.started = true; gn.ready(); } // The plugin shows the window and plays audio on Start and Resume, // and hides and pauses them on Pause. Simulation systems run only // while `gameplay_runs`, so there is nothing else to do here. GameNightEvent::Start { .. } | GameNightEvent::Pause { .. } | GameNightEvent::Resume { .. } => {} GameNightEvent::Dispose { .. } => { clear(&mut gone, &mut commands, &balls, &stars); game.started = false; } GameNightEvent::RosterChanged { seats, players, .. } => { // Keep the match going: add newcomers, drop pawns of those who left. let mut known = Vec::new(); let alive: Vec<(Entity, &Ball)> = balls.iter().filter(|(e, _)| !gone.contains(e)).collect(); for (entity, ball) in alive { let still = seats .iter() .any(|s| s.index == ball.seat && s.occupant.player_id() == ball.player); if still { known.push(ball.seat); } else { commands.entity(entity).try_despawn(); gone.push(entity); } } let fresh: Vec = seats .iter() .filter(|s| !known.contains(&s.index)) .cloned() .collect(); spawn_balls( &mut commands, &gn, &fresh, players, &art, &mut images, &mut materials, &mut game, ); } GameNightEvent::PlayersUpdated { players } => { // A new name, colour or face for the same player: repaint, never restart. for (entity, ball) in balls.iter().filter(|(e, _)| !gone.contains(e)) { if let Some(player) = players.iter().find(|p| Some(p.id) == ball.player) { commands.entity(entity).despawn_children(); dress( &mut commands, entity, Some(player), ball.seat, &gn, &art, &mut images, &mut materials, ); } } } GameNightEvent::SettingChanged { key, value } => { game.rules.apply(key, value); } GameNightEvent::PlayerSettings { player_id, .. } => { for (entity, ball) in balls.iter().filter(|(e, _)| !gone.contains(e)) { if ball.player == Some(*player_id) { commands.entity(entity).despawn_children(); let player = gn.player(*player_id).cloned(); dress( &mut commands, entity, player.as_ref(), ball.seat, &gn, &art, &mut images, &mut materials, ); } } } GameNightEvent::ActionTriggered { key, player_id } if key == "new_round" => { let who = gn .player(*player_id) .map_or("Someone".into(), |p| p.name.clone()); info!("{who} asked for a new round"); new_round(&mut commands, &mut game, &art); } GameNightEvent::CompanionMessage { player_id, data } => { if data.get("action").and_then(|a| a.as_str()) == Some("dash") { for (entity, ball) in balls.iter().filter(|(e, _)| !gone.contains(e)) { if ball.player == Some(*player_id) { commands .entity(entity) .entry::() .and_modify(|mut b| b.phone_dash = true); } } } } GameNightEvent::CompanionPresence { player_id, connected: true, } => { let view = phone_view(&gn, &game, *player_id); gn.companion_message(Some(*player_id), view); } GameNightEvent::GameCommand { id, text, .. } => { let (ok, answer) = command(&mut gn, text); gn.command_result(id.clone(), ok, answer); } GameNightEvent::HostMusic { playing } => { if let Ok(mut sink) = music.single_mut() { sink.set_volume(Volume::Linear(if *playing { 0.0 } else { 0.35 })); } } _ => {} } } } ``` [Source: sdk/bevy/demo/src/main.rs](https://github.com/ontola/gamepad-party/blob/main/sdk/bevy/demo/src/main.rs#L449) Prepare can follow a Dispose in the same frame (a replay, a skip). Despawn with `try_despawn` and skip entities you already removed in the same batch. ## Read each seat's controller `gn.pad(seat)` returns the seat's controller for this frame: neutral when the seat has none, when input is more than 250 ms old and while the game is not running. `stick` applies a radial deadzone (up is positive y, as in Bevy's world), `trigger` a trigger deadzone. `just_pressed` is true once per press, and a button still held from the lobby has to be released before it counts. Never use Bevy's gamepad order under Splitscreen Club: a seat's controller is a host token. ```rust fn steer( gn: Res, mut game: ResMut, mut balls: Query<&mut Ball>, time: Res