Skip to content

Learn the circuit from the start line when the first timed lap begins - #153

Closed
GreenXDShadow wants to merge 3 commits into
Views2k:mainfrom
GreenXDShadow:fix/grid-start-line
Closed

GreenXDShadow wants to merge 3 commits into
Views2k:mainfrom
GreenXDShadow:fix/grid-start-line

Conversation

@GreenXDShadow

@GreenXDShadow GreenXDShadow commented Oct 21, 2026 •

Copy link
Copy Markdown

Purpose

On a circuit, crossing the start line from the grid moves the in-game lap from 0 to 1 while the packet lap stays 0. The lap trace drawn on the way to the line stays where it is, and the car's dot keeps moving around the circuit. That whole first lap is lost. On in-game lap 2 (packet lap 1) the trace follows the car, but there is still no delta. Delta appears only on in-game lap 3 (packet lap 2).

Fixes #141.

Root cause and solution

Root cause. Forza does not increment the packet lap when the first timed lap begins. The lap clock snaps back to the line, the race clock keeps running, and the car is still driving. LapDeltaTracker.Update treats that snap as a clock disagreement, returns the previous reading for HeldSamples (30), and then Reacquire keeps the grid outline and clears the live trace. StartLap only accepts a line start while CurrentLapSeconds <= 0.25, so by the time the hold ends the first timed lap can no longer become the reference.

Solution. Before the post-rewind hold, SameLapLine recognizes that one packet on lap 0: game laps, the same packet lap, last-lap time still 0, the lap clock back from above 0.25 s to at or under 0.25 s, the race clock still running within the existing 1 s gap, the car still driving, and RewindsTo false. That packet skips the hold and calls StartLap, so the lap records from the line, the map redraws, and the lap can become the reference. A saved run keeps that lap through the existing completion path. A later line still uses the existing boundary path, because the packet lap increments. A restart is not held either: after the grid the race clock is ahead of the lap clock, and both clocks returning to zero would otherwise look like the post-rewind disagreement. Rewinds, resets, rolling starts, and Time Attack stay on their existing paths.

Validation

I reproduced the bug in Forza Horizon 6 Steam on Wisp 2.6.13 (621358e) without this change: from the grid, the trace froze for in-game lap 1 and the delta waited until in-game lap 3. With this change on the same Steam version, the trace followed the car from the start line and the delta showed on the next lap. Time Attack and a rewind also behaved correctly with the fix. LapDelta.cs on current main (e354871) is unchanged since October 2 apart from this commit.

Locally, on fix/grid-start-line (0c59313), with SDK 8.0.426 (satisfies global.json 8.0.425 with latestPatch):

  • dotnet restore Wisp.sln --locked-mode -p:NuGetAudit=true -p:NuGetAuditMode=all passed.

  • dotnet format Wisp.sln --verify-no-changes --no-restore passed.

  • dotnet test Wisp.sln --configuration Release --no-restore --nologo --disable-build-servers -m:1 -p:UseSharedCompilation=false did not fully pass. Wisp.Core.Tests 778 passed, including SameLapLineSnapStartsTheLearningLap for the logged crossings 5.884 → 5.900 and 5.650 → 5.667, and RaceSessionsAgreeWithTheGame with grid starts on even seeds. Wisp.Telemetry.Tests 96, Wisp.Update.Tests 144, Wisp.Updater.Tests 75. Wisp.App.Tests had 1 failure: TachDiagnosticsTests.EnabledNeedleRecordingReportsOfflineCostWithoutATimingThreshold (expected 0 allocated bytes, actual 7112, on .NET 8.0.32). That test does not use the lap tracker. Run on its own, it passed on unmodified main and on this branch.

  • py -3 -m unittest discover -s tools/tests -p "test_*.py" -v passed: 157 run, 2 skipped, 0 failed, using PowerShell 7.6.7.

  • 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.

Outstanding validation

  • Xbox app / Microsoft Store has not been driven. The live checks above are Steam only.
  • The Release suite command exited with the one Wisp.App.Tests failure above. An isolated rerun passed on main and on this branch. CI on the pull request is the remaining full run.
  • Point-to-point and a race restart were not driven again in Forza. Restarts are covered by RaceSessionsAgreeWithTheGame, including after a grid start.

@Views2k

Views2k commented Oct 21, 2026

Copy link
Copy Markdown
Owner

Thanks for the clear report, the lap logs and the fix, @GreenXDShadow. I'm closing this in favour of #156, which fixes #141 with the same start-line approach and also covers saved-run review: it read that first lap as a rewind, so automatically saved first laps showed as partial. #156 credits your report and diagnosis, and the fix ships in Wisp 2.7.

@Views2k Views2k closed this Oct 21, 2026
@GreenXDShadow

Copy link
Copy Markdown
Author

Totally missed the saved run review. Happy to contribute, and thanks for the work you do 👏

@Views2k

Views2k commented Oct 21, 2026

Copy link
Copy Markdown
Owner

Totally missed the saved run review. Happy to contribute, and thanks for the work you do 👏

No worries, I'm sure next time you'll be on point! I'll be glad to add you as a contributor if you continue to help out. Thanks again for the report, and for the kind words! @GreenXDShadow

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

2 participants