Bottle Cap River Drift Racing Simulator
Bottle Cap River Drift Racing Simulator — Detailed Game Mechanics Guide
1. World Coordinate Space & 9:16 Viewport Architecture
Designed specifically for vertical mobile viewing and short-form video broadcasting ($9:16$ aspect ratio), the simulation runs on a custom 60 FPS HTML5 Canvas physics and rendering pipeline.
- Logical Canvas Dimensions: Width $W = 540\text{ px}$, Viewport Height $H = 960\text{ px}$ (automatically scaled for high-DPI Retina displays).
- Course Length & Scale:
- Starting Floodgate Coordinate: $Y_{\text{start}} = 260\text{ px}$
- Checkered Finish Line Coordinate: $Y_{\text{finish}} = 12260\text{ px}$
- Total Racing Distance: $\Delta Y = 12000\text{ px}$ (displayed on the HUD at a scale of $1\text{ m} = 100\text{ px}$, or $120.0\text{ m}$ total).
- Average Race Duration: $42$ to $52$ seconds per run.
2. Contestant Profiles & Physical Properties
Four distinct metallic crimped bottle caps line up evenly across the starting floodgate at the beginning of every race:
| Slot | Contestant Name | Short Code | Emblem | Primary Color | Radius ($r$) | Crimped Teeth |
|---|---|---|---|---|---|---|
| 1 | Crimson Blaze | RED | 🔥 | #ef4444 | $19.5\text{ px}$ ($39\text{ px}$ dia.) | $21$ ridges |
| 2 | Cobalt Wave | BLU | 🌊 | #3b82f6 | $19.5\text{ px}$ ($39\text{ px}$ dia.) | $21$ ridges |
| 3 | Volt Flash | YEL | ⚡ | #eab308 | $19.5\text{ px}$ ($39\text{ px}$ dia.) | $21$ ridges |
| 4 | Jade Vortex | GRN | 🍀 | #10b981 | $19.5\text{ px}$ ($39\text{ px}$ dia.) | $21$ ridges |
- Dynamic State Vectors: Each cap tracks position $(x, y)$, velocity $(v_x, v_y)$, orientation angle $\theta$, angular velocity $\omega$, wake trail particles, and cumulative race telemetry (overtakes, rock/pack collisions, rapid boosts, and top speed).
- Visual Spin Indicator: An 8-point star emblem stamped on each cap's dome makes rotational spin and vortex torque immediately visible.
3. Seeded Procedural S-Curve Track Generation
3.1 Deterministic Seeded RNG (LCG)
Every river course is procedurally generated using a deterministic Linear Congruential Generator (LCG): $$\text{Seed}_{n+1} = (1664525 \cdot \text{Seed}_n + 1013904223) \bmod 2^{32}$$ Sharing or re-entering the same seed number ($1$ to $999999$) guarantees the exact same S-curve geometry, island splits, boulder layouts, and shifting current zones.
3.2 Pre-Race Track Seed Setup (🌱 Track Seed Setup)
- While in the pre-race
IDLEstate, players can customize the track seed via the bottom Track Seed Setup panel. - You can type any custom seed, step through seeds using the $-$ and $+$ buttons, or click
+ Add Seedto apply the seed and pin it to the quick-select seed chip bar (stores up to $8$ saved seed chips).
3.3 The Four Featured S-Bend & Branching Course Zones
The river geometry is sampled at $20\text{ px}$ vertical intervals to compute centerline $X_{\text{center}}(y)$, half-width $W_{\text{half}}(y)$, unit flow tangent $(t_x, t_y)$, and signed curvature $\kappa = \frac{d^2x}{dy^2}$:
- Zone 1: Double S-Bend Canyon ($Y = 750 \text{ to } 3250$)
- Features $1.5$ full sine periods of high-amplitude S-bends that sweep across the $540\text{ px}$ viewport, immediately testing outward centrifugal drift.
- Zone 2: Twin Sandbar & S-Merge ($Y = 3450 \text{ to } 5850$)
- Opens with the Twin Rapids Sandbar ($Y = 3550 \text{ to } 4850$) where a central vegetated island splits the river into left and right channels with asymmetric risk/reward hazards, followed immediately by a sharp S-Bend Merge Chicane ($Y = 4900 \text{ to } 5950$).
- Zone 3: Devil's Hairpin S-Curves ($Y = 6050 \text{ to } 8850$)
- The most technical section of the course, featuring $2.5$ periods of tight, aggressive hairpin S-curves with narrowed channel widths ($W_{\text{half}} \approx 112\text{ px}$).
- Zone 4: Final Island & Drift Sprint ($Y = 9050 \text{ to } 11950$)
- Combines the asymmetric Final Split Island ($Y = 9150 \text{ to } 10550$) with a high-speed S-Drift Chicane leading straight into the checkered finish line at $Y = 12260$.
4. Hydrodynamics, Hazards & Physics Engine
4.1 Tangent Current Propulsion & Rubber-Band Catch-Up
- Curve-Aligned Water Flow: Instead of pushing purely downward, the water current accelerates caps along the local S-curve tangent vector $(t_x, t_y)$ at a base speed of $292\text{ px/s}$ (jumping to $445\text{ px/s}$ when boosted).
- Rubber-Band Catch-Up: Caps trailing behind the leader receive a dynamic slipstream current bonus of up to $+28\%$: $$F_{\text{catchup}} = 1.0 + \min\left(0.28, \frac{Y_{\text{leader}} - Y_{\text{cap}}}{620} \cdot 0.24\right)$$
- Inner-Apex Line Bonus: Hugging the inside apex of an S-bend grants up to a $+10\%$ velocity multiplier, balanced by inner-apex hazards.
4.2 Centrifugal S-Curve Drift (🏎️ S-Curve Drift)
Whenever a bottle cap navigates a curve with curvature $|\kappa| > 0.0008$, outward centrifugal acceleration is applied perpendicular to the curve direction: $$a_{\text{centrifugal}, x} = -0.46 \cdot \kappa \cdot (v_x^2 + v_y^2)$$ High-speed cornering pushes caps toward the outer bank, triggering the 🏎️ S-Curve Drift status and generating dense whitewater wake trails.
4.3 0.5-Second Shifting Downstream Currents (⇄ 0.5s Shift)
Seven specialized Shifting Current zones are positioned across both main S-bends and split island channels:
- Dual-Vector Physics: Caps inside a Shifting Current receive a strong downstream tangent push ($250\text{--}260\text{ px/s}^2$) while simultaneously experiencing a lateral force that flips between Left and Right every $0.5\text{ seconds}$ (boosted by $+20\%$ to $672\text{--}708\text{ px/s}^2$): $$\text{ShiftDir}(t) = \begin{cases} -1 \text{ (Pull Left ⬋)} & \text{if } \lfloor \frac{t}{0.5} \rfloor \bmod 2 = 0 \\ +1 \text{ (Pull Right ⬊)} & \text{if } \lfloor \frac{t}{0.5} \rfloor \bmod 2 = 1 \end{cases}$$
- Visual Telemetry: Each zone dynamically alternates colors and diagonal chevron ripples every half-second between Emerald (
⬋ 0.5s PULL LEFT) and Amber (0.5s PULL RIGHT ⬊).
4.4 Outer-Curve Rapid Boosts (⚡) & Inner-Apex Whirlpools (🌀)
- Rapids Boost Strips (
⚡ Rapids/🔥 Outer Boost): Positioned along outer S-curve drift lines and fast island channels. Hitting a rapid strip triggers a $0.85\text{ s}$ boost (445 px/sflow target + $310\text{ px/s}^2$ tangent thrust), rewarding wide outer-curve drifting. - Whirlpool Vortex Traps (
🌀 Vortex): Positioned near inner curve apexes and risky split channels. Caps entering a whirlpool are pulled toward its core and spun tangentially ($\omega = \pm 11\text{ rad/s}$), disrupting their downstream momentum.
4.5 Wall-Safe Obstacle Clearance & Collision Physics
- Guaranteed Wall Clearance: Every boulder and floating driftwood log is spawned with a strict minimum clearance of $\ge 58\text{ px}$ from both riverbanks and island shores—ensuring that $39\text{ px}$ bottle caps always have wide passable lanes and never get wedged against walls.
- Sloped Bank Reflection (Shake-Free): Riverbank impacts compute the exact local bank slope normal $(n_x, n_y)$ for smooth elastic reflection without inducing any camera shake.
- Cap-vs-Cap Elastic Clashes (
⚔️ Pack Clash): Full 2D circle-to-circle impulse resolution with restitution $e = 0.85$, spin transfer, water splashes, and synthesized clack audio. - Anti-Stuck Safeguard: If any cap's downstream velocity drops below $v_y < 95\text{ px/s}$ for more than $0.22\text{ s}$, an automatic tangent recovery impulse guides it back into the main current.
5. Chase Camera, Broadcast HUD & Clean Mode
- Dynamic Chase Camera (
🎥): - Tracks the leading pack (or any user-selected cap) vertically while sampling the river centerline $180\text{ px}$ downstream for smooth horizontal S-curve anticipation.
- Automatically zooms ($1.035\times\text{--}1.05\times$) and triggers anime speed lines along the screen edges during tight battles ($< 85\text{ px}$ gap), sharp S-hairpins, or boost surges.
- Multi-Line Live Broadcast Ticker:
- Delivers real-time play-by-play commentary for zone entries, island splits, lead changes, $0.5\text{ s}$ shifting currents, and photo finishes. Configured with full multi-line word wrapping so long announcements are never truncated.
- Live S-Curve Mini-Map:
- Displays the entire winding river, split islands, color-shifting $0.5\text{ s}$ current zones, active camera viewport box, and live cap markers from
STARTtoGOAL. - Clean Spectator / Recording Mode (
🎬 Clean): - Toggling Clean Mode hides the top timer bar, leaderboard cards, and secondary controls—leaving only the Live Commentary Ticker, the S-Curve Mini-Map, and the bottom Start/Restart Race button.
- Interactive Water Surge (
⚡ Surge): - Players can press the Surge button ($1.2\text{ s}$ cooldown) during an active race to unleash a downstream wave that boosts and scrambles all four bottle caps at once.