Skip to content

Latest commit

 

History

History
49 lines (39 loc) · 4.16 KB

File metadata and controls

49 lines (39 loc) · 4.16 KB

Driver Feedback

Reference for current phone-side sound and vibration feedback. This is useful when tuning the game feel because controller feedback is part of the driving model, not just polish.

Browser Limits

  • Audio is generated with Web Audio on the phone controller.
  • Motion steering prefers deviceorientation, falls back to devicemotion gravity tilt, then tries Chrome's Generic Sensor GravitySensor/Accelerometer path when legacy orientation events do not deliver. iOS Safari/WebKit requires an explicit Enable Tilt tap so the browser can show its motion/orientation permission prompt. Chrome/Chromium and iOS Safari/WebKit require HTTPS; plain LAN http:// can leave the app in touch steering fallback even when the API exists.
  • Race countdown captures a stable median neutral baseline before sending motion steering. If the phone stays portrait, the app asks the player to turn sideways instead of saving a portrait steering center. Race motion steering also re-centers when the phone changes orientation frame.
  • Race touch steering deliberately overrides motion steering while an arrow is held. This prevents partial/noisy sensor events from fighting the fallback controls on mobile browsers.
  • Vibration uses navigator.vibrate().
  • Web vibration can vary pulse duration and patterns, but not reliable motor amplitude/intensity/sharpness like native Android or iOS haptics.
  • iOS Safari does not support web vibration. Android Chromium/Samsung-style browsers are the main target. Firefox Android may expose partial or no-op support.
  • Android Chrome/Samsung browsers can expose the API and return success while the phone suppresses the motor. Check Silent mode, Do Not Disturb, power saving, and the Android/Samsung touch vibration or system haptics settings when the app says a pulse was requested but nothing is felt.

Audio

  • Start/test cue: short confirmation tone when audio is enabled or tested.
  • Audio test also triggers a small on-screen pulse preview on the phone controller.
  • Countdown: server-marked 5/4/3/2/1 beeps after audio is unlocked, followed by a louder/lower GO cue only after the server reports the race phase has started.
  • Engine: persistent tone follows car speed and throttle.
  • Tire: filtered noise follows slip, grass/off-road driving, and curb contact.
  • Brake: tone fades in during braking at speed.
  • Curb: low rumble follows curb contact at speed.
  • Impact: short thud cue when impact is above threshold.
  • Explosive crash: stronger boom cue for the crashing player when an actual car-to-car crash or very hard wall hit emits a shared crash event.
  • Nearby rivals: during racing, each phone receives only the nearest few rival audio descriptors and mixes a quiet stereo-panned engine/air layer for close cars and pass-bys.
  • Nearby crashes: non-self crash events inside a short radius play as lighter panned booms so nearby players hear them without getting the crashing player's strongest cue.
  • Race exit: all persistent layers fade out outside countdown/racing.

Vibration

Speed thresholds below use the same km/h scale shown on the in-game speedometer.

  • Test pulse: [120, 60, 180].
  • Haptic test also triggers a small on-screen pulse preview on the phone controller.
  • Explosive crash: [120, 45, 190, 55, 90] for the crashing player.
  • Impact: one pulse, roughly 45-140ms depending on impact strength.
  • Hard braking: [18, 24, 18] when braking hard above about 35 km/h.
  • Curb: 18ms pulse while on curbs above about 18 km/h.
  • Grass/off-road: 24ms pulse while on grass above about 20 km/h.
  • High slip: 16ms pulse when slip is high above about 25 km/h.
  • Tuk-tuk tip risk: provisional [14, 38, 20] warning pattern when speed, steering, slip, and curb load are close to rollover. Keep this under review; it should feel like a useful warning, not a constant alarm.

Current Gap

  • Clean cornering g-force is not a separate continuous haptic layer.
  • Cornering feedback currently comes through tire sound and high-slip vibration when the car starts to slide.
  • Full scene-wide spatial audio is not implemented. Current relative audio is intentionally limited to nearby rival cars and nearby crash cues; earphones still make the layered feedback clearer.