Skip to content

five-on-it / apps/client/src/renderer/main

apps/client/src/renderer/main ​

Renderer entrypoint: waits for the game's typeface (fonts/fonts.ts), then starts what the address asks for (ui/boot.ts): the main menu (a bare address or ?menu), a gallery, a game page, or the game. For the game it loads the physics WASM, reads the game server's WebSocket URL from the page's server query parameter (set by the Electron main process, or by hand in a browser; the default is /game on the page's own origin when the page comes over HTTP, which Vite's dev server and the Compose stack's proxy pass to the game server, and port 7777 on localhost from a file; secure when the page is) with the level ?level= asks for on it (the server opens that level's room), mounts the React overlay (the helper UI and the stats; the in-game UI is the game's own, drawn in its scene), connects, waits for the server's welcome (which carries the level) and starts the game; a server lost in play is joined again (the page reloaded) as soon as it answers. When the welcome says the server offers a WebRTC data channel, the inputs and the snapshots move onto it (rtc.ts), the WebSocket keeping the rest and taking them back if it fails; ?rtc=0 keeps them on the WebSocket. ?colliders=1 starts with the collision wireframe drawn over the level. An address that asks for a game page (?browse, ?game=<id>: ui/browse.ts) shows that page instead, and no game starts; ?anim-gallery shows the animation gallery (every clip of the people on a mannequin, anim-gallery.ts) and ?vehicle-gallery the vehicle gallery (every class with people in its seats, its doors swinging, vehicle-gallery.ts), and ?kit-gallery the kit gallery (every building, prop, terrain tile, feature and road class a game can be built of, kit-gallery.ts), and ?sound-board the sound board (every sound and radio station, where a file goes to replace each: sound-board.ts), no server needed. The page's social side (social.ts: the room's chat and roster, friends and the party through the platform) starts with the connection; Enter opens the chat when the keys are the game's. A page back from a Steam sign-in takes its one-time code first (ui/steam.ts: exchanged for a session, the address cleaned of it); a city its platform will not place the player in (/play refused: a platform for the game's owners, no Steam account or no copy) shows why, "Sign in through Steam" and "Get it on Steam" instead of the game (ui/PlayRefused.tsx), and no guest plays it; the desktop app that signed in through Steam on this device before signs in again with its ticket first.