# RCWeb Spacewar Control App

The **RCWeb Spacewar Control App** (`app/spacewar-c`) is the dedicated web peripheral designed for the base `spacewar` arcade shooter, operating strictly in the **Asymmetric Pattern**.

![icon](pwa-512x512.png "Spacewar Control App Icon")

## Screenshot
![screenshot](screenshot.png "Spacewar Control App")

## What it does

- **Retro Three-Button Interface**: Strips the smartphone interface down to a classic arcade cabinet layout featuring dedicated "Left", "Right", and "Fire" digital push-buttons.
- **Tactile Firing**: Leveraging native device APIs, hitting the Fire button or steering triggers localized vibrational pulses directly on the user's phone for physical confirmation of successful network transmissions.

## How it works

The logic deliberately avoids continuous vector broadcasting, relying instead on state-change event triggers within `script.js`.

- **Event Short-circuiting**: DOM controls (`mousedown`, `touchstart`) strictly execute `e.preventDefault()` to lock the mobile viewport, preventing accidental pinch-zooms or pull-to-refresh gestures during intense button mashing.
- **State Booleans**: To prevent flooding the WebSocket pipeline with redundant "I am turning left" packets every millisecond the button is held, it relies on static booleans (`rotatingLeft`, `rotatingRight`). It fires a single `rc.sendFunctionCall(..., 'left')` command once when depressed, and a singular `'forward'` release command when the finger is lifted.
- **Haptics Pipeline**: Implements defensive vibration coding (`if ("vibrate" in navigator) navigator.vibrate(period)`) to trigger physical hardware rumbles natively via the browser engine upon aggressive input logic, bypassing the server entirely for feedback.
