Loading repository dataโฆ
Loading repository dataโฆ
jude-pinkman / repository
๐๏ธ Hypercar Performance Simulator A full-stack physics-based racing simulator built with FastAPI and HTML/CSS/JavaScript. It models real-world drag racing using aerodynamic drag, rolling resistance, torque curves, and gear ratios to simulate hypercar performance. Features multiple race modes, advanced vehicle tuning (engine stages, tires, aero,
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
A physics-based vehicle performance simulator featuring 50+ hypercars and all 10 Formula 1 teams from the 2020 season, an advanced customizable physics engine, comprehensive tuning system, real-time telemetry, and real-world circuit lap simulation. Runs fully offline โ no backend required for F1 cars or drag simulation.
All 10 constructor teams fully modelled with accurate physics:
| Team | Car | Engine |
|---|---|---|
| Mercedes | W11 | Mercedes M11 EQ Power+ Hybrid |
| Red Bull Racing | RB16 | Honda RA620H Hybrid |
| Ferrari | SF1000 | Ferrari 065 Hybrid |
| McLaren | MCL35 | Renault E-Tech 20 Hybrid |
| Renault | R.S.20 | Renault E-Tech 20 Hybrid |
| AlphaTauri | AT01 | Honda RA620H Hybrid |
| Racing Point | RP20 | Mercedes M10 EQ Power+ Hybrid |
| Alfa Romeo | C39 | Ferrari 065 Hybrid |
| Haas | VF-20 | Ferrari 065 Hybrid |
| Williams | FW43 | Mercedes M10 EQ Power+ Hybrid |
F1 physics are calibrated against real 2020 benchmarks:
The simulator no longer requires the backend to be running for most operations:
circuits-rt.js โ works offlineBoth the Simulator and Circuits pages now have a ๐ Hypercars / ๐ Formula 1 toggle above the car selector. Switching categories repopulates the dropdown instantly without a page reload.
Hypercars (40+)
Formula 1 (10 teams โ 2020 season) All 10 constructors listed above.
Quick Presets: Arcade ยท Realistic ยท Maximum ยท Endurance Race ยท Wet Race
# 1. Extract the project
unzip Hypercar_Sim.zip
cd Hypercar_Sim
# 2. Install Python dependencies
pip install -r requirements.txt
# 3. Start the backend
uvicorn app.main:app --reload --port 8000
The API is now available at http://localhost:8000.
Interactive API docs: http://localhost:8000/docs
The frontend is served directly by the backend:
| Page | URL |
|---|---|
| Home | http://localhost:8000/home.html |
| Simulator | http://localhost:8000/simulator.html |
| Circuits | http://localhost:8000/circuits.html |
| About | http://localhost:8000/about.html |
No backend? No problem. The simulator and circuits pages work fully offline โ vehicles load from the embedded catalogue and drag simulation runs in the browser using the built-in physics engine.
Space1โ8 โ switch race modesSpace โ start raceR โ resetHypercars use the backend Python physics engine (three tiers):
F1 cars and offline fallback use the frontend JavaScript physics engine (sim-physics.js):
Aerodynamic drag: F_drag = 0.5 ร ฯ ร Cd ร A ร vยฒ
Rolling resistance: F_roll = Crr ร m ร g
Downforce: F_df = 0.5 ร ฯ ร CL ร A ร vยฒ
Max traction: F_max = ฮผ ร (m ร g + F_df)
Drive force: F_d = (ฯ ร G_ratio ร G_final ร ฮท) / r_tyre
Net force: F_net = min(F_d, F_max) โ F_drag โ F_roll
Acceleration: a = F_net / m
GET /api/vehiclesReturns all hypercar IDs and display names.
POST /api/simulate/dragRuns a drag race simulation.
{
"vehicle_ids": ["koenigsegg_jesko", "f1_mercedes_w11"],
"environment": {
"temperature_celsius": 20,
"altitude_meters": 0
},
"max_time": 30,
"target_distance": 402.336,
"tuning_mods": {},
"physics_config": {},
"preset_config": "realistic"
}
Note: F1 vehicle IDs (
f1_*) are not in the backend database and will return a 404. The frontend automatically falls back to the JS physics engine for these IDs.
GET /api/healthReturns backend status and number of vehicles loaded.
Hypercar_Sim/
โโโ app/ # Python backend (FastAPI)
โ โโโ main.py # API routes
โ โโโ database.py # Vehicle database (CSV loader)
โ โโโ models.py # Pydantic data models
โ โโโ physics.py # Basic physics engine
โ โโโ physics_improved.py # Improved physics engine
โ โโโ physics_customizable.py # Configurable physics engine
โ โโโ physics_config.py # Physics config + presets
โ โโโ tuning.py # Tuning system
โโโ frontend/ # Static web frontend
โ โโโ simulator.html # Drag race simulator
โ โโโ circuits.html # Real-world circuit lap sim
โ โโโ home.html # Landing page
โ โโโ about.html # About page
โ โโโ sim.js # Simulator logic + race engine
โ โโโ sim-physics.js # Frontend JS physics engine (F1 + offline)
โ โโโ car-data.js # Unified vehicle catalogue (hypercars + F1)
โ โโโ vehicle-selector.js # Vehicle picker with category toggle
โ โโโ circuits-rt.js # Circuit simulation engine
โ โโโ render.js # Canvas race renderer
โ โโโ tuning.js # Tuning panel UI
โ โโโ physics-customization-ui.js # Physics settings UI
โ โโโ config.js # API base URL config
โโโ hypercar_data.csv # Hypercar gear/spec database
โโโ requirements.txt
โโโ README.md
hypercar_data.csv with the car's gear ratios_get_vehicle_specs() dict in app/database.pyHYPERCAR_SPECS in frontend/sim-physics.jsVEHICLE_SPECS in frontend/circuits-rt.jsfrontend/car-data.jsIn frontend/car-data.js, add 10 new entries with carCategory: 'f1' and the new year. The physics engine will pick them up automatically if matching specs exist in sim-physics.js.
Add a GeoJSON track file to frontend/data/ and register it in the TRACKS array in circuits-rt.js.
Add a new entry to PRESET_CONFIGS in app/physics_config.py.
simulator.html and circuits.htmlcar-data.js) as single source of truth