Skip to content

Learn the first lap of a grid start from the start line - #156

Merged
Views2k merged 1 commit into
mainfrom
fix/grid-start-first-lap
Oct 21, 2026
Merged

Views2k merged 1 commit into
mainfrom
fix/grid-start-first-lap

Conversation

@Views2k

@Views2k Views2k commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Purpose

Fixes #141. On a circuit raced from the grid, Wisp loses the first timed lap. The track map stays on the run up to the line for in-game lap 1, and the lap delta waits until in-game lap 3. When automatic lap recording saves that lap, saved-run review shows it as a partial lap with no time.

Thanks to @GreenXDShadow for the report, the lap logs and the diagnosis in #141.

Root cause and solution

Root cause. From the grid, FH6 restarts the lap clock at the start line but keeps packet lap 0 and records no lap time. The race clock keeps running.

  • The live lap tracker read that sample as a clock disagreement after a rewind. It held for 30 samples, then reacquired, so the lap never started at the line and could not become a reference.
  • Saved-run review read the same sample as a rewind, so the first lap was never complete there either.

Solution.

  • GridStartLine.IsFirstCrossing is one shared rule for that sample: the same packet lap, no lap timed yet, the lap clock back at the line, and the race clock still running. A rewind or restart takes the race clock back too, so neither matches.
  • The tracker starts the first timed lap there when the car is still driving. The map then redraws from the line, the lap is eligible for automatic lap recording, and it becomes the reference.
  • Saved-run review ends the grid run-up as a partial path at the line and starts a complete first lap there.
  • A race (re)start with agreeing clocks is no longer held as a disagreement. After a grid start the race clock leads the lap clock, so a restart used to look like one.
  • Rewinds, resets, rolling starts and Time Attack keep their existing paths.
  • The lap line is added to the 2.7.0 CHANGELOG, release notes and in-app notes.

Validation

All on this branch, Release configuration, .NET SDK 8.0.425:

  • Wisp.Core.Tests: 781 passed, 0 failed. This includes the race simulator, which now starts even seeds from a grid slot 60–120 m behind the line; its restarts begin on the line.
  • Wisp.App.Tests filtered to ReleaseNotes, LapRunCapture, LapDelta and LapReview: 191 passed, 0 failed.
  • dotnet format --verify-no-changes on the changed files passes, and Test-RepositoryPolicy.ps1 passes and validates the 2.7.0 release content.
  • With the two source fixes reverted, all seven new or extended tests fail: both logged crossings, both race simulator modes and the three review tests.

New tests:

  • FirstCrossingFromTheGridStartsTheFirstTimedLap uses the two logged crossings from [Bug] Circuit map freezes on the run to the line and the delta waits an extra lap #141 (race clock 5.884 → 5.900 s and 5.650 → 5.667 s, lap clock to 0.017 s, 92 m from the grid at 29 m/s). It checks that the lap records from the line, the map redraws without the grid run-up, the lap completes for automatic lap recording, and the next lap compares against it.

  • RaceFromTheGridKeepsItsFirstTimedLap: a full recording has a partial grid run-up and complete laps 1 and 2 with their game lap times.

  • AutomaticallySavedFirstLapFromTheGridIsComplete: an automatically saved first lap is one complete lap.

  • RewindJustAfterTheGridLineStaysARewind: a rewind that takes the lap clock back near the line is still a rewind.

  • The change is within the approved scope.

  • The change improves usability, functionality, feel, reliability, or maintenance, or fixes a verified bug.

  • I have read and agree to the contributor-rights terms in CONTRIBUTING.md.

  • Regression coverage has been added or updated where appropriate.

  • Steam and Xbox app / Microsoft Store impacts, checks, and outstanding gaps are recorded separately as required by docs/VALIDATION.md.

  • The complete Release test suite passes.

  • No credentials, personal data, machine paths, game binaries, save data, private captures, or generated output are included, except matching shader bytecode for an approved shader change described in docs/SHADERS.md.

  • User-facing changes are recorded in CHANGELOG.md.

  • Native HUD assets are unchanged, or their distribution rights, provenance, and hashes are documented.

Steam and Xbox app / Microsoft Store. Both platforms send the same 324-byte Data Out packet. Wisp parses it with one layout, and neither the lap tracker nor saved-run review branches by platform, so the change applies to both.

  • Steam: the crossing values in the tests come from the reporter's in-game lap logs on 2.6.13 ([Bug] Circuit map freezes on the run to the line and the delta waits an extra lap #141). This build has not been driven in game.
  • Xbox app / Microsoft Store: not driven. The rule matches only the same packet lap with the lap clock back at the line and the race clock still running. If that platform reported the first line differently, the rule could not match, and it would keep today's behaviour.

Outstanding validation

  • No live FH6 drive of this build on Steam or the Xbox app.
  • The complete Release suite runs in the 2.7 release gate after merge.
  • The race simulator does not rewind back across the first line into the grid run-up. By the code, the tracker reacquires there and starts the lap again at the next crossing. No test covers that.

From the grid, FH6 restarts the lap clock at the start line but keeps
packet lap 0 and records no lap time. The lap tracker read that as a
clock disagreement, held, then reacquired, so the first timed lap was
lost and the delta waited a lap longer. Saved-run review read the same
sample as a rewind, so a saved first lap showed as partial.

One rule, GridStartLine, recognises that crossing, and both the live
tracker and saved-run review start the first timed lap there. A race
(re)start with agreeing clocks is no longer held either. Rewinds,
restarts, resets and Time Attack keep their paths.

Fixes #141.
@Views2k
Views2k merged commit 04eabd2 into main Oct 21, 2026
10 checks passed
@Views2k
Views2k deleted the fix/grid-start-first-lap branch October 21, 2026 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Circuit map freezes on the run to the line and the delta waits an extra lap

1 participant