[PR #222] Feature: Tyre Strategy Timeline Panel #231

Open
opened 2026-05-07 00:19:19 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/IAmTomShaw/f1-race-replay/pull/222
Author: @darsh-shah4548
Created: 2/6/2026
Status: 🔄 Open

Base: mainHead: feature/tyre-strategy-timeline


📝 Commits (2)

  • 3e49748 Add tyre strategy timeline panel (resolves #95)
  • e8e6e19 Remove New/Used tyre legend and brightness dimming

📊 Changes

5 files changed (+395 additions, -8 deletions)

View changed files

📝 main.py (+1 -0)
📝 src/arcade_replay.py (+3 -1)
📝 src/f1_data.py (+64 -0)
📝 src/interfaces/race_replay.py (+24 -7)
📝 src/ui_components.py (+303 -0)

📄 Description

Summary

Adds a toggleable Tyre Strategy Timeline panel that lets users compare drivers' compound strategies during race replays. Resolves #95.

  • Press T to toggle the panel on/off
  • Shift+click drivers on the leaderboard to compare up to 5 strategies side-by-side
  • Shows horizontal stint bars colored by compound (Soft/Medium/Hard/Inter/Wet)
  • Progressive reveal — bars only extend to each driver's current lap (no spoilers)
  • Tyre life % displayed on bars using the existing Bayesian degradation model
  • Fresh/Used indicator — bright vs darker shading with a legend
  • Semi-transparent background so the track remains visible
  • Backward-compatible with old cached data (auto-extracts strategy on load)

How It Works

  1. Select drivers via Shift+click on the leaderboard
  2. Press T to open the strategy panel
  3. Stint bars reveal progressively as the race plays
  4. Each bar shows the compound letter and tyre health percentage
  5. A white vertical line marks the current leader lap

Files Changed (100% additive)

File Change Existing code modified?
src/ui_components.py New TyreStrategyTimelineComponent class + constants + 1 help entry No
src/f1_data.py New extract_strategy_data() function + cache integration No
src/interfaces/race_replay.py Component wiring (import, init, draw, key, mouse) No (lines added only)
src/arcade_replay.py strategy_data parameter passthrough No
main.py 1 kwarg added to pass strategy data No

All existing components (LeaderboardComponent, WeatherComponent, DriverInfoComponent, etc.) are completely untouched. No contributor's git blame is affected.

Screenshots

Screenshot 2026-02-06 at 1 22 23 PM

Test Plan

  • Open any race replay, Shift+click 2-3 drivers, press T — strategy bars appear
  • Play the race — bars progressively reveal, tyre life % updates
  • Press T again — panel hides cleanly
  • Test with races cached before this feature — strategy auto-extracted from session
  • Sprint races work (fewer laps = wider bars)
  • Press H — "T - Toggle Tyre Strategy" appears in help popup
  • Select 6+ drivers — panel caps at 5 with "+N more" note

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/IAmTomShaw/f1-race-replay/pull/222 **Author:** [@darsh-shah4548](https://github.com/darsh-shah4548) **Created:** 2/6/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feature/tyre-strategy-timeline` --- ### 📝 Commits (2) - [`3e49748`](https://github.com/IAmTomShaw/f1-race-replay/commit/3e497489098aa99dedc4a0b0eba34b913e16eb74) Add tyre strategy timeline panel (resolves #95) - [`e8e6e19`](https://github.com/IAmTomShaw/f1-race-replay/commit/e8e6e19a8815a76c88181183701ea3aa0b47bd72) Remove New/Used tyre legend and brightness dimming ### 📊 Changes **5 files changed** (+395 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `main.py` (+1 -0) 📝 `src/arcade_replay.py` (+3 -1) 📝 `src/f1_data.py` (+64 -0) 📝 `src/interfaces/race_replay.py` (+24 -7) 📝 `src/ui_components.py` (+303 -0) </details> ### 📄 Description ## Summary Adds a toggleable **Tyre Strategy Timeline** panel that lets users compare drivers' compound strategies during race replays. Resolves #95. - **Press `T`** to toggle the panel on/off - **Shift+click** drivers on the leaderboard to compare up to 5 strategies side-by-side - Shows horizontal stint bars colored by compound (Soft/Medium/Hard/Inter/Wet) - **Progressive reveal** — bars only extend to each driver's current lap (no spoilers) - **Tyre life %** displayed on bars using the existing Bayesian degradation model - **Fresh/Used indicator** — bright vs darker shading with a legend - Semi-transparent background so the track remains visible - Backward-compatible with old cached data (auto-extracts strategy on load) ## How It Works 1. Select drivers via Shift+click on the leaderboard 2. Press `T` to open the strategy panel 3. Stint bars reveal progressively as the race plays 4. Each bar shows the compound letter and tyre health percentage 5. A white vertical line marks the current leader lap ## Files Changed (100% additive) | File | Change | Existing code modified? | |---|---|---| | `src/ui_components.py` | New `TyreStrategyTimelineComponent` class + constants + 1 help entry | No | | `src/f1_data.py` | New `extract_strategy_data()` function + cache integration | No | | `src/interfaces/race_replay.py` | Component wiring (import, init, draw, key, mouse) | No (lines added only) | | `src/arcade_replay.py` | `strategy_data` parameter passthrough | No | | `main.py` | 1 kwarg added to pass strategy data | No | All existing components (LeaderboardComponent, WeatherComponent, DriverInfoComponent, etc.) are completely untouched. No contributor's git blame is affected. ## Screenshots <img width="2556" height="1440" alt="Screenshot 2026-02-06 at 1 22 23 PM" src="https://github.com/user-attachments/assets/7bf7194a-9ba1-4145-9972-9e83bee269dd" /> ## Test Plan - [ ] Open any race replay, Shift+click 2-3 drivers, press `T` — strategy bars appear - [ ] Play the race — bars progressively reveal, tyre life % updates - [ ] Press `T` again — panel hides cleanly - [ ] Test with races cached before this feature — strategy auto-extracted from session - [ ] Sprint races work (fewer laps = wider bars) - [ ] Press `H` — "T - Toggle Tyre Strategy" appears in help popup - [ ] Select 6+ drivers — panel caps at 5 with "+N more" note --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/f1-race-replay#231
No description provided.