RCWeb Tilt Maze Control App

The RCWeb Tilt Maze Control App (app/tilt-maze-control) acts as a dedicated 6-axis hardware sensor module. Relying on the Asymmetric Pattern, it extracts live orientation telemetry from mobile accelerometers and broadcasts it to the main 3D engine.

Screenshot

screenshot

What it does

  • Hardware Sensor Extraction: Transmutes physical device rotation into raw tiltX and tiltZ vectors.
  • On-Screen Telemetry preview: Provides a live visual LCD readout and dot-matrix UI grid showing the user exactly what tilt data is currently being transmitted to the server.
  • Fallback Mechanics: If a user's browser rigidly blocks gyroscopic data or they are using a desktop mouse, the screen automatically reconfigures into a virtual D-Pad interface allowing tactile overriding of the maze angle.

How it works

The core script.js resolves numerous mobile browser security workarounds to achieve clean streaming telemetry.

  • Permission Orchestration: Because modern HTML5 explicitly blocks the DeviceOrientationEvent behind a strict user-gesture permission wall, the UI requires the user to manually click an "Enable Motion" button, resolving a Promise before native polling can commence.
  • Coordinate Normalization: The script captures the beta (forward/back) and gamma (left/right) rotational degrees. It tracks a baseline offset derived from the exact physical angle the phone was held at when the app initialized via deltaAngle.
  • Bandwidth Throttling: The native DeviceOrientationEvent often fires 60-120 times a second, which would instantly flood the WebSocket. The engine manually intercepts the event loop, securely buffering the state and implementing a strict SEND_INTERVAL_MS = 100 exit gate to limit outbound packets to a safe 10hz.
  • Orientation Lock: It natively invokes window.screen.orientation.lock("portrait") preventing the browser from scrambling the X/Y axes if the player tilts their phone too aggressively downward.
DocumentationServer TelemetryServer StatsServer HTTP LogServer WebSocket Log