Log inGet started
World

Save Point

Branchmain
Branchesmain
Commit8937fc8d08

README.md

RetroStation

Makes a console prop playable and shared. Put it on the root of a console model that carries a Holdable (a handheld) and a child entity whose Model draws the screen material bound to texGuid.

  • Runs where it is held. The emulator core named by core (any emulatorCore in the world: the Game Boy, NES, CHIP-8, ...) runs only on the peer whose avatar holds the console, at the console's own frame rate, so the player's input has no network delay. Its sound plays for that player.
  • Shares the picture. That peer streams the screen to everyone else about streamHz times a second as delta frames (only what changed; a full frame each second), within streamBudget bytes a second. Every other peer draws the frames into its copy of the screen.
  • Shares the buttons. pad holds the held buttons (bits 0–3: right, left, up, down; bits 4–7: A, B, select, start), written by whatever plays the console (HandheldPlay) and synced, so every peer can press the model's buttons (GbButtons).
  • Passes the game on. When the console changes hands the outgoing peer sends the whole machine (snapshot() on the core's machine) to the new holder, who resumes the same game. A core without snapshots restarts from its battery save.

Fields: core, romPath, texGuid, streamHz, streamBudget, volume, pad (Sync), status. Methods: isRunning(), setPad(bits) (the holder's peer), machine().