Skip to content

Latest commit

ย 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ Mini Grand Prix

A cartoon formula racing weekend in your browser

Qualify. Race. Adapt. Win.

A strategy racing game built with native HTML, JavaScript, and Canvas 2D.
No game engine, no frontend framework, no build stepโ€”just driving, tyres, weather, ERS, and pit strategy.

English ยท ็ฎ€ไฝ“ไธญๆ–‡

MIT License Native HTML5 JavaScript ES Modules
Canvas 2D rendering No build step

Play the browser demo
No install, no signup โ€” open the link and race. Keyboard mode runs in the browser; phone-controller mode still needs npm run start:gamepad locally.

Open the autoplaying Mini Grand Prix gameplay showcase

๐Ÿ‘† Click the image above to watch the actual gameplay video.

Quick Start ยท Features ยท Controls ยท Architecture ยท Contributing


๐ŸŽฎ A complete miniature race weekend

Pick a circuit on the 3D globe โ†’ Tune the car โ†’ One-lap qualifying โ†’ Three-lap race โ†’ Points and the next round

Mini Grand Prix compresses the best parts of formula racing into a compact browser session. You race five AI cars while managing tyres, ERS, changing weather, and your pit window. Raw speed matters, but the next corner, the next rain cloud, and the next pit call often decide where you finish.

Alongside the full Grand Prix weekend, you can run a solo time trial. In gamepad mode, two players can also connect their own phones for qualifying and a split-screen head-to-head race.

๐Ÿ”ฅ Features

On track In the cockpit On the pit wall
๐ŸŽ๏ธ Six-car racing: battle five AI opponents for position โšก ERS management: deploy, harvest under braking, and manage cooldown ๐ŸŒฆ๏ธ Dynamic weather: read the forecast and time the tyre change
๐ŸŒ 24 circuit interpretations: choose a round on a draggable 3D globe ๐Ÿ›ž Tyre model: compound, temperature, wear, and wet-weather suitability ๐Ÿ”ง Dedicated pit lanes: entry, exit, team boxes, speed limit, and safe release
๐Ÿ Qualifying + race: one lap sets the grid; three laps settle the result ๐Ÿ’จ Readable physics: lock-ups, collisions, reversing, and surface speed limits ๐Ÿ“ก Race control: yellow flags, penalties, track limits, and live classification
๐Ÿ† 24-round career: points, wins, past champions, and local leaderboards ๐ŸŽ›๏ธ Performance tuning: four presets plus budget-limited custom setup ๐Ÿ“ฑ Phone controllers: join over LAN and race head-to-head in split screen
๐ŸŒ Bilingual UI: switch between English and Simplified Chinese in-game ๐Ÿ“ฆ Build-free frontend: the browser loads native ES Modules directly ๐Ÿ’พ Local saves: results, setup, and season progress stay in your browser
More race detail
  • Soft, Medium, Hard, Intermediate, and Wet tyre compounds
  • Clear, overcast, rainy, and forecastable dynamic weather
  • A mandatory race pit stop; skipping the tyre change adds a 20-second penalty
  • Configurable AI difficulty, weather, starting tyres, team, and car setup
  • Jump starts, overtaking under yellow, collision responsibility, and cumulative track-limit penalties
  • HUD for speed, gear, RPM, lap times, tyres, weather, ERS, position, circuit map, and pit guidance
  • Fault-tolerant local storage for best results, recent races, vehicle setup, and season progress

๐Ÿ–ผ๏ธ Screenshots

3D globe and circuit selection Race setup and circuit preview
Circuit details and the interactive globe Team, AI, weather, and starting tyre settings
Car setup Career and results
Vehicle presets and performance tuning Championship standings and circuit records

๐Ÿ“ฑ Phone controller

Turn your phone into a wireless gamepad โ€” scan a QR code, connect over local Wi-Fi, and race head-to-head with a friend in split screen. P1 can always fall back to the keyboard.

English phone controller interface

See the full rules screens

Full rules screen, part one Full rules screen, part two

Circuit footage

GIF previews loop automatically; click one to watch the full clip. Both previews and videos are hosted as GitHub Release assets, keeping them out of repository clones.

Race Start (Shanghai) Cornering (Miami)
Looping race-start preview at Shanghai Looping cornering preview at Miami
ERS Acceleration (Austria) Tyre Change (Barcelona)
Looping ERS acceleration preview at Austria Looping tyre-change preview at Barcelona
AI Battle 1 (Lusail) AI Battle 2 (Yas Marina)
Looping AI Battle 1 preview at Lusail Looping AI Battle 2 preview at Yas Marina

