Shape-Shift Racer by Sarthak
Welcome to Shape-Shift Racer by Sarthak, a high-octane 2.5D retro synthwave arcade racer engineered with pure mathematical perspective projection, real-time vehicle morphing mechanics, procedural Web Audio synthesis, and cutting-edge on-device facial expression artificial intelligence. Race across endlessly curving neon highways, morph between vehicle forms at blazing speeds, dodge laser low beams and narrow pillar gates, collect energy coins, and build massive multiplier streaks!
How to Play & Game Objectives
Your objective in Shape-Shift Racer is simple yet intensely demanding: navigate a continuous 3-lane neon superhighway, survive increasingly treacherous gauntlets of obstacles, and push your score and distance as far into the synthwave sunset as your reflexes allow.
As you race forward, the game engine continuously accelerates your vehicle from an initial cruising speed of 420 km/h up to a blistering maximum of 920 km/h. Each 500 meters traveled dynamically shifts your racing environment into a new visual biome with unique color palettes, mountain horizons, and retro sunsets:
1. Sunset Drive (0–500m)
Warm golden solar disc, deep violet skies, magenta curb accents, and dark asphalt reflecting the evening glow.
2. Cyber Night (500–1000m)
Electric cyan sun, deep cobalt starfield, pulsing turquoise curbstones, and high-contrast night highway visibility.
3. Neon Tokyo (1000–1500m)
Emerald green horizon, hot pink mountain skylines, lime curb lighting, and intense futuristic urban energy.
4. Plasma Storm (1500–2000m+)
Blazing crimson skies, molten amber solar flare, yellow-orange curb markers, and top-tier highway velocity.
Surviving each biome requires quick reaction times, anticipation of upcoming track curvature, and seamless mastery of your vehicle's three transformational morphing configurations.
Morphing Mastery & Obstacle Clearance
Traditional racing games confine you to a static vehicle body. In Shape-Shift Racer, your car is an advanced modular cyber-craft capable of instantaneous geometric metamorphosis. Obstacles spawned along the highway specifically test either your lateral lane steering or your vehicle cross-section clearance:
| Vehicle Mode | Dimensions | Facial Gesture | Keyboard Key | Target Clearance |
|---|---|---|---|---|
| CRUISER (Normal) | 84 × 50 px | Relaxed / Neutral Face | Space | Standard cruising; evades single & double-lane RoadBlocks. |
| LOW-RIDER (Flat) | 136 × 22 px | Smile Wide | Down Arrow / S | Slides underneath overhead LowBeams (30 px clearance gap). |
| SLIM-BLADE (Narrow) | 32 × 100 px | Open Mouth (O-Shape) | Up Arrow / W | Squeezes through twin PillarGates (48 px gap width). |
Understanding Clearance Physics
The collision detection engine computes real-time bounding box intersections at your vehicle's longitudinal depth (CAR_Z = 40.0):
- LowBeam Barriers: Spanned horizontally across all three lanes with an open clearance height of exactly 30 pixels. When driving the CRUISER (height 50 px) or SLIM-BLADE (height 100 px), you will suffer an immediate collision. Morphing into the ultra-flat LOW-RIDER (height 22 px) grants 8 pixels of safe clearance, letting you glide underneath unharmed.
- PillarGate Barriers: Heavy vertical twin concrete pillars with a centered or lane-shifted opening of exactly 48 pixels. Neither the wide CRUISER (width 84 px) nor the extra-wide LOW-RIDER (width 136 px) can pass without colliding. Only the aerodynamic SLIM-BLADE (width 32 px) can thread this needle, leaving 16 pixels of lateral tolerance.
- RoadBlock Barricades: Impassable single or double-lane barricades placed at road level. No shape can drive through a RoadBlock; you must steer laterally into an unoccupied adjacent lane.
- Gauntlet Waves: High-speed sequences where LowBeams, PillarGates, and RoadBlocks are spawned back-to-back, demanding instantaneous combinations of steering shifts and vehicle transformations in under a fraction of a second.
Dual Control Guide: Vision, Keyboard & Touch
Shape-Shift Racer is built to be playable on any modern device, providing three fully featured and seamlessly unified input modalities:
1. On-Device Vision & Facial Expression AI
By toggling the camera on, you can pilot your vehicle using natural head gestures and facial expressions:
- Steering (Head Pose Yaw / Roll): Gently turn your head to the left or tilt your chin left to glide into the left lane. Turn or tilt right to steer right. Keep your head facing forward to center your car in the middle lane. A built-in 0.18 deadzone prevents accidental drifting.
- Flat Morph (Smile Expression): Smile broadly to trigger the LOW-RIDER shape. The vision pipeline monitors lip corner elevation and mouth stretch blendshapes to detect smiles reliably.
- Narrow Morph (Open Mouth Expression): Open your mouth or drop your jaw into an "O" shape to activate the SLIM-BLADE morph.
- Normal Cruiser (Relaxed Face): Return your facial muscles to a relaxed resting expression to morph back into the standard CRUISER.
2. Desktop Keyboard Controls
For traditional arcade precision or low-light gaming environments:
- Steering: A / D or Left / Right Arrow Keys to shift lanes.
- Morph Flat: S or Down Arrow Key.
- Morph Narrow: W or Up Arrow Key.
- Morph Normal: Spacebar (also starts the game and restarts after Game Over).
- Pause & Settings: P or Escape to open the Pause menu.
- Audio Toggle: M key to mute or unmute procedural music and sound effects.
3. Mobile Multi-Touch HUD
When playing on mobile phones or tablets, an ergonomic on-screen touch HUD appears automatically:
- Left Thumb Cluster: Tactile left and right steering arrow pads for rapid thumb lane snapping.
- Right Thumb Cluster: Color-coded shape morph buttons: Hot Pink (Flat), Cyan (Normal), and Lime Green (Slim).
- Top Right Utility Buttons: Quick-access Audio mute and Pause buttons.
- Input Priority Guarantee: Keyboard and touch inputs always take instantaneous priority over webcam vision tracking, ensuring you always have full tactile override capability.
On-Device Facial AI Technology & Signal Processing
The vision subsystem inside Shape-Shift Racer represents a significant technical accomplishment in browser-based machine perception. Unlike cloud-dependent AI applications that transmit your video to remote servers for processing, Shape-Shift Racer runs 100% locally on your CPU/GPU hardware using Google MediaPipe Tasks Vision compiled to WebAssembly.
To achieve responsive, esports-grade responsiveness without sacrificing frame rates or overheating mobile devices, the system incorporates four key algorithmic layers:
- Decoupled Thread Execution: The 2.5D pseudo-3D rendering loop operates at a silky smooth 60 frames per second using requestAnimationFrame. Vision landmark extraction runs on an independent async schedule throttled to 20–30 Hz. This decouples CPU-intensive neural network inference from rendering, guaranteeing zero dropped frames during gameplay.
- One-Euro Adaptive Filtering: Raw facial blendshapes and head pose angles from webcam feeds naturally contain high-frequency sensor noise. Shape-Shift Racer processes all continuous control signals through adaptive One-Euro filters (f_c = f_{c,min} + beta * |dx/dt|). At rest, the cutoff frequency drops to eliminate jitter; during rapid head movements, the cutoff frequency expands to eliminate lag.
- Expression Hysteresis & Cross-Suppression: To eliminate jittery rapid flipping between shapes at threshold boundaries, the state machine implements asymmetric Schmitt-trigger hysteresis. A gesture must exceed an activation threshold of 0.42 to trigger a morph, and must fall below 0.28 to release. Furthermore, a 0.12 mutual margin and cross-suppression prevent conflicting smile and open-mouth signals from firing simultaneously.
- Fast Auto-Zero & 3-Step Interactive Calibration: Every human face possesses unique resting geometry. Upon starting the camera, an automated 1-step calibration measures your neutral baseline over the first 10 frames. In addition, players can pause at any time to run an optional 3-step interactive calibration wizard (Neutral → Full Smile → Wide Open Mouth) or manually adjust individual sensitivity sliders.
Gestures FAQ & Troubleshooting
How should I set up my lighting for best tracking?
Ensure your face is evenly illuminated from the front or slightly above. Avoid strong backlights, such as sitting with an unshaded window or bright lamp directly behind your head, which casts your face in deep shadow and makes landmark detection difficult.
Can I play while wearing eyeglasses?
Yes! MediaPipe Face Landmarker tracks facial musculature around the mouth and cheeks, as well as 3D head orientation. If your lenses produce heavy glare or reflections that obscure your eyes, slightly tilt your monitor or adjust your room lighting to minimize lens glare.
What is the ideal distance from the camera?
Position yourself approximately 40 to 70 centimeters (arm's length) from your webcam or laptop screen. Frame your face comfortably within the upper-middle region of the optional picture-in-picture preview box.
What happens if I deny camera permissions?
The game immediately and gracefully falls back to keyboard and touch mode with zero penalty or restriction. You can play every track, biome, and mode without a camera. You can also re-enable the camera anytime via your browser's address bar permissions icon.
Scoring Strategy, Multipliers & Leaderboards
Climbing the local Top-5 high score leaderboard requires balancing pure survival with calculated risk-taking:
- Base Obstacle Clear: 100 points for every LowBeam, PillarGate, or RoadBlock cleanly bypassed.
- Energy Coins: 50 points for each spinning golden coin collected. Coins are strategically positioned inside optimal morph clearance gaps, rewarding players who line up perfect lines.
- Near-Miss Bonus: 50 bonus points awarded whenever you thread a PillarGate or LowBeam within close lateral or vertical clearance margins without taking damage.
-
Streak Multipliers: Consecutive clean obstacle clears build your active streak:
- Streak 0–2: 1x multiplier
- Streak 3–5: 2x multiplier
- Streak 6–9: 3x multiplier
- Streak 10+: 5x maximum multiplier!
- Lives & Recovery: You start with 3 lives represented by neon hearts in the telemetry HUD. Taking a hit triggers screen shake, a crimson visual flash, resets your streak multiplier back to 1x, and provides 1.5 seconds of damage invulnerability to recover your line.
- Persistent Top-5 Leaderboard: Your top five high scores, distances traveled, coin totals, max streaks, and run dates are preserved safely inside browser localStorage so your personal records are ready to challenge on your next visit.