Bifrost
A competitive Breakout/Pong arena used to demonstrate rollback peer-to-peer sessions in a browser-friendly stack. Small scope on purpose: if netcode is wrong here, it will be wrong everywhere.
The improved Bifrost tree lives as web/bifrost: an independent Compose stack (not folded into the Arathyll nexus). Production serves a dedicated game origin; Arathyll Lab embeds that origin in an iframe. Local preview uses http://127.0.0.1:1334.
Approach
- Deterministic simulation core (
bifrost_sim): fixed-point arena state, replay codes, checksums; separate from Bevy rendering. - GGRS rollback via
bevy_ggrs+ Matchbox WebRTC transport; inputs predicted locally, corrected when authoritative frames arrive. - Ephemeral private rooms: no accounts, no match database; host/guest tickets live in memory and expire.
- Live inspector: RTT, input delay, rollback depth, and checksum on the hosted demo.
How we run it (ops shape)
Public details stay high-level on purpose: enough to review the architecture, not a hardening playbook.
- Own origin: The WASM client and signaling API share a game host separate from the marketing/Lab site. Lab iframes that origin; CSP
frame-ancestorslimits who can embed it. - Edge TLS + reverse proxy: HTTPS terminates at the edge; HTTP routes to a small room/signaling service and a static WASM shell. Matchmaking WebSockets are path-scoped on the same host.
- Ephemeral signaling only: Create/join issues short-lived tickets. Gameplay inputs travel peer-to-peer after the handshake; the signal process does not store match history or accounts.
- NAT relay when needed: Browsers behind hard NATs get short-lived TURN credentials from the API and may relay media/data through an operator-run Coturn. STUN alone is not assumed sufficient for cross-network play.
- Compose-shaped deploy: Signal, static web, and optional TURN run as containers; on a shared VPS they attach to the site edge network instead of binding their own :443.
Privacy posture: no accounts, no durable room store, tickets stay out of shareable URLs. See the open repo’s privacy notes for peer-address implications of WebRTC.
Why it matters for clients
The same patterns apply to larger titles and to distributed systems that need agreed state under delay: deterministic simulation, input queues, snapshot correction, and a clear split between “introduce peers” and “authoritative sim.” Bifrost is the reference we can walk through in an interview or architecture review.
Try it
-
Play in Lab
Create room, play bot, or open the inspector (iframe to the Bifrost origin).
-
Source Repository
Independent Compose stack for the Bifrost client and signal server.
-
Betwixt Engine
Where these ideas graduate to full-game scale.