RCWeb Spacewar 2D Control App

The RCWeb Spacewar 2D Control App (app/spacewar2d-control) is the upgraded remote interface for the canvas-based shooter, mirroring the Asymmetric Pattern deployment while heavily upgrading local mobile sensory feedback.

Icon

icon

Screenshot

screenshot

What it does

  • Digital Pilot Controls: Maintains the familiar three-button layout (Left, Right, Fire) utilized in the classic implementation but refines the touch-capture boundaries for multi-touch support.
  • Local Audio Synthesis: Transforms the phone into an active sound emitter. When the user fires a laser or their ship explodes on screen, the sound effects are synthesized and played out of the smartphone speaker perfectly synchronized with the action, not just from the host TV/Monitor.
  • Real-Time Score Polling: Parses score updates routed natively down the WebSocket tunnel, updating a dedicated heads-up display on the phone's UI.

How it works

The framework in script.js tightly integrates network pushing alongside native mobile hardware APIs.

  • Asymmetric Audio Generation: It duplicates the complex WebkitAudioContext synthesis logic found in the main game. Functions like playSound('laser') are executed directly upon the touchstart event locally, meaning the user hears their laser beam with zero milliseconds of network round-trip latency, while the graphical beam renders on the host screen immediately after.
  • Audio Context Unlocking: Mobile browsers strictly forbid audio execution until user interaction. The app explicitly binds document.addEventListener("touchstart", initAudio, { once: true }) globally to silently wake the engine up so the first laser shot doesn't clip or fail.
  • Clean State Tracking: Pushes lightweight spacewar2d.left() strings via rc.send. Variables like rotatingLeft suppress infinite event loops while users pin down their thumbs.
DocumentationServer TelemetryServer StatsServer HTTP LogServer WebSocket Log