Platforms: PC today, consoles and phones later
We build for Windows PC first. But the architecture is ready for consoles, phones and other devices, so that anyone can add them later without rewriting the project. This page explains how.
Status: only the PC path is built. Everything else on this page is a designed route that is waiting for a contributor. See IDEAS.md (“Other devices”) for how each route was judged.
The three roles
Section titled “The three roles”Every setup is made of the same three roles. Only the devices change.
| Role | What it does | Today (PC) | Later, on other devices |
|---|---|---|---|
| Hub host | Runs the hub: the rules, question choice, progress | The desktop app on the PC | A PC or home server next to a console; a phone app; a small server |
| Game integration | Reports game events and applies rewards | Hollow Knight mod (C#) | A Minecraft Bedrock behavior pack on a dedicated server; a “manual” button on a phone |
| Surface | Shows questions and takes answers | Electron overlay | A phone page; a TV app; the game’s own UI (in-game forms) |
They talk with the same protocol over WebSocket, wherever they run.
What makes this possible (already built)
Section titled “What makes this possible (already built)”- Surfaces describe themselves. A screen says what it is and how the player answers (
surface: { kind: "phone", input: ["touch"] }). The hub can adapt text length, hints and audio. Older screens that send nothing still work. - Games can show questions in their own UI. A game integration that declares
capabilities.surfacereceiveschallenge,feedbackandrewardmessages and may sendanswer. This is how a console player answers inside Minecraft Bedrock, or how a future Hollow Knight in-game card works. Tested inpackages/hub/src/server.test.ts. - The core runs anywhere.
@game-learning/core, the protocol messages and the content schemas use no Node-only APIs, so they can run in a phone app, a browser or a game server. A test (packages/core/src/portable.test.ts) fails if someone adds Node-only code there. File access is separate (@game-learning/content/fs), and so is the discovery file (@game-learning/protocol/discovery). - The hub’s network address is a setting (
host), kept on this computer only by default.
Routes for other devices
Section titled “Routes for other devices”A. Phone companion (any game, any console) — easiest
Section titled “A. Phone companion (any game, any console) — easiest”- Surface: a web page on the phone, served by the hub.
- Game integration: none, or a “manual” one: the same page also connects as a game peer that only sends
player.diedwhen the player taps “I died” (or on a timer). No effects. - Needs: LAN pairing (below).
B. Consoles and phones through Minecraft Bedrock — real game events
Section titled “B. Consoles and phones through Minecraft Bedrock — real game events”- Players on Xbox, PlayStation, Switch, iOS and Android join a Bedrock Dedicated Server running on the PC.
- A behavior pack (Bedrock Script API) on that server is the game integration: it sends
player.died, applies rewards, and declarescapabilities.surface: { kind: "in-game", input: ["controller", "touch"] }to show questions as in-game forms (@minecraft/server-ui). - The server runs next to the hub, so it can connect to
127.0.0.1— no LAN pairing needed.
C. Android overlay app
Section titled “C. Android overlay app”- A native or React Native app draws over games (Android allows overlays) and acts as a surface; with route A’s manual triggers, or later screen detection.
- The core and protocol packages can run inside the app’s JavaScript; the hub host could be the phone itself or a PC.
D. iOS
Section titled “D. iOS”- iOS does not allow drawing over other apps. Use route A (phone companion) or route B (Minecraft).
LAN pairing (built: phone as an answer pad)
Section titled “LAN pairing (built: phone as an answer pad)”Tray icon → Phone as answer pad → Connect a phone… (packages/hub/src/phone-gateway.ts):
- The app starts a separate phone gateway on the home network (port 47475). It stays off until a phone is connected for the first time; after that it starts with the app.
- A QR code holds the address and a one-time pairing code (valid 5 minutes). The phone exchanges it for its own device token. The hub’s main token never leaves the PC: phones even get their own audio links.
- Phones are screens only: they see and answer questions, and cannot act as a game (so they cannot fake events or rewards).
- Only private network addresses are accepted (home Wi-Fi). Forget all phones removes every device token and stops the gateway.
- The phone page is plain HTML served by the gateway: no app to install. It supports every question kind, Arabic (right to left) and audio.
Plain HTTP is fine on a home network; do not use it on public Wi-Fi. The main hub still listens on 127.0.0.1 only.
Adding a platform: checklist
Section titled “Adding a platform: checklist”- Pick the route above, and open an issue that links this page.
- Reuse
@game-learning/protocolfor message shapes (TypeScript) or the JSON Schema files inpackages/protocol/schema/(other languages). - Declare only what you really support (events, effects, surface). Rewards still count only after the game confirms them (ADR 0004).
- Follow PRIVACY.md: children’s data stays on their devices.
- Add your integration under
integrations/or your surface underapps/, with a README.