๐Ÿง  Every lap is a decision

  • Deploy now or save it? ERS lasts only a few seconds before it needs brake harvesting and cooldown.
  • Pit before the rain arrives? The forecast gives you information; track position and tyre condition determine the answer.
  • Stretch the stint or protect the rubber? Temperature and wear directly affect grip and performance.
  • Be quickโ€”and stay clean. Yellow flags, track limits, collision responsibility, and the mandatory tyre change can all reshape the result.

๐ŸŒ 24 rounds, 6 fictional teams

The 2026 calendar spans Asia-Pacific, Europe, the Americas, and the Middle East. Each circuit is hand-built as a simplified artistic interpretation inspired by real-world geography โ€” not a survey-accurate reproduction. Corner counts, radii, lengths, and layouts differ from their real-world counterparts.

# Round Layout Turns Length Region
1 ๐Ÿ‡ฆ๐Ÿ‡บ Australia Albert Park 14 5.278 km Asia-Pacific
2 ๐Ÿ‡จ๐Ÿ‡ณ Shanghai Shanghai 16 5.451 km Asia-Pacific
3 ๐Ÿ‡ง๐Ÿ‡ญ Bahrain Sakhir 15 5.412 km Middle East
4 ๐Ÿ‡ธ๐Ÿ‡ฆ Jeddah Jeddah 27 6.174 km Middle East
5 ๐Ÿ‡บ๐Ÿ‡ธ Miami Miami 19 5.412 km Americas
6 ๐Ÿ‡จ๐Ÿ‡ฆ Canada Montrรฉal 14 4.361 km Americas
7 ๐Ÿ‡ฒ๐Ÿ‡จ Monaco Monte Carlo 19 3.337 km Europe
8 ๐Ÿ‡ช๐Ÿ‡ธ Spain Barcelona-Catalunya 16 4.675 km Europe
9 ๐Ÿ‡ฆ๐Ÿ‡น Austria Spielberg 10 4.318 km Europe
10 ๐Ÿ‡ฌ๐Ÿ‡ง Great Britain Silverstone 18 5.891 km Europe
11 ๐Ÿ‡ฉ๐Ÿ‡ช Germany Hockenheimring 17 4.574 km Europe
12 ๐Ÿ‡ง๐Ÿ‡ช Belgium Spa-Francorchamps 20 7.004 km Europe
13 ๐Ÿ‡ญ๐Ÿ‡บ Hungary Hungaroring 14 4.381 km Europe
14 ๐Ÿ‡ณ๐Ÿ‡ฑ Netherlands Zandvoort 14 4.259 km Europe
15 ๐Ÿ‡ฎ๐Ÿ‡น Italy Monza 11 5.793 km Europe
16 ๐Ÿ‡ฆ๐Ÿ‡ฟ Azerbaijan Baku 20 6.003 km Middle East
17 ๐Ÿ‡ฒ๐Ÿ‡พ Malaysia Sepang 15 5.543 km Asia-Pacific
18 ๐Ÿ‡ธ๐Ÿ‡ฌ Singapore Marina Bay 23 5.063 km Asia-Pacific
19 ๐Ÿ‡บ๐Ÿ‡ธ Austin Austin 20 5.513 km Americas
20 ๐Ÿ‡ฒ๐Ÿ‡ฝ Mexico Mexico City 17 4.304 km Americas
21 ๐Ÿ‡ง๐Ÿ‡ท Brazil Interlagos 15 4.309 km Americas
22 ๐Ÿ‡บ๐Ÿ‡ธ Las Vegas Las Vegas Strip 17 6.201 km Americas
23 ๐Ÿ‡ถ๐Ÿ‡ฆ Qatar Lusail 16 5.419 km Middle East
24 ๐Ÿ‡ฆ๐Ÿ‡ช Abu Dhabi Yas Marina 16 5.281 km Middle East
Team Number Character
Vector Cobalt 12 Balanced and approachable
Apex Saffron 23 Straight-line speed
Helix Indigo 36 Cornering performance
Orbit Vermilion 17 ERS recovery
Pulse Teal 88 All-round power
Prism Onyx 6 Stability

All team identities, car numbers, and liveries are fictional. Performance differences are deliberately limited and fair, and AI cars share the same underlying systems as the player.

๐Ÿš€ Quick start

Requirements

  • Node.js 18+
  • A modern desktop browser: Chrome, Edge, Firefox, or Safari
  • For phone controllers, the computer and phones must share a local network

Install and run

npm install

# Keyboard-only mode
npm run start:keyboard

# Keyboard + phone controller mode (WebSocket, QR codes, and head-to-head)
npm run start:gamepad

Open http://localhost:8080/ on the computer.

Important

Do not open index.html directly. Browsers commonly block ES Modules on file:// pages, so start the local HTTP server first.

Connect phone controllers

  1. Put the computer and phones on the same Wi-Fi network, or connect the computer to a phone hotspot.
  2. Run npm run start:gamepad.
  3. Scan the P1 / P2 QR code shown by the desktop game, or open one of the LAN addresses printed in the terminal.
  4. Use the P1 controller for single-player modes; connect P1 and P2 separately for head-to-head.

P1 can always fall back to the keyboard. Keyboard-only mode does not expose the WebSocket service, QR codes, or head-to-head entry point.

๐ŸŽฎ Controls

Key Action Key Action
W Accelerate D Brake
โ† / โ†’ Steer X Reverse
Space Deploy ERS P Request / cancel pit stop
1โ€“5 Select the next pit tyre S Emergency stop in your team box
Esc Pause R Restart after the results screen

Auto speed hold is enabled by default: releasing W maintains the current speed. You can disable it in Car Setup. Braking, reversing, and surface limits still slow the car.

๐Ÿงฐ Technical overview

Browser-native ES Modules
โ”œโ”€โ”€ Canvas 2D         Circuits, cars, scenery, and HUD
โ”œโ”€โ”€ localStorage      Results, career, setup, and season progress
โ””โ”€โ”€ Node.js + ws      Local static server and optional phone controllers

The game frontend has no external runtime library. The browser loads the source directly, with no compilation or bundling.

Expand the project structure
index.html                       Page entry point and UI styles
gamepad.html                     Phone controller page
src/main.js                      Game loop and flow orchestration
src/i18n.js                      English and Chinese UI strings
src/game/                        Cars, AI, circuits, race, and strategy systems
src/renderer/                    Circuit, car, scenery, and HUD rendering
src/ui/                          Menus and 3D globe selection
src/utils/                       Input, maths, storage, and export helpers
src/gamepad/                     Phone controller WebSocket client
server.js                        Local server and WebSocket relay
tests/run.js                     Node.js functional test entry point
tests/smoke.mjs                  Playwright browser smoke test
docs/prd.md                      Product requirements and acceptance scope
docs/track-authoring-standard.md Circuit authoring and import standard
docs/pit-lane/README.md          Pit lane system documentation

โœ… Testing

npm test          # Cars, races, tyres, ERS, weather, circuits, saves, and localization
npm run lint      # ESLint
npm run smoke     # Playwright browser smoke test

When changing rules, physics, circuit geometry, or UI flows, update the relevant tests and documentation with the code.

๐Ÿค Contributing

Issues, ideas, and pull requests are welcome. Good places to start include:

  • Better AI overtaking, defending, and wet-weather strategy
  • Canvas performance, narrow-screen HUD, and accessibility improvements
  • New circuit interpretations that follow the geometry standard
  • More physics, strategy, save-recovery, localization, and browser-flow tests
  • Documentation, translation, and onboarding improvements

Before submitting, follow AGENTS.md to run the tests applicable to your change and git diff --check. Please do not introduce real team names, driver names, official event names, official logos, or other protected visual assets. New images, fonts, audio, data, and code must have clear permission for use.

๐Ÿ“œ Inspiration and rights notice

The race-weekend structure, calendar, points competition, tyre compounds, ERS, weather, and pit strategy are inspired by real-world single-seater racing and its publicly known sporting concepts. Rules, values, circuits, and flows have been simplified, stylized, and adapted for gameplay. They are not complete reproductions of any official rulebook or real circuit.

Mini Grand Prix is an independent, fictional open-wheel racing game. It is not affiliated with, endorsed by, sponsored by, or licensed by Formula 1, the FIA, or any real-world series, team, driver, manufacturer, or circuit operator.

  • All six teams, car numbers, and liveries are fictional.
  • All third-party names, trademarks, data, and materials remain the property of their respective owners.
  • If you believe repository content infringes your rights, contact the maintainer through Issues with [Rights / ไพตๆƒ่”็ณป] in the title and include ownership details, relevant links, and a specific description.
  • 3D globe land data: Natural Earth (Public Domain).
  • Phone-controller QR implementation: Project Nayuki QR Code Generator (MIT).
  • Full source, copyright, and license details: THIRD_PARTY_NOTICES.md.

โœ‰๏ธ Contact

For questions, suggestions, collaboration, or rights-related matters, email the author at xhhdaxx@gmail.com.

๐Ÿ“„ License

Original source code in this project is released under the MIT License. Third-party code and data retain their respective licenses and notices.

Made with Canvas, curiosity, and a little too much late braking.

Enjoying the project? Star โญ it, Fork ๐Ÿด it, or share it with another racing fan.

About

๐Ÿ Start your engines โ€” a pocket Formula weekend in your browser

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages