Skip to content

deekshithaby/F1-RaceReplay

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

F1 Race Replay 🏎️ 🏁

A Python application for visualizing Formula 1 race telemetry and replaying race events with interactive controls and a graphical interface.

Race Replay Preview

🚀 My Improvements (Forked & Enhanced)

This is a fork and significant enhancement of the original f1-race-replay project by Tom Shaw.

What I Added:

  • Interactive Race Selection: Run python3 main.py and enter season year + circuit name instead of command-line flags
  • Fuzzy Circuit Matching: Type "Silverstone" or "silverstone" — it finds it automatically
  • Gap to Leader Display: Leaderboard now shows time gaps (e.g., "+1.2s") for each driver
  • Enhanced UI/UX: Improved leaderboard spacing, added "(Click for stats)" hint, better visual hierarchy
  • Better Telemetry Display: Speed shown in large RED text when viewing driver stats

Features

  • Race Replay Visualization: Watch the race unfold with real-time driver positions on a rendered track.
  • Leaderboard: See live driver positions and current tyre compounds.
  • Lap & Time Display: Track the current lap and total race time.
  • Driver Status: Drivers who retire or go out are marked as "OUT" on the leaderboard.
  • Interactive Controls: Pause, rewind, fast forward, and adjust playback speed using on-screen buttons or keyboard shortcuts.
  • Legend: On-screen legend explains all controls.
  • Driver Telemetry Insights: View speed, gear, DRS status, and current lap for selected drivers when selected on the leaderboard.

Controls

  • Pause/Resume: SPACE or Pause button
  • Rewind/Fast Forward: ← / → or Rewind/Fast Forward buttons
  • Playback Speed: ↑ / ↓ or Speed button (cycles through 0.5x, 1x, 2x, 4x)
  • Set Speed Directly: Keys 1–4

Requirements

Install dependencies:

pip install -r requirements.txt

FastF1 cache folder will be created automatically on first run. If it is not created, you can manually create a folder named .fastf1-cache in the project root.

Usage

Quick Start (New Way) ⭐

python3 main.py

Then enter:

  • Season year (e.g., 2025)
  • Circuit name (e.g., Abu Dhabi, Silverstone, Hungary)

Advanced (Original Command-Line Flags Still Work)

python3 main.py --year 2025 --round 12
python3 main.py --year 2025 --round 12 --sprint
python3 main.py --year 2025 --round 12 --refresh-data

File Structure

  • main.py — Entry point, handles session loading and starts the replay.
  • src/lib/tyres.py — Type definitions for telemetry data structures.
  • src/f1_data.py — Telemetry loading, processing, and frame generation.
  • src/arcade_replay.py — Visualization and UI logic.

Customization

  • Change track width, colors, and UI layout in src/arcade_replay.py.
  • Adjust telemetry processing in src/f1_data.py.

Contributing

  • Open pull requests for UI improvements or new features.
  • Report issues on GitHub.

Known Issues

  • The leaderboard appears to be inaccurate for the first few corners of the race. The leaderboard is also temporarily affected by a driver going in the pits. At the end of the race the leadeboard is sometimes affected by the drivers final x,y positions being further ahead than other drivers. These issues are known issues caused by innacuracies in the telemetry and being worked on for future releases. Its likely that these issues will be fixed in stages as improving the leaderboard accuracy is a complex task.

📝 License

This project is licensed under the MIT License.

⚠️ Disclaimer

No copyright infringement intended. Formula 1 and related trademarks are the property of their respective owners. All data used is sourced from publicly available APIs and is used for educational and non-commercial purposes only.


Built with ❤️ by Tom Shaw | Enhanced by Deekshitha

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%