@inventure71/paddockjs 4.1.0 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +76 -0
- package/INSTALL_AND_UPDATE.md +31 -5
- package/README.md +34 -3
- package/docs/advanced_ai_pace.md +131 -0
- package/docs/advanced_physics_rebuild.md +166 -0
- package/docs/architecture.md +111 -30
- package/docs/cleanup_coverage.md +284 -0
- package/docs/component_inventory.md +32 -16
- package/docs/composable-layouts.md +2 -0
- package/docs/concepts.md +12 -1
- package/docs/custom_model_controller.md +1 -1
- package/docs/data_contract.md +33 -10
- package/docs/data_model.md +4 -2
- package/docs/efficiency_cleanup_2026-10-13.md +80 -0
- package/docs/getting-started.md +3 -0
- package/docs/grid_walk.md +80 -0
- package/docs/index.md +5 -2
- package/docs/keyboard_driving_fix.md +118 -0
- package/docs/limit_driving_2026-10-14.md +88 -0
- package/docs/loading.md +141 -0
- package/docs/maintainability_audit_2026-09-08.md +146 -0
- package/docs/racing_ai_improvements.md +145 -0
- package/docs/rules.md +43 -13
- package/docs/sense_contract.md +4 -1
- package/docs/system_specs.md +40 -12
- package/docs/testing-reliability-guide.md +67 -0
- package/docs/v11_improvements.md +108 -0
- package/package.json +23 -15
- package/src/api/MountedSimulatorComponents.js +101 -0
- package/src/api/PaddockSimulatorController.js +56 -81
- package/src/app/BrowserExpertAdapter.js +0 -6
- package/src/app/BrowserExpertExternalRenderer.js +72 -50
- package/src/app/ExternalTrackSnapshot.js +50 -0
- package/src/app/F1SimulatorApp.js +242 -297
- package/src/app/HostLifecycleEmitter.js +93 -0
- package/src/app/banners/raceDataBannerController.js +9 -4
- package/src/app/camera/cameraConstants.js +1 -1
- package/src/app/camera/cameraController.js +10 -13
- package/src/app/camera/cameraGeometry.js +1 -1
- package/src/app/controls/SimulatorViewControls.js +45 -0
- package/src/app/controls/workbenchBindings.js +64 -0
- package/src/app/controls/workbenchDisclosure.js +41 -0
- package/src/app/domBindings.js +21 -13
- package/src/app/gridWalk/GridWalkController.js +180 -0
- package/src/app/gridWalk/gridWalkCamera.js +88 -0
- package/src/app/gridWalk/gridWalkControls.js +24 -0
- package/src/app/gridWalk/gridWalkCrew.js +246 -0
- package/src/app/gridWalk/gridWalkLabels.js +104 -0
- package/src/app/gridWalk/gridWalkLayout.js +46 -0
- package/src/app/gridWalk/gridWalkNavigation.js +99 -0
- package/src/app/gridWalk/gridWalkProjectBanner.js +43 -0
- package/src/app/gridWalk/gridWalkSession.js +50 -0
- package/src/app/layoutSupport.js +2 -0
- package/src/app/raceOverlayClearanceSupport.js +21 -7
- package/src/app/readouts/carOverviewRenderer.js +9 -4
- package/src/app/readouts/readoutFormatters.js +1 -8
- package/src/app/readouts/telemetryRenderer.js +1 -3
- package/src/app/readouts/timingTowerRenderer.js +48 -50
- package/src/app/rendering/appAssets.js +8 -10
- package/src/app/rendering/carRenderer.js +27 -79
- package/src/app/rendering/displayUtils.js +0 -6
- package/src/app/rendering/expertSensorRenderer.js +1 -1
- package/src/app/rendering/replayGhostRenderer.js +4 -1
- package/src/app/rendering/trackRenderer.js +2 -2
- package/src/app/runtime/frameLoop.js +18 -17
- package/src/app/runtime/pixiStartupLifecycle.js +94 -0
- package/src/app/runtime/runtimeTiming.js +4 -1
- package/src/app/runtime/runtimeVisibility.js +7 -2
- package/src/config/cssValues.js +1 -1
- package/src/config/defaultOptions.js +12 -173
- package/src/config/restartOptions.js +1 -0
- package/src/config/runtimeSeed.js +10 -0
- package/src/config/simulatorDefaults.js +106 -0
- package/src/config/telemetryModules.js +20 -0
- package/src/config/theme/cssTokens.js +85 -0
- package/src/config/theme/themeCss.js +72 -0
- package/src/config/theme/themeInputs.js +155 -0
- package/src/config/theme/themeResolver.js +172 -0
- package/src/config/theme/themeSelectors.js +69 -0
- package/src/config/theme/themeTokens.js +257 -0
- package/src/config/theme/themeUtils.js +15 -0
- package/src/config/themeOptions.js +14 -830
- package/src/config/timingGapMode.js +0 -2
- package/src/config/uiOptions.js +53 -0
- package/src/data/championship.js +16 -158
- package/src/data/championshipDefaults.js +87 -0
- package/src/data/driverData.js +10 -20
- package/src/data/entryIdentity.js +67 -0
- package/src/data/entryPresentation.js +23 -0
- package/src/data/entryTypes.d.ts +160 -0
- package/src/data/index.d.ts +12 -195
- package/src/data/ratingScale.js +14 -0
- package/src/data/teamTypes.d.ts +23 -0
- package/src/data/trackTypes.d.ts +101 -0
- package/src/data/vehicleData.js +12 -23
- package/src/environment/actions.js +3 -2
- package/src/environment/controllerLoop.js +57 -44
- package/src/environment/controllerScheduler.js +30 -0
- package/src/environment/driverObservations.js +260 -0
- package/src/environment/driverReset.js +51 -0
- package/src/environment/episode.js +0 -1
- package/src/environment/evaluation.js +6 -90
- package/src/environment/evaluationTracker.js +100 -0
- package/src/environment/events.js +23 -0
- package/src/environment/index.d.ts +35 -91
- package/src/environment/metrics.js +3 -17
- package/src/environment/observationSchema.js +104 -0
- package/src/environment/observationVector.js +16 -115
- package/src/environment/observations.js +16 -316
- package/src/environment/options.js +5 -24
- package/src/environment/renderFrames.js +21 -0
- package/src/environment/resetOptions.js +41 -0
- package/src/environment/results.js +125 -0
- package/src/environment/rewards.js +10 -16
- package/src/environment/runtime.js +17 -300
- package/src/environment/scenarioOptions.js +90 -0
- package/src/environment/scenarioPlacements.js +70 -0
- package/src/environment/scenarioPresets.js +78 -0
- package/src/environment/scenarios.js +5 -236
- package/src/environment/scratch.js +18 -0
- package/src/environment/sensorOptions.js +20 -0
- package/src/environment/sensors/index.js +2 -556
- package/src/environment/sensors/indexedRayBands.js +0 -18
- package/src/environment/sensors/nearbyCars.js +18 -15
- package/src/environment/sensors/opponentRadar.js +3 -2
- package/src/environment/sensors/pitConnectorProximity.js +20 -0
- package/src/environment/sensors/rayBandTrace.js +1 -37
- package/src/environment/sensors/rayBatch.js +81 -0
- package/src/environment/sensors/rayConfig.js +26 -0
- package/src/environment/sensors/rayGeometry.js +0 -8
- package/src/environment/sensors/rayGuards.js +0 -6
- package/src/environment/sensors/rayOutputs.js +75 -0
- package/src/environment/sensors/rayQuery.js +110 -0
- package/src/environment/sensors/rayScratch.js +146 -0
- package/src/environment/sensors/sensorTargets.js +12 -4
- package/src/environment/sensors/surfaceRays.js +6 -61
- package/src/environment/sensors/trackRays.js +7 -80
- package/src/environment/simulationSetup.js +30 -0
- package/src/environment/specs.js +15 -109
- package/src/index.d.ts +43 -202
- package/src/index.js +28 -6
- package/src/placeholder/index.js +1 -8
- package/src/rendering/displayLifecycle.js +6 -0
- package/src/rendering/proceduralTrackAsset.js +1 -1
- package/src/rendering/renderSnapshot.js +3 -0
- package/src/rendering/track/finishLineRenderer.js +1 -1
- package/src/rendering/track/gridRenderer.js +1 -1
- package/src/rendering/track/offsetStrokeSafety.js +2 -2
- package/src/rendering/track/pitLaneRenderer.js +1 -1
- package/src/rendering/track/trackMaterialRenderer.js +4 -4
- package/src/rendering/track/trackRenderConstants.js +0 -1
- package/src/rendering/track/trackRenderGeometry.js +1 -7
- package/src/simulation/collisionGeometry.js +12 -20
- package/src/simulation/driver/advancedPathControls.js +53 -0
- package/src/simulation/driver/advancedRacePace.js +112 -0
- package/src/simulation/driver/advancedRacingControls.js +61 -0
- package/src/simulation/driver/advancedRacingEnvelope.js +255 -0
- package/src/simulation/driver/advancedRacingSteering.js +76 -0
- package/src/simulation/driver/advancedRacingTiming.js +16 -0
- package/src/simulation/driver/arcadeRacePace.js +83 -0
- package/src/simulation/driver/arcadeRacingControls.js +111 -0
- package/src/simulation/driver/arcadeRacingEnvelope.js +63 -0
- package/src/simulation/driver/driverControlConstants.js +0 -2
- package/src/simulation/driver/driverController.js +16 -5
- package/src/simulation/driver/edgeRecovery.js +2 -3
- package/src/simulation/driver/racingControls.js +10 -396
- package/src/simulation/driver/racingDriverProfile.js +48 -0
- package/src/simulation/driver/racingLinePlan.js +54 -20
- package/src/simulation/driver/rejoinControls.js +59 -112
- package/src/simulation/driver/safetyCarControls.js +12 -0
- package/src/simulation/driver/trafficScan.js +136 -27
- package/src/simulation/participants/participantInteractions.js +24 -15
- package/src/simulation/pit/pitCarPlacement.js +29 -0
- package/src/simulation/pit/pitFlow.js +8 -30
- package/src/simulation/pit/pitIntent.js +4 -3
- package/src/simulation/pit/pitOccupancy.js +2 -2
- package/src/simulation/pit/pitQueue.js +2 -18
- package/src/simulation/pit/pitRouteMovement.js +1 -36
- package/src/simulation/pit/pitRouting.js +5 -81
- package/src/simulation/pit/pitService.js +3 -32
- package/src/simulation/pit/pitServiceConstants.js +1 -0
- package/src/simulation/pit/pitServiceProgress.js +34 -0
- package/src/simulation/pit/pitSnapshots.js +8 -4
- package/src/simulation/pit/pitState.js +1 -5
- package/src/simulation/race/classification.js +1 -8
- package/src/simulation/race/raceFinish.js +3 -8
- package/src/simulation/race/raceOrder.js +2 -13
- package/src/simulation/race/raceProgress.js +6 -20
- package/src/simulation/race/raceSetup.js +1 -1
- package/src/simulation/race/raceStep.js +20 -11
- package/src/simulation/race/redFlag.js +2 -4
- package/src/simulation/race/safetyCar.js +5 -9
- package/src/simulation/race/stalledDnf.js +2 -4
- package/src/simulation/raceSimulation.js +6 -38
- package/src/simulation/replay/replayGhosts.js +44 -32
- package/src/simulation/rules/collisionSteward.js +0 -14
- package/src/simulation/rules/penaltyActions.js +37 -0
- package/src/simulation/rules/penaltyLedger.js +8 -1
- package/src/simulation/rules/pitLaneSpeedingSteward.js +1 -1
- package/src/simulation/rules/rulesReview.js +20 -16
- package/src/simulation/rules/trackLimitsSteward.js +2 -2
- package/src/simulation/simMath.js +4 -0
- package/src/simulation/snapshots/raceSnapshots.js +30 -11
- package/src/simulation/timing/drsState.js +8 -0
- package/src/simulation/timing/drsTiming.js +2 -4
- package/src/simulation/timing/lapTelemetry.js +7 -4
- package/src/simulation/timing/sectorPerformance.js +14 -6
- package/src/simulation/timing/timingLines.js +12 -6
- package/src/simulation/track/pitLaneAccess.js +2 -2
- package/src/simulation/track/pitLaneLayout.js +4 -135
- package/src/simulation/track/pitLaneModel.js +70 -0
- package/src/simulation/track/pitLaneState.js +0 -1
- package/src/simulation/track/pitServiceLayout.js +121 -0
- package/src/simulation/track/proceduralTrack.js +77 -0
- package/src/simulation/track/spatialQueries.js +76 -31
- package/src/simulation/track/trackBuilder.js +54 -0
- package/src/simulation/track/trackConstants.js +0 -22
- package/src/simulation/track/trackMath.js +4 -29
- package/src/simulation/track/trackModel.js +12 -240
- package/src/simulation/track/trackModelCache.js +105 -0
- package/src/simulation/track/trackNearestQueries.js +1218 -0
- package/src/simulation/track/trackQueryConstants.js +3 -0
- package/src/simulation/track/trackQueryConstruction.js +368 -0
- package/src/simulation/track/trackQueryIndex.js +12 -1933
- package/src/simulation/track/trackQuerySegments.js +174 -0
- package/src/simulation/track/trackQueryStats.js +12 -0
- package/src/simulation/track/trackRayQueries.js +165 -0
- package/src/simulation/vehicle/advancedContactResponse.js +89 -0
- package/src/simulation/vehicle/advancedTireForces.js +92 -0
- package/src/simulation/vehicle/advancedVehicleModel.js +65 -0
- package/src/simulation/vehicle/advancedVehiclePhysics.js +127 -0
- package/src/simulation/vehicle/contactResolution.js +23 -9
- package/src/simulation/vehicle/mainTrackWheelSurface.js +2 -13
- package/src/simulation/vehicle/pitWheelSurface.js +0 -12
- package/src/simulation/vehicle/runoffResponse.js +2 -4
- package/src/simulation/vehicle/sampledWheelSurface.js +266 -0
- package/src/simulation/vehicle/vehicleGeometry.js +85 -103
- package/src/simulation/vehicle/vehicleKinematics.js +10 -0
- package/src/simulation/vehicle/vehiclePhysics.js +42 -196
- package/src/simulation/vehicle/vehicleSnapshots.js +18 -6
- package/src/simulation/vehicle/vehicleState.js +5 -3
- package/src/simulation/vehicle/wheelSurface.js +13 -432
- package/src/simulation/vehicle/wheelSurfaceCache.js +55 -0
- package/src/simulation/vehicle/wheelSurfaceSummary.js +101 -0
- package/src/styles.css +173 -19
- package/src/ui/bannerTemplates.js +4 -2
- package/src/ui/cameraControlsTemplate.js +4 -2
- package/src/ui/gridWalkTemplate.js +29 -0
- package/src/ui/htmlEscaping.js +8 -0
- package/src/ui/raceCanvasTemplate.js +3 -2
- package/src/ui/shellTemplate.js +3 -0
- package/src/ui/telemetryDrawerTemplate.js +4 -2
- package/src/ui/telemetryTemplates.js +3 -22
- package/src/ui/templateUtils.js +2 -8
- package/src/ui/viewControlsTemplate.js +21 -0
- package/examples/train-basic-policy.mjs +0 -276
- package/examples/trainingData.mjs +0 -133
package/docs/system_specs.md
CHANGED
|
@@ -12,6 +12,10 @@ The host website owns only:
|
|
|
12
12
|
- Optional display/config overrides.
|
|
13
13
|
- `onDriverOpen(driver)` navigation behavior.
|
|
14
14
|
|
|
15
|
+
Opt-in [Grid Walk](grid_walk.md) is package-owned presentation around normal browser playback. Both returned APIs expose `getView()` and `setView('grid-walk' | 'race')`; `gridWalk` options control enablement, initial view and ambient motion. Entry metadata supplies names, summaries and ordinary links for the shared race project banner at the bottom; the entry selector sits centered at the top with centered text. There is no additional project inspector. Grid Walk holds the race before its lights sequence and pauses/resumes exact progress on later returns. Resizing changes camera framing. Drag/touch, wheel and keyboard browsing share one axis-constrained camera action and preserve a bounded longitudinal world position without stepping the race. Measured chrome bounds and packed label lanes prevent overlay collisions; selection does not reset visible framing. Grid labels use opaque themed surfaces; the shared banner follows existing sizing and enabled/muted policy.
|
|
16
|
+
|
|
17
|
+
The package-styled Grid Walk / Race switch mounts outside the scene through `mountViewControls()`, with automatic composition above the all-in-one shell and race telemetry drawer. A standalone canvas requires an explicitly mounted switch or host controls calling `setView()`. `ui.viewControls` defaults to `'switch'` and accepts `'toggle'` for a single green Start race / red Stop race action using semantic green/red flag colors; unknown values use `'switch'`. Stop pauses exact race progress and shows the original display grid, while Start resumes it. Both variants share runtime state, enable when ready, hide when Grid Walk is disabled and update after restart. Wheel browsing yields to page scrolling at the grid limits; Ctrl/Meta wheel retains browser zoom, and Race zoom is excluded while Grid Walk owns input. Varied groups of two to five mechanics and continuously distributed walking visitors respect reduced motion and host ambient-motion settings, with no motion toggle in the overlay. Expert mode is excluded; existing consumer defaults are preserved.
|
|
18
|
+
|
|
15
19
|
## Public API
|
|
16
20
|
|
|
17
21
|
Main import:
|
|
@@ -51,7 +55,7 @@ Root package exports:
|
|
|
51
55
|
| Export group | Public exports | Use |
|
|
52
56
|
| --- | --- | --- |
|
|
53
57
|
| Browser mounts | `mountF1Simulator`, `createPaddockSimulator` | all-in-one shell or composable package-owned UI surfaces |
|
|
54
|
-
| Composable helper mounts | `mountRaceControls`, `mountCameraControls`, `mountSafetyCarControl`, `mountTimingTower`, `mountRaceCanvas`, `mountTelemetryPanel`, `mountTelemetryCore`, `mountTelemetrySectors`, `mountTelemetrySectorBanner`, `mountTelemetryLapTimes`, `mountTelemetrySectorTimes`, `mountRaceTelemetryDrawer`, `mountCarDriverOverview`, `mountRaceDataPanel` | function-call wrappers around a composable simulator controller |
|
|
58
|
+
| Composable helper mounts | `mountRaceControls`, `mountCameraControls`, `mountViewControls`, `mountSafetyCarControl`, `mountTimingTower`, `mountRaceCanvas`, `mountTelemetryPanel`, `mountTelemetryCore`, `mountTelemetrySectors`, `mountTelemetrySectorBanner`, `mountTelemetryLapTimes`, `mountTelemetrySectorTimes`, `mountRaceTelemetryDrawer`, `mountCarDriverOverview`, `mountRaceDataPanel` | function-call wrappers around a composable simulator controller |
|
|
55
59
|
| Startup placeholder | `createPaddockLoadingPlaceholder` from `@inventure71/paddockjs/placeholder`, plus `@inventure71/paddockjs/placeholder.css` | optional pre-JS loading placeholder that does not import PixiJS, simulator assets, root runtime CSS, or the browser mount |
|
|
56
60
|
| Data helpers | `DriverData`, `VehicleData`, `CHAMPIONSHIP_ENTRY_BLUEPRINTS`, `DEMO_PROJECT_DRIVERS`, `buildChampionshipDriverGrid`, `formatDriverNumber`, `normalizeSimulatorDrivers` | demo data, host entry normalization, and rating helper construction |
|
|
57
61
|
| Theme helpers | `DEFAULT_PADDOCK_THEME`, `PADDOCK_THEME_CSS_VARIABLES`, `PADDOCK_THEME_TOKEN_KEYS`, `resolvePaddockTheme`, `applyPaddockTheme` | host-side theme preview/sync code without copying package token names |
|
|
@@ -132,6 +136,8 @@ const simulator = await mountF1Simulator(root, {
|
|
|
132
136
|
});
|
|
133
137
|
```
|
|
134
138
|
|
|
139
|
+
Race-control headings use a content-sized line box that accommodates wrapped text and native font metrics. Their title and button groups must fit standalone and composed mounts without clipping or overlap; no fixed title-height or overflow masking is used to hide extra text.
|
|
140
|
+
|
|
135
141
|
The all-in-one shell normalizes `backLinkHref` before rendering it. Package-owned race controls accept relative URLs, hash URLs, and absolute `http:` / `https:` URLs; unsafe or malformed values fall back to the default `projects.html` link instead of being rendered into the anchor. Runtime readouts also validate snapshot-derived color values before writing CSS custom properties, and package-owned asset URLs are escaped before becoming CSS `url(...)` values.
|
|
136
142
|
|
|
137
143
|
Composable mount call:
|
|
@@ -162,6 +168,7 @@ const simulator = createPaddockSimulator({
|
|
|
162
168
|
|
|
163
169
|
simulator.mountRaceControls(controlsRoot);
|
|
164
170
|
simulator.mountCameraControls(cameraControlsRoot);
|
|
171
|
+
simulator.mountViewControls(viewControlsRoot);
|
|
165
172
|
simulator.mountSafetyCarControl(safetyCarRoot);
|
|
166
173
|
simulator.mountTimingTower(timingRoot);
|
|
167
174
|
simulator.mountRaceCanvas(canvasRoot, {
|
|
@@ -195,6 +202,7 @@ The controller methods above are the canonical composable API. They keep compone
|
|
|
195
202
|
```js
|
|
196
203
|
mountRaceControls(root, simulator);
|
|
197
204
|
mountCameraControls(root, simulator);
|
|
205
|
+
mountViewControls(root, simulator);
|
|
198
206
|
mountSafetyCarControl(root, simulator);
|
|
199
207
|
mountTimingTower(root, simulator);
|
|
200
208
|
mountRaceCanvas(root, simulator, {
|
|
@@ -222,6 +230,7 @@ Returned controller:
|
|
|
222
230
|
// Included on composable controllers only:
|
|
223
231
|
mountRaceControls(root),
|
|
224
232
|
mountCameraControls(root),
|
|
233
|
+
mountViewControls(root),
|
|
225
234
|
mountSafetyCarControl(root),
|
|
226
235
|
mountTimingTower(root),
|
|
227
236
|
mountRaceCanvas(root, { includeRaceDataPanel, includeTimingTower, includeTelemetrySectorBanner, timingTowerVerticalFit }),
|
|
@@ -253,6 +262,9 @@ Returned controller:
|
|
|
253
262
|
getPitIntent(driverId),
|
|
254
263
|
getPitTargetCompound(driverId),
|
|
255
264
|
getSimulationSpeed(),
|
|
265
|
+
setTimingGapMode(mode),
|
|
266
|
+
getTimingGapMode(),
|
|
267
|
+
toggleTimingGapMode(),
|
|
256
268
|
servePenalty(penaltyId),
|
|
257
269
|
cancelPenalty(penaltyId),
|
|
258
270
|
callSafetyCar(),
|
|
@@ -266,11 +278,19 @@ Returned controller:
|
|
|
266
278
|
## Required Behavior
|
|
267
279
|
|
|
268
280
|
- Mounting creates the simulator shell inside the provided root.
|
|
281
|
+
- A root may own only one live all-in-one mount. A second mount is rejected until the first controller is destroyed; failed initialization clears and releases the root for retry.
|
|
269
282
|
- Composable mounting can place controls, timing tower, canvas, telemetry, car/driver overview, and race-data panels into separate host roots.
|
|
270
283
|
- Composable mounting can also place camera controls and a safety-car button into separate host roots while keeping package-owned markup.
|
|
271
284
|
- Composable mounting can embed the timing tower directly inside the race canvas with `mountRaceCanvas(root, { includeTimingTower: true })`.
|
|
272
285
|
- The race canvas is required before `start()` because PixiJS needs a canvas host.
|
|
273
286
|
- Mount component roots before calling `start()`. A pre-start `restart(nextOptions)` re-resolves options and refreshes already mounted component markup, so non-asset changes such as title, kicker, UI visibility, theme, drivers, entries, seed, or track seed are reflected before `start()` binds the runtime.
|
|
287
|
+
- `restart()` during pending composable startup is rejected before options or mounted DOM change. Await `start()` (or its rejection) before restarting.
|
|
288
|
+
- Each composable surface key owns one root. Replacing that surface clears its previous root, and different surface keys cannot share one root. Concurrent `start()` calls await one initialization; failure destroys partial state and leaves the controller retryable.
|
|
289
|
+
- Destroying a composable controller during `start()` cancels that start promise. Pending renderer resources are released once initialization settles, and late assets cannot repopulate the unmounted scene or emit ready callbacks. After the cancelled promise settles, hosts may remount components and start again. Cleanup failures are reported through `onError(error, { phase: 'destroy' })` without abandoning independent cleanup or masking an earlier initialization error.
|
|
290
|
+
- Hosts that constrain a standalone telemetry stack should give its root a definite height; the stack then owns internal scrolling. A maximum height alone does not resolve the child's percentage height and can allow content to overflow neighboring host surfaces.
|
|
291
|
+
- Repeated overview, timing, restart and zoom surfaces share one runtime but bind/render independently. Timing rows activate with native mouse, touch and keyboard clicks; wheel zoom ignores horizontal-only and no-op events, modifier wheel input, and Grid Walk-owned input. Project Open callbacks use the standard `onError` isolation contract.
|
|
292
|
+
- Host race callbacks may destroy or restart the simulator. Normal frames, expert frames and readout updates stop before rendering stale state when those callbacks unmount or replace the current race.
|
|
293
|
+
- Normal visible playback caps actual Pixi drawing at 60 FPS, including on high-refresh displays; elapsed-time fixed-step simulation still runs at the requested playback speed. Pixi stays stopped during asset loading, and independent sprite/track textures load concurrently. Expert rendering remains explicitly driven by expert reset/step calls.
|
|
274
294
|
- `mountF1Simulator()` and each composable `mount*()` call must synchronously write lightweight package HTML before awaiting runtime initialization. Those startup templates may contain controls/readout placeholders, but they must not require PixiJS, texture loading, race stepping, or host-provided hidden DOM to be visible.
|
|
275
295
|
- Timing tower, telemetry, controls, and race-data panels are optional from a runtime safety perspective; omitted panels simply do not render their readouts.
|
|
276
296
|
- Timing tower entries are compact content-sized rows stacked from the top of the timing list. Row vertical position must be based on rank/index, never distributed by available height or total entry count. `ui.timingEntryVerticalPadding` defaults to `5` and applies that pixel value above and below every row entry.
|
|
@@ -283,10 +303,10 @@ Returned controller:
|
|
|
283
303
|
- `preset` is a preset-first API. Presets are resolved before explicit host overrides so hosts can use `dashboard`, `timing-overlay`, `compact-race`, or `full-dashboard` as a starting point and still override specific `ui` or `theme` fields.
|
|
284
304
|
- `theme` is the public sizing/color contract. It resolves semantic package-owned tokens into complete light/dark themes, supports named derivative theme packages through `theme.themes`, selects the active package with `theme.use`, applies component-specific packages through `theme.componentThemes`, and accepts team selectors through `theme.teamThemes` or `entries[*].team.theme`. Component theme keys accept package component ids such as `timing-tower` and camelCase aliases such as `timingTower`; `selectedDriverPanel` targets both selected-driver package surfaces. Selected-driver surfaces use the selected team's theme by default when one is available while structural controls keep the active global theme unless explicitly overridden. Unknown theme tokens or component slots are ignored, one-sided light/dark token overrides generate and cache the opposite mode, and theme plus driver/team colors are validated before they are written to CSS variables. Legacy aliases such as `accentColor`, `greenColor`, and `yellowColor` remain migration aliases for the new semantic tokens.
|
|
285
305
|
- `setTheme(theme)`, `setThemeMode(mode)`, and `syncThemeFrom(element, options)` are runtime presentation APIs. They must resolve through the same theme normalizer used at mount time, reapply CSS variables to every package-owned mounted root, and must not call `restart()` or replace race state. Existing simulation state, timing order, selected driver, active penalties, camera state, speed setting, and pit intent state remain owned by the running app. `syncThemeFrom()` applies immediately, watches the configured attribute with `MutationObserver` when available, maps host attribute values through `options.map`, and returns a cleanup function.
|
|
286
|
-
- `initialCameraMode` accepts `'overview'`, `'leader'`, `'selected'`, `'driver'`, `'show-all'`, or `'pit'`; invalid values fall back to `'leader'`. The overview camera frames the active generated track bounds with package-owned padding and pit-lane extent. The driver camera follows the selected car from a lower screen anchor and rotates the world so the selected car points upward; its control is opt-in through `ui.driverCamera: true`, and `initialCameraMode: 'driver'` enables that control automatically. The pit camera frames the operational `track.pitLane` lane, boxes, service areas, and queue areas instead of the longer entry/exit access roads, zooms out when needed to keep that pit-lane work area inside the active race-view safe area, and its control is hidden/disabled if the active track has no pit lane. Zoom buttons and wheel zoom work in every camera mode, including overview, show-all, driver, and pit, but cannot zoom farther out than the active track frame.
|
|
306
|
+
- `initialCameraMode` accepts `'overview'`, `'leader'`, `'selected'`, `'driver'`, `'show-all'`, or `'pit'`; invalid values fall back to `'leader'`. The overview camera frames the active generated track bounds with package-owned padding and pit-lane extent. The driver camera follows the selected car from a lower screen anchor and rotates the world so the selected car points upward; its control is opt-in through `ui.driverCamera: true`, and `initialCameraMode: 'driver'` enables that control automatically. The pit camera frames the operational `track.pitLane` lane, boxes, service areas, and queue areas instead of the longer entry/exit access roads, zooms out when needed to keep that pit-lane work area inside the active race-view safe area, and its control is hidden/disabled if the active track has no pit lane. Zoom buttons and wheel zoom work in every camera mode, including overview, show-all, driver, and pit, but cannot zoom farther out than the active track frame. Wheel events are canceled only when the Race zoom value changes; events at either zoom limit can scroll the containing page. Ctrl/Meta wheel, host-handled and non-cancelable wheel events remain browser/host-owned. Native touch scrolling is enabled on Race canvases; only active Grid Walk opts into touch dragging. The runtime never locks document/body scrolling.
|
|
287
307
|
- Camera controls default to external placement so they do not cover the race view. They can still be embedded in the race canvas by setting `ui.cameraControls: 'embedded'`, externally mounted, or omitted with `false`. Generated camera controls include a `Mute banners` toggle that is off by default and temporarily suppresses project/radio lower-thirds while active. The driver camera button is omitted unless `ui.driverCamera` is active.
|
|
288
308
|
- Telemetry surfaces are detached package components: core scalar readouts, sector graph, broadcast sector banner, lap-time table, and sector-time table. The broadcast sector banner shows the selected car identity, uses the selected car color for its frame/label, and keeps sector performance colors inside the sector bars. It is an explicitly mounted independent surface, not the default telemetry-drawer lower-third. `mountTelemetryPanel()` is the stack template around those detached pieces, owns vertical scrolling when constrained, and `ui.telemetryModules` controls which pieces appear in stack/drawer templates.
|
|
289
|
-
- `mountRaceTelemetryDrawer()` creates a package-owned race workbench: external top controls, race canvas, embedded timing tower, lower-third banner, top steward message, safety-car control, and a right-side telemetry drawer. The top row holds camera controls, banner mute, safety car,
|
|
309
|
+
- `mountRaceTelemetryDrawer()` creates a package-owned race workbench: external top controls, race canvas, embedded timing tower, lower-third banner, top steward message, safety-car control, and a right-side telemetry drawer. The top row holds camera controls, banner mute, safety car, telemetry toggle and, when Grid Walk is enabled, its separately composed view switch outside the canvas. Camera controls fill their available row, and changing Start/Stop or Telemetry/Close labels reserve their widest intrinsic width to keep adjacent controls stable. On narrow responsive containers, that toolbar stacks into readable full-width rows and keeps safety car plus telemetry as a two-column action row instead of squeezing them beside the camera controls. Pass `{ raceDataTelemetryDetail: true }` when the drawer lower-third should include compact project telemetry detail. The drawer opens smoothly, takes width from the race view instead of overlaying it, is inert/hidden to interaction when closed, and embeds the same `telemetry-stack` component used by standalone telemetry panels.
|
|
290
310
|
- The FPS readout can be shown or hidden with `ui.showFps`.
|
|
291
311
|
- `ui.layoutPreset: 'left-tower-overlay'` is a package-owned preset that creates a left broadcast gutter inside the race view, places the timing tower there at the same width as the default timing-board column, frames the PixiJS camera around the remaining usable race area, and keeps camera controls and start lights out of the tower area. In the combined shell, project and radio lower-thirds stay inside the race window while being allowed to cover the timing sidebar.
|
|
292
312
|
- `ui.raceDataBanners.initial` controls the starting lower-third (`'project'`, `'radio'`, or `'hidden'`), and `ui.raceDataBanners.enabled` controls which lower-third types can appear. The runtime banner mute state temporarily disables project/radio lower-thirds without changing these configured allow-lists.
|
|
@@ -304,11 +324,11 @@ Returned controller:
|
|
|
304
324
|
- The host passes data, not internal DOM.
|
|
305
325
|
- Host driver IDs and entry `driverId` values must be unique. Entries may omit `driverNumber`; provided numbers must be unique.
|
|
306
326
|
- `totalLaps` is normalized to a finite positive integer before simulation so invalid input cannot produce zero-lap, negative-lap, or non-finite snapshots.
|
|
307
|
-
- `physicsMode` accepts `'arcade'` and `'advanced'`. The default is `'arcade'` to preserve existing hosts. `'advanced'` is opt-in and keeps cars controlled only through steering, throttle, brake, and pit intent while enabling
|
|
327
|
+
- `physicsMode` accepts `'arcade'` and `'advanced'`. The default is `'arcade'` to preserve existing hosts. `'advanced'` is opt-in and keeps cars controlled only through steering, throttle, brake, and pit intent while enabling four-contact tire forces, load transfer, yaw inertia, aerodynamic load/drag, velocity-heading slip, and advanced telemetry. The old `'simulator'` mode name is removed and falls back to `'arcade'` like any other invalid value. Snapshots expose `physicsMode` plus per-car `lateralG`, `longitudinalG`, `gripUsage`, `slipAngleRadians`, `tractionLimited`, `stabilityState`, and the latest `appliedControls`.
|
|
308
328
|
- `restart(nextOptions)` can change race data and deterministic seeds such as `trackSeed`, but it does not support changing asset URLs. Asset changes require `destroy()` and a fresh mount because PixiJS texture loading is an initialization boundary.
|
|
309
329
|
- `onDriverOpen(driver)` is the navigation boundary.
|
|
310
|
-
- Lifecycle callbacks are optional: `onLoadingChange`, `onReady`, `onError`, `onDriverSelect`, `onRaceEvent`, `onLapChange`, and `onRaceFinish`. Lifecycle callback failures are routed to `onError` when possible and must not stop the simulator loop. `onDriverOpen(driver)` is host-owned navigation code and is not wrapped as a lifecycle callback.
|
|
311
|
-
- Race completion is part of the simulation snapshot. Cars receive individual `finished`, `finishTime`, `finishRank`, `status: 'waved-flag'`, `raceStatus: 'waved-flag'`, `wavedFlag`, `penaltySeconds`, `adjustedFinishTime`, and `classifiedRank` values as they cross the finish distance. Destroyed/out-of-race cars expose `dnf`, `dnfReason`, `dnfAt`, and `dnfOrder`, appear below active cars in timing, render faded/gray in the race canvas, and do not block race completion while they remain DNF. The first finisher sets a provisional `raceControl.winner`; already-finished cars remain frozen in provisional finish order while the remaining cars complete the distance. Final `raceControl.classification` and `raceControl.finished` are set only after every race participant has finished or is DNF. DNF entries are included after finishers with no finish time. A DNF car restored before final classification re-enters live timing and must finish; after final classification, resurrection does not reopen the race. Final classification converts unserved drive-through and stop-go penalties into configured time, sorts finishers by `finishTime + penaltySeconds`, applies position-drop and disqualification consequences, then race control switches to `safety-car`, the final order freezes to the classified result, and the field keeps circulating under safety-car behavior.
|
|
330
|
+
- Lifecycle callbacks are optional: `onLoadingChange`, `onReady`, `onError`, `onDriverSelect`, `onRaceEvent`, `onLapChange`, and `onRaceFinish`. Normal ticker frames and expert-driven frames use the same lifecycle emitter. Stable event identifiers distinguish separate same-time events, while duplicate delivery of the same event is suppressed. Lifecycle callback failures are routed to `onError` when possible and must not stop the simulator loop. `onDriverOpen(driver)` is host-owned navigation code and is not wrapped as a lifecycle callback.
|
|
331
|
+
- Race completion is part of the simulation snapshot. Cars receive individual `finished`, `finishTime`, `finishRank`, `status: 'waved-flag'`, `raceStatus: 'waved-flag'`, `wavedFlag`, `penaltySeconds`, `adjustedFinishTime`, and `classifiedRank` values as they cross the finish distance. Destroyed/out-of-race cars expose `dnf`, `dnfReason`, `dnfAt`, and `dnfOrder`, appear below active cars in timing, render faded/gray in the race canvas, and do not block race completion while they remain DNF. The first finisher sets a provisional `raceControl.winner`; already-finished cars remain frozen in provisional finish order while the remaining cars complete the distance. Final `raceControl.classification` and `raceControl.finished` are set only after every race participant has finished or is DNF. DNF entries are included after finishers with no finish time. A DNF car restored before final classification re-enters live timing and must finish; after final classification, resurrection does not reopen the race. Final classification converts unserved drive-through and stop-go penalties into configured time, sorts finishers by `finishTime + penaltySeconds`, applies position-drop and disqualification consequences, then race control switches to `safety-car`, the final order freezes to the classified result, and the field keeps circulating under safety-car behavior. Timing presentation continues to show final winner/finished labels from `raceControl.finished` rather than reverting to safety-car labels.
|
|
312
332
|
- Race rules support package presets and custom module config. Supported rulesets are `paddock`, `grandPrix2025`, `fia2025`, and `custom`. Active advanced modules include pit stops, tire strategy, tire degradation, stalled off-track DNF, and penalties. Weather, reliability, and fuel load are reserved module placeholders only; they do not currently change grip, power, retirement risk, mass, or pace. The current simulator normalizes all module config, creates/renders track-owned pit-lane geometry on tracks whose resolved generation options enable it, treats pit-lane asphalt, working-lane service areas, and garage boxes as legal drivable surfaces, runs automatic bounded pit-train entry/service/exit through the main fast lane and shared team service areas when pit stops are enabled, lets host/expert pit calls choose a target tire compound, uses the team queue point as a rolling gate when the service area is free, queues a second team car behind the active service area and moves it forward through a queue-release route only after the active service area is physically clear, keeps pit-route approach speed bounded until the final queue/service capture instead of crawling through open route, optionally varies pit-service time from team pit-crew stats with a perfect-training override, supports pit-lane open/closed state plus red flags, requests pit stops from configurable tire-energy thresholds, applies nonlinear tire-grip degradation down to 1% unless `rules.modules.tireDegradation.enabled` is `false`, can retire cars that remain off legal racing/pit surfaces below the configured stalled-DNF speed threshold for the configured duration when `rules.modules.stalledDnf.enabled` is `true`, applies the pit speed limiter only on the main pit lane/working lane, enforces pit-lane speeding on speed-limited pit-lane parts but not on entry/exit connectors, keeps the safety car about `55m` ahead of the leader with compact `22m` frozen-order queue slots, lets the built-in driver AI ride kerbs, attack, defend, and recover through normal steering/throttle/brake decisions with short controller-state commitments for rejoin and attack decisions, and enforces stewarded penalties for collisions, track limits, pit-lane speeding, and tire requirements. `tireStrategy` does not enable automatic pit stops; `pitStops.enabled` is required for pit routing and non-clear pit intent requests.
|
|
313
333
|
- Penalty subsections use `strictness` from `0` to `1`, not only boolean enablement. `strictness: 0` means the subsection is not enforced; `strictness: 1` applies the configured rule margin. Steward decisions are exposed as `penalty` events and as top-level `snapshot.penalties`. Penalty entries include normalized consequences and lifecycle status. Immediate consequences apply time, grid, position, or disqualification effects directly; drive-through and stop-go consequences remain issued until served, cancelled, or converted at final classification.
|
|
314
334
|
- The browser UI can opt into top steward messages with `ui.penaltyBanners` and timing-row penalty badges with `ui.timingPenaltyBadges`. Steward messages render track-limit warning events and penalty decisions from the simulation; time-penalty messages put the penalty seconds in a large left chip and use penalty-colored backgrounds, while warnings use warning-colored backgrounds. Timing-row `!` badges are rendered only from `snapshot.penalties`; warning events do not count. UI code must not recalculate steward decisions.
|
|
@@ -317,14 +337,15 @@ Returned controller:
|
|
|
317
337
|
- Package CSS must be scoped to package mount roots/components and must not style same-named host elements outside `.f1-sim-component` roots. Generic simulator classes such as `.sim-control`, `.camera-controls`, `.timing-list`, `.telemetry-header`, and `.start-lights` are package internals, not host styling hooks. The stylesheet uses system font stacks by default and must not force remote font requests; hosts that want custom typography should load those fonts themselves and pass theme/CSS-variable overrides.
|
|
318
338
|
- The simulation should remain deterministic for the same seed, track seed, drivers, entries, and rules.
|
|
319
339
|
- Warmup is enabled by default for browser mounts, headless environments, and direct simulation creation. It runs on a disposable runtime and must not mutate the visible initial race state; under the default `warmup.policy: 'config-change'`, identical configuration fingerprints reuse cached warmup while seed/config changes rerun warmup automatically.
|
|
320
|
-
- When `trackSeed` is omitted in a browser mount, the simulator creates a fresh procedural circuit for that mount. Explicit `trackSeed` values are deterministic and cached by seed plus resolved generation options
|
|
321
|
-
- The renderer
|
|
340
|
+
- When `trackSeed` is omitted in a browser mount, the simulator creates a fresh procedural circuit for that mount. Explicit `trackSeed` values are deterministic and cached by seed plus resolved generation options in a bounded eight-entry least-recently-used cache. Repeated contracts reuse immutable generated geometry; evicted contracts regenerate deterministically. Callers that import `createProceduralTrack(seed, options)` should treat the returned definition as read-only and clone it before custom mutation. `trackGeneration` forwards the same procedural options used by `createProceduralTrack(seed, options)`: `profile`, `length`, `startStraight`, `pitLane`, `shape`, `validation`, and `attempts`. The `race` profile preserves the default full circuit with pit lane; `training-short`, `training-medium`, and `training-technical` are smaller pitless presets intended for training or demos. Explicit option fields override profile defaults after the profile is resolved. Procedural generation traces seeded connected region boundaries, smooths and warps them into centerline controls, then rejects circuits with excessive local heading jumps, turn accumulation, self-intersections, poor clearance, invalid length, or weak shape variation.
|
|
341
|
+
- The renderer targets at most 60 FPS through Pixi's private ticker. Every draw updates the interpolated vehicle poses from measured elapsed wall time rather than rounded frame counts; deterministic physics still advances in fixed steps. Catch-up is bounded to four target frame intervals, and follow-camera damping scales with elapsed time. There is no second draw/update gate that could render stale poses on irregular or high-refresh displays.
|
|
342
|
+
- Stable replay halo appearance reuses its geometry, and stable overlay clearance causes no repeated class/style mutations. Render snapshot ordering and per-observation nearby preparation reuse internal scratch without changing public snapshot freshness or model-facing sense values.
|
|
322
343
|
- The render loop should pause while the race canvas is offscreen or the document is hidden, then resume without catching up the elapsed hidden time. Runtime visibility must not rely on a single observer state: it should resync from canvas geometry after observer, scroll, resize, focus, and page-show signals, and ticker sync should reconcile the intended runtime state with PixiJS' actual started/stopped state. Layout measurements needed for overlay camera safe areas should be cached between resize/layout invalidations. Runtime DOM updates should skip unchanged text/markup so visible embeds do not rewrite stable readouts every frame.
|
|
323
344
|
- Restart and rerender paths must destroy replaced PixiJS display children while preserving shared loaded textures.
|
|
324
345
|
- Restart supports race/data/seed changes but does not support asset URL changes or browser expert mode changes. Texture loading and ticker ownership are mount-time boundaries; hosts must destroy and mount again to change either boundary.
|
|
325
346
|
- Expert environment code can create a headless `createPaddockEnvironment()` from the `@inventure71/paddockjs/environment` subpath. It requires explicit `controlledDrivers`, accepts normalized actions `{ steering, throttle, brake }` plus optional `pitIntent` and `pitCompound`, advances only through `step(actions)`, and returns environment-loop JavaScript results with `observation`, `reward`, `metrics`, `terminated`, `truncated`, `done`, `events`, `state`, and `info`. `steering` is an absolute normalized steering target: `-1` points at maximum left, `0` points at center, `1` points at maximum right, and intermediate values are percentages of the maximum steering angle; the vehicle integrator rate-limits motion toward that target instead of snapping the wheel. `steering`, `throttle`, and `brake` are required for each controlled-driver action. Strict action policy throws on missing or non-finite vehicle controls, while report policy records the error and releases stale manual controls so the built-in driver owns that physics step. `info.drivers[driverId]` exposes per-driver `terminated`, `truncated`, `endReason`, `episodeStep`, and `episodeId` for batched loops; selected-driver resets clear only selected driver truncation/termination and do not rewind global `info.step`. For scoped reset results, `info.controlledDrivers` matches the drivers present in `observation` and `metrics`, while `info.drivers` preserves episode state for all configured controlled drivers. Controlled drivers do not receive tire-threshold automatic pit calls; they request automatic pit service through `pitIntent`, may choose the target tire through `pitCompound`, and observe pit-lane/service/race-control state in `observation[driverId].object.self` and `.race`. `pitIntent: 0` is a no-op clear request and does not fail when pit stops are disabled. `self.onTrack` follows wheel-level legality, so track, kerb, and legal pit-lane/box surfaces are on-track while gravel/grass/barrier are off-track. Barrier-wall contact in both physics modes is measured against the rendered wall's inner face; contact marks the car destroyed/DNF, removes it from active collision/sensor participation, emits a `car-destroyed` event, and terminates that driver's episode with `endReason: 'destroyed'`. Opt-in stalled off-track DNF removes the car from the same active participation systems while keeping `destroyed: false` and terminates controlled-driver episodes with `endReason: 'stalled-off-track'` when `rules.modules.stalledDnf.enabled` is `true`. Reset is still an episode-boundary `resetDrivers()` call. Environment scenarios may set reset positions with `preset`, `placements`, and relative `traffic`; `resetDrivers(placements)` may reset selected controlled drivers between episodes without recreating the whole simulation. Partial `reset(options)` calls preserve omitted nested option groups while replacing arrays and explicit scenario placement maps. After placement, selected cars are classified by the same runoff/barrier rules before observations are returned, so cars already inside terminal barrier space report destroyed metrics and stable miss-valued rays instead of doing alive-car far-out ray scans. Both scenario placement and `resetDrivers()` are setup data, not policy actions. `participantInteractions` may make real physics cars non-colliding, sensor-hidden, non-blocking for pit occupancy, or excluded from race order, but those cars still live in `snapshot.cars` and move only through normal physics/control APIs. The `batch-training` profile is non-colliding, sensor-hidden, pit-non-blocking, excluded from race order, and still rendered. `replayGhosts` are separate trajectory-driven entities in `snapshot.replayGhosts`; they are visual/reference overlays and never enter car physics, timing, pit, order, or penalty systems. Replay ghosts are sensor-hidden unless their own sensor flags explicitly opt them into ray or nearby observations.
|
|
326
|
-
- Headless environments also accept an optional `externalRenderer` observer hook. It receives `{ snapshot, observation, meta }` on `reset`, `step`, and `resetDrivers`, so external tooling can stream authoritative frames to visualizers without letting that transport mutate simulation state.
|
|
327
|
-
- Controller loop code should use `createPaddockDriverControllerLoop()` instead of duplicating browser/headless stepping. Its controller context groups observations by controlled driver id, includes `orderedObservations` for direct batch tensor assembly, exposes metrics, events, cached specs, and reset-driver ids, and keeps per-driver resets as controller reset hooks when the runtime supports `resetDrivers()`. `previousActions` is the last action map actually applied before the current `actions`; on the first controlled frame after reset it is empty, and after repeated frames it reflects the prior physics step rather than pre-copying the current decision.
|
|
347
|
+
- Headless environments also accept an optional `externalRenderer` observer hook. It receives `{ snapshot, observation, meta }` on `reset`, `step`, and `resetDrivers`, so external tooling can stream authoritative frames to visualizers without letting that transport mutate simulation state. The environment reuses the step's authoritative observation/public snapshot for that hook instead of taking a second full snapshot solely for transport.
|
|
348
|
+
- Controller loop code should use `createPaddockDriverControllerLoop()` instead of duplicating browser/headless stepping. Its controller context groups observations by controlled driver id, includes `orderedObservations` for direct batch tensor assembly, exposes metrics, events, cached specs, and reset-driver ids, and keeps per-driver resets as controller reset hooks when the runtime supports `resetDrivers()`. `previousActions` is the last action map actually applied before the current `actions`; on the first controlled frame after reset it is empty, and after repeated frames it reflects the prior physics step rather than pre-copying the current decision. Stopping or fully resetting the loop invalidates an in-flight async decision so it cannot apply a stale action after cancellation.
|
|
328
349
|
- Expert ray sensors originate from the controlled car center. The default compact set is `[-135, -60, -20, 0, 20, 60, 135, 180]`, giving forward, side, and rear awareness while staying small. Rays detect track edges against the actual track geometry and detect car hits by ray-to-car-footprint intersection; scratch-backed car-hit checks use the same caller-owned ray vector as the road/surface tracer and scalar local footprint math. Hosts may opt into per-ray lengths, predefined layouts such as `driver-front-heavy`, and surface-aware channels for kerb and illegal surface detection; those channels are computed only when requested. `precision: 'driver'` road-edge, kerb, and illegal-surface channels use validated direct indexed ray-band intersections for safe normal-driver main-track geometry and validated off-track recovery boundaries; the `batch-training` profile keeps the accelerated direct indexed contract for safe main-track rays, including surface-only batches that reuse shared surface-hit and track-band boundary scratch. Ambiguous recovery, pit-connector, and pit-lane-origin rays use bounded sampled validation inside the ray-band tracer, and `precision: 'debug'` uses that same tracer path with extra sampled refinement for diagnostics. Only missing-index cases use the older sampled fallback path. This preserves model-facing distances without substituting debug-only refinement. Barrier walls are rendered/physical terminal boundaries, not model-facing ray targets; active ray objects, vectors, schemas, and visualizations must not expose a `barrier` ray channel. Ray `precision` defaults to `driver`, which is the active model-facing sensor contract; `debug` precision is only for explicitly labeled diagnostics. `observation.profile: 'physical-driver'` exposes local driver-like yaw, contact-patch, boundary, richer ray, and opponent-radar senses while omitting default lookahead samples unless explicitly configured. `observation.output` can be `full`, `vector`, or `object`, `includeSchema: false` omits repeated schema payloads, and `vectorType: 'float32'` returns typed vector buffers for high-throughput JavaScript loops. `result.stateOutput` can be `full`, `minimal`, or `none`; `none` returns `state: null` and is intended for loops that rely on observations, metrics, and info instead of full snapshots.
|
|
329
350
|
- Scratch-backed expert ray batches dispatch those requested channels through reusable scalar flags on the shared ray query. This is an internal runtime contract only; public ray objects still expose the same road-edge, kerb, illegal-surface, and car channel objects.
|
|
330
351
|
- Track surface bands are single-source geometry. Rendering derives visible gravel, runoff, and barrier offsets from the same track widths used by wheel surfaces and ray surface hits: road edge, kerb outer edge, gravel outer edge, runoff outer edge, and barrier wall width. New code must not add independent magic offsets for these bands.
|
|
@@ -334,7 +355,7 @@ Returned controller:
|
|
|
334
355
|
- Browser expert mode disables automatic ticker-driven simulation advancement. The visual canvas updates only after explicit expert `reset()` or `step(actions)` calls.
|
|
335
356
|
- While external renderer mode is attached, browser expert runtime is strict render-only and rejects local `step()`, `resetDrivers()`, and `reset()`. Hosts must detach before returning to local stepping; detach restores the current local simulation track surface if external frames had redrawn the shared track asset.
|
|
336
357
|
- Policy Runner `Live preview stream` mode accepts `ws://`/`wss://` push streams and `http://`/`https://` polling endpoints that return `preview:snapshot` frames.
|
|
337
|
-
- Policy Runner `Policy server` mode uses compact HTTP protocol version `2`. Reset/init requests include static specs, configuration, `previousActionFields`, and `metricFields`; per-decision `/policy/decide-batch` requests include `driverIds` plus aligned compact `vectors`, `previousActions`, `metrics`, and `events` arrays only. There is no rich per-decision compatibility toggle in the
|
|
358
|
+
- Policy Runner `Policy server` mode uses compact HTTP protocol version `2`. Reset/init requests include static specs, configuration, `previousActionFields`, and `metricFields`; per-decision `/policy/decide-batch` requests include `driverIds` plus aligned compact `vectors`, `previousActions`, `metrics`, and `events` arrays only. There is no rich per-decision compatibility toggle in the website Policy Runner controller; server integrations must read vector inputs by matching `driverIds[index]` to `vectors[index]` and cache the tuple field order received on reset. Full public snapshots remain available through explicit host/debug/export/state APIs, not as the policy-server transport default.
|
|
338
359
|
- Browser expert mode may opt into `expert.visualizeSensors: true` or `expert.visualizeSensors: { rays: true }`. When enabled, ray sensors render in the race canvas world layer from the selected controlled car by default, using the same observation result produced by explicit expert steps. The overlay draws a separate colored marker for each detected active channel on each ray, including road-edge, kerb, illegal surface, and car hits. Barrier walls are visible track geometry, not ray-hit markers, and browser components must not reintroduce a barrier ray label. Hosts may request `visualizeSensors: { rays: true, drivers: 'all' }` for the heavier all-controlled-car overlay or pass an explicit driver id list. Every model-facing sense follows this rule: the model receives the active environment observation, and Policy Runner/expert visualization displays that same observation instead of recomputing a more precise or different browser-only value. Extra diagnostics must be clearly separated from model senses.
|
|
339
360
|
|
|
340
361
|
## Current Visible Features
|
|
@@ -367,7 +388,7 @@ Full public race snapshots include `car.trackState` as the serialized car-center
|
|
|
367
388
|
- `pixi.js` available through the package dependency graph.
|
|
368
389
|
|
|
369
390
|
Raw Node imports of the package root are not a supported runtime check because the browser component entry imports CSS and image assets. The `@inventure71/paddockjs/environment` subpath is the supported browser-free import path for headless JavaScript training.
|
|
370
|
-
The
|
|
391
|
+
The package exposes a JSON-serializable worker protocol wrapper so external processes can bridge to the JavaScript environment without PaddockJS choosing Python, Gymnasium, PettingZoo, model storage, training algorithms, checkpoint formats, or training infrastructure.
|
|
371
392
|
|
|
372
393
|
## Verification
|
|
373
394
|
|
|
@@ -382,9 +403,12 @@ Expected:
|
|
|
382
403
|
- Fast Vitest tests pass in the normal local gate. Slow characterization tests run under `npm run check:release`.
|
|
383
404
|
- `npm pack --dry-run` succeeds and includes source files plus bundled assets.
|
|
384
405
|
- A packed tarball installs and builds inside a fresh temporary Vite consumer app.
|
|
406
|
+
- Packed subpath bundle-boundary checks verify that the root import remains the CSS/asset-owning browser simulator bundle while `/placeholder`, `/data`, and `/environment` stay CSS-free or lightweight according to their documented roles.
|
|
385
407
|
- The tracked showcase host builds.
|
|
386
408
|
- The quick Chromium browser smoke verifies showcase canvas rendering, overflow constraints, one public API action, and live customization theme switching. The release browser smoke verifies the desktop/mobile matrix, package-panel overflow constraints, customization route interactions, public API buttons, and visual policy-runner stepping across generation and race configurations.
|
|
387
409
|
|
|
410
|
+
Use [Testing Reliability Guide](testing-reliability-guide.md) to choose the smallest behavior-focused proof for a change before relying on the broad package gate. The guide is authoritative for mapping package/API, simulation, environment, browser, performance, and docs changes to focused tests and required broader verification.
|
|
411
|
+
|
|
388
412
|
For internal runtime-efficiency development only, also run:
|
|
389
413
|
|
|
390
414
|
```bash
|
|
@@ -409,3 +433,7 @@ Expected:
|
|
|
409
433
|
|
|
410
434
|
- The host bundle builds with PaddockJS resolved from npm.
|
|
411
435
|
- Browser smoke shows shell, canvas, driver rows, FPS readout, and working `Open project` navigation.
|
|
436
|
+
|
|
437
|
+
## Demo Physics Selection
|
|
438
|
+
|
|
439
|
+
The product demo's automatic races, composable examples, layout presets and headless API example use the package-default `arcade` mode. Advanced physics is explicit in the separate, lazily launched keyboard/sensor lab at `#expert`, visibly labeled Advanced physics. The advanced lab uses the rebuilt planar tire-force model with human keyboard smoothing; it remains an experimental handling approximation. Only a focused, visible race captures driving keys, and blur/hidden/disposal clears held inputs and the keyboard's pending pit request. Package defaults and public mode selection are unchanged.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Testing Reliability Guide
|
|
2
|
+
|
|
3
|
+
PaddockJS reliability work is risk-driven. Do not add tests for coverage vanity. Add or change tests when they protect a package contract, a simulator state transition, a browser lifecycle path, or a performance invariant that can silently regress.
|
|
4
|
+
|
|
5
|
+
## Confidence Model
|
|
6
|
+
|
|
7
|
+
Use the smallest verification layer that proves the behavior, then run the broader gate before claiming package quality.
|
|
8
|
+
|
|
9
|
+
- Unit tests in `src/__tests__/` prove deterministic simulation, data normalization, sensor math, controller loops, and focused UI rendering helpers.
|
|
10
|
+
- Vitest resolves demo package imports to this checkout's public entrypoints. Root tests therefore need only `npm ci` in the package, even before either browser consumer is installed. Packed-consumer checks remain the proof of install/export resolution; test aliases do not replace them.
|
|
11
|
+
- Public type tests in `src/__tests__/publicApi.types.ts` prove the TypeScript consumer contract for root, `/data`, `/environment`, and `/placeholder` imports.
|
|
12
|
+
- `npm run consumer:smoke` proves the packed tarball installs and builds in a fresh Vite consumer through public package imports.
|
|
13
|
+
- `npm run consumer:bundle-boundaries` proves the packed root browser import remains the CSS/asset-owning simulator bundle while `/placeholder`, `/data`, and `/environment` stay CSS-free or lightweight according to their documented roles.
|
|
14
|
+
- `npm run showcase:ci` proves the tracked browser showcase still builds.
|
|
15
|
+
- `npm run browser:smoke:quick -- --skip-build` proves the built showcase can mount, paint a nonblank canvas, avoid key overflow regressions, exercise public controls, and keep live customization paths working.
|
|
16
|
+
- `npm run browser:smoke:full -- --skip-build` is required for broad browser/showcase/layout behavior and release handoff.
|
|
17
|
+
- `npm run benchmark:runtime -- --profile=standard --verify --json` proves simulation, sensor, rendering-data, snapshot, DOM-readout, and compact-transport performance contracts.
|
|
18
|
+
|
|
19
|
+
## Change Matrix
|
|
20
|
+
|
|
21
|
+
| Change area | Required focused proof | Required broader proof |
|
|
22
|
+
| --- | --- | --- |
|
|
23
|
+
| Public root, `/data`, `/environment`, or `/placeholder` API/types | `npm run types:check` plus a public API type assertion when the contract changes | `npm run check` |
|
|
24
|
+
| Package install, exports, files, CSS/assets, subpath bundle boundaries, or build assumptions | `npm run pack:dry`, `npm run consumer:smoke`, or `npm run consumer:bundle-boundaries` | `npm run check` |
|
|
25
|
+
| Race rules, ordering, DRS, starts, safety car, red flag, pits, penalties, collisions, or finish/classification | Focused Vitest file for the changed rule path | `npm run check`; use `npm run check:release` for broad behavior |
|
|
26
|
+
| Track geometry, query index, wheel surfaces, runoff, contact patches, or sensor rays | Focused geometry/sensor tests plus benchmark verification when hot paths change | `npm run check`; benchmark command required for performance-sensitive edits |
|
|
27
|
+
| Headless environment, controller loop, worker protocol, Policy Runner, observation/vector/schema contract | Focused environment/controller/transport tests and active observation contract assertions | `npm run check`; benchmark if compact/vector/snapshot cost changes |
|
|
28
|
+
| Browser runtime, Pixi lifecycle, layout support, readouts, controls, theme, loading, or smoke pages | Focused DOM/render helper tests where possible | `npm run check`; full browser smoke for broad layout/showcase changes |
|
|
29
|
+
| Docs-only consumer guidance | `npm run docs:check` | `npm run check` when docs describe package behavior changed in code |
|
|
30
|
+
|
|
31
|
+
## Test Quality Rules
|
|
32
|
+
|
|
33
|
+
- Test behavior through the production path whenever practical. Avoid tests that recreate private helper logic and only prove the helper still matches itself.
|
|
34
|
+
- Include negative, stale-state, restart/remount, and partial-update cases for lifecycle code.
|
|
35
|
+
- For deterministic simulation changes, fix the seed, track seed, drivers, entries, rules, and scenario inputs in the test.
|
|
36
|
+
- For model-facing senses, assert the active observation/vector/schema contract. Debug overlays may have extra data, but no model-sense panel should display a recomputed or more precise value as model input.
|
|
37
|
+
- For performance-sensitive paths, assert counters that explain the cost, such as fallback counts, allocation counters, or compact payload sizes. Do not rely only on elapsed time.
|
|
38
|
+
- For package boundary work, prove public imports from the packed package, not internal relative paths.
|
|
39
|
+
- For browser layout work, prove rendered behavior with browser smoke or a focused DOM/canvas check. Static markup snapshots are not enough when resize observers, canvas painting, or runtime CSS state are involved.
|
|
40
|
+
|
|
41
|
+
## High-Risk Behaviors To Map In Audits
|
|
42
|
+
|
|
43
|
+
- `mountF1Simulator()` and `createPaddockSimulator()` lifecycle: initial shell, loading overlays, start, restart, theme sync, destroy, and repeated mount behavior.
|
|
44
|
+
- Public subpath boundaries: root imports browser/CSS runtime, `/environment` stays browser-free and CSS-free, `/data` stays CSS-free, `/placeholder` stays tiny and inert.
|
|
45
|
+
- Determinism: same seed, track seed, drivers, entries, rules, and scenario produce stable simulation behavior.
|
|
46
|
+
- Track query index propagation: built runtime tracks keep the internal non-enumerable index, while public JSON snapshots do not leak engine helpers.
|
|
47
|
+
- Race state transitions: start sequence, safety car, red flag, pit-lane open/closed, pit stops, penalties, DNF, finish, and final classification.
|
|
48
|
+
- Model-facing observations: object/vector/schema alignment, per-driver overrides, compact/vector-only outputs, reset-only observations, and external renderer frames.
|
|
49
|
+
- Rendering and layout: nonblank canvas, timing tower constraints, unsupported-size placeholders, lower-third/timing clearance, theme variables, and composable roots.
|
|
50
|
+
- Package consumption: dry pack contents, fresh consumer install/build, browser showcase build, and documented host update path.
|
|
51
|
+
|
|
52
|
+
## Reporting Standard
|
|
53
|
+
|
|
54
|
+
For claims about browser smoothness or retained memory, identify the actual GPU renderer, device/canvas pixel density, viewport, physics mode, speed and visibility. Collect sustained draw-interval distributions and update-work timing in a hardware-accelerated browser; smoke screenshots and average FPS alone cannot prove smooth motion. Record long gaps separately from normal jitter. For retention checks, compare post-GC heap, DOM-node and event-listener counts over repeated restart/selection/disclosure or remount cycles, distinguishing bounded warmup/cache growth from persistent growth. Keep instrumentation bounded and restore hooks after sampling. Software-rendered preview results are environment evidence, not hardware-performance acceptance.
|
|
55
|
+
|
|
56
|
+
Compare efficiency changes to the preserved starting source with identical seeded workloads and operation counts. Alternate fresh baseline/candidate processes when timing drift is visible. Exact outputs and cost counters justify semantic and work-reduction claims; report wall-time ranges and machine noise rather than extending one workload's speedup to the whole package.
|
|
57
|
+
|
|
58
|
+
Every reliability audit should report:
|
|
59
|
+
|
|
60
|
+
- current confidence: what is proven and what remains unproven;
|
|
61
|
+
- findings ranked by user impact and regression likelihood;
|
|
62
|
+
- exact files and behavior paths affected;
|
|
63
|
+
- smallest test or verification change that would close each gap;
|
|
64
|
+
- commands run, with the gate level they prove;
|
|
65
|
+
- any rejected critique, with the technical reason it is not accepted.
|
|
66
|
+
|
|
67
|
+
If a required command is blocked by the environment, report the command, failure text, retry state, and the exact proof still missing. Do not replace a broad required gate with a narrow check.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# v11 improvement evidence — 2026-10-13
|
|
2
|
+
|
|
3
|
+
This pass improves built-in racecraft, removes redundant high-refresh rendering and preview allocations, and fixes browser startup/callback cleanup. Implementation is isolated on `v11-improvements` in a separate worktree based on `5bd587528a1b95cd78dd77768129e71a2b09a0e6`. The original v11 checkout and ref are preserved. No commit, push, release or publication was performed.
|
|
4
|
+
|
|
5
|
+
## Subsequent efficiency and maintainability pass
|
|
6
|
+
|
|
7
|
+
The follow-up requested after motion testing is recorded separately in [the measured efficiency audit](efficiency_cleanup_2026-10-13.md). It covers decision-local capacity reuse, render/sensor allocation reduction, observer and timing DOM convergence, ownership cleanup, native GPU frame-time/memory probes and current package gates. Earlier verification tables below remain historical evidence for the first pass.
|
|
8
|
+
|
|
9
|
+
## Racecraft results
|
|
10
|
+
|
|
11
|
+
The same six production demo fields were run in both physics modes, with ten cars, their normal tires/pit rules, fixed seeds, fixed `1/60` steps and a 1,200-second ceiling. Baseline and final cases each ran twice. Every case finished with all ten cars, zero DNFs, and exact repeated trajectory/event/result hashes. Measurements are simulation seconds, not wall-clock speed.
|
|
12
|
+
|
|
13
|
+
| Mode / field | Contacts before → after | Off-road car-seconds before → after | Full-field finish seconds before → after |
|
|
14
|
+
| --- | ---: | ---: | ---: |
|
|
15
|
+
| Arcade / hero | 50 → 6 | 0 → 0.050 | 724.667 → 716.783 |
|
|
16
|
+
| Arcade / components | 65 → 8 | 2.467 → 2.350 | 501.733 → 500.450 |
|
|
17
|
+
| Arcade / dashboard | 43 → 7 | 0 → 0.450 | 445.800 → 448.350 |
|
|
18
|
+
| Arcade / timing-overlay | 52 → 5 | 0 → 0 | 497.467 → 493.617 |
|
|
19
|
+
| Arcade / compact-race | 57 → 7 | 0.167 → 0.333 | 407.633 → 407.850 |
|
|
20
|
+
| Arcade / full-dashboard | 38 → 6 | 1.067 → 1.017 | 329.283 → 313.917 |
|
|
21
|
+
| Advanced / hero | 12 → 2 | 0 → 0 | 887.817 → 879.133 |
|
|
22
|
+
| Advanced / components | 3 → 0 | 0.300 → 0.050 | 597.350 → 596.767 |
|
|
23
|
+
| Advanced / dashboard | 1 → 0 | 0.467 → 0 | 528.933 → 524.133 |
|
|
24
|
+
| Advanced / timing-overlay | 3 → 0 | 0.767 → 0 | 604.583 → 601.017 |
|
|
25
|
+
| Advanced / compact-race | 3 → 1 | 0.433 → 0 | 486.567 → 483.500 |
|
|
26
|
+
| Advanced / full-dashboard | 6 → 4 | 0 → 0 | 356.183 → 354.667 |
|
|
27
|
+
|
|
28
|
+
Arcade contacts fall from **305 to 39 (87.2%)**; advanced contacts fall from **28 to 7 (75%)**. Advanced off-road time falls from 1.967 to 0.050 car-seconds. Arcade retains a small tradeoff: aggregate off-road time rises from 3.700 to 4.200 car-seconds, and two fields finish slightly later. Its aggregate full-field finish time falls by 25.617 seconds; advanced falls by 22.217 seconds. These are fixed demo fixtures, not a guarantee for every track, rating sheet or traffic arrangement.
|
|
29
|
+
|
|
30
|
+
Off-road time uses the harness's wheel-derived `trackState.onTrack === false` during active running intervals, outside pit-controlled routing and pit-lane travel. Contact counts are physical contact events consumed once per step, rather than penalty consequences counted again. Lap times use canonical timing-line crossings. The harness prints track lengths, source/options hashes, per-car laps, incidents, tire state and pit completion facts.
|
|
31
|
+
|
|
32
|
+
Simulation/data source SHA-256:
|
|
33
|
+
|
|
34
|
+
- Baseline: `a70d95444f064aa70ecea1d407347dffc97403f2ae00f309590f94f92a7c0800`.
|
|
35
|
+
- Final: `2e4c4d81b0ecc12505110f2bd7ed882229c1fa8b1dbb6cf64ab582d63d25a01a`.
|
|
36
|
+
|
|
37
|
+
The final narrow-road comfort-margin correction was also checked against the prior wide-road candidate: all 12 field result hashes remained identical. A separate 405-combination check preserved ordinary-road offset calculations while fixing a six-meter road's negative comfort limit.
|
|
38
|
+
|
|
39
|
+
## What changed and why
|
|
40
|
+
|
|
41
|
+
- Physical traffic gaps wrap around the circuit. Lapped cars and start-line neighbors can no longer disappear because their classification distances differ by a lap.
|
|
42
|
+
- Traffic uses chassis centers in the main-track frame. Outer-wheel surface offsets and pit-local offsets cannot exaggerate passing clearance. Separate pit traffic is excluded from tactical targets; merging traffic remains relevant.
|
|
43
|
+
- Both modes follow stopped/slow blockers until there is real lateral clearance. Arcade's minimum maneuvering speed no longer overrides the blocker limit.
|
|
44
|
+
- Passing intent no longer fights reactive defense. Drivers avoid defending against a physically rearward lapping car.
|
|
45
|
+
- Arcade holds its line through loaded turns with traffic, retaining inward edge recovery priority. Advanced constrains its final target beside overlapping cars and permits inward correction near the edge.
|
|
46
|
+
|
|
47
|
+
An initial center-space tactical candidate substantially increased off-road time and was rejected. Swept lane constraints at intermediate intention/scoring boundaries also caused arcade regressions and were rejected. Final constraints are applied to the advanced controller's actual composed target; arcade retains its independently verified corner-hold policy. Physics forces, grip, pose integration and model observations were not changed.
|
|
48
|
+
|
|
49
|
+
## Resource and lifecycle improvements
|
|
50
|
+
|
|
51
|
+
The actual private Pixi ticker is capped at 60 FPS and stays stopped during loading. Real Pixi ticker tests drive synthetic 30/60/120/144 Hz refreshes and check both draw counts and elapsed fixed-step simulation. High-refresh tests produce approximately 60 draws per second instead of 120/144 draws of a scene updated at 60 Hz. This proves reduced draw work; it is not a claim of a measured device-wide CPU/GPU percentage.
|
|
52
|
+
|
|
53
|
+
### Follow-up: reported car/camera stutter
|
|
54
|
+
|
|
55
|
+
Interactive review exposed a clock defect missed by the original average-FPS checks: simulation advancement rounded elapsed time to whole 16.667 ms frames, leaving almost no interpolation remainder. A second frame gate could also skip pose updates while Pixi still drew the scene. Real-ticker regressions reproduced uneven movement at 30/60/90/120/144 Hz with scheduling jitter. The runtime now updates on every capped draw, accumulates measured wall time with the existing four-frame catch-up ceiling, and renders the fractional fixed-step remainder. Camera target, scale and rotation damping use that elapsed interval. Destroyed/out-of-race cars render at their frozen current pose so their last moving endpoints cannot oscillate with render phase. Physics and AI policies remain unchanged by this follow-up.
|
|
56
|
+
|
|
57
|
+
The new coverage checks each rendered position against elapsed time at 1x and 10x playback, bounds long-stall recovery, checks camera wall-time response, and exercises frozen-car rendering through a real race simulation. The collaborative preview additionally ran through SwiftShader software rendering: 45 sampled animation intervals averaged 106.3 ms (about 9.4 FPS), and its GPU process exceeded eight CPU cores of load. That environment limits visual-performance acceptance; the demo was also opened in the normal desktop browser. The timing fix does not claim to make software rendering reach 60 FPS.
|
|
58
|
+
|
|
59
|
+
Follow-up verification: `npm run check` passed 1,164 fast tests plus its packaging, type, showcase and quick browser/demo checks; the subsequently added frozen-car cases passed in targeted coverage. The final `npm run check:release` passed all **1,259 tests**, four dependency audits, type checking, packed-consumer checks, both showcase builds, and the full browser and demo smoke gates. A live Pixi probe saw 30 draw callbacks, 30 pose updates and zero interpolation error; Overview and Selected camera interactions also passed. Evidence is in `/tmp/paddock-v11-stutter-check.log`, `/tmp/paddock-v11-stutter-release.log`, and `/tmp/paddock-v11-stutter-live-motion.json`.
|
|
60
|
+
|
|
61
|
+
Advanced preview geometry reuses one point across sampled braking decisions; target geometry uses separate reusable scratch. A production sampling test asserts stable buffer identity and repeat speed results. Isolated pre/post scratch substitutions preserved every-step controls and trajectories for 45-second three-car advanced runs on track seeds 12, 7110 and 7203. This equivalence concerns the allocation substitution, not the later tactical changes. Following decisions reuse the lane scan rather than scanning the field a second time.
|
|
62
|
+
|
|
63
|
+
The standard runtime benchmark passes all 23 cases, covering simulation phases, indexed track/pit queries, collisions, sensors, compact environment output, snapshots/JSON, policy transport, interpolation and DOM readouts. Desktop background activity made wall-clock comparisons unsuitable for a reliable speedup claim; acceptance uses the benchmark's cost/identity counters and focused draw/allocation invariants.
|
|
64
|
+
|
|
65
|
+
Pending Pixi initialization now has explicit resource ownership. Destroy waits to release eventual resources after init settles, while a cancelled start cannot append a canvas, restore textures or emit ready. Partial resize/ticker plugin failures release their listeners/tickers as well as the stage/renderer. Independent disposer errors are reported without abandoning the rest of cleanup or masking the original initialization error.
|
|
66
|
+
|
|
67
|
+
Normal/expert frames and readout updates stop when host callbacks destroy or replace the race. Callback dispatch itself captures the simulation and reset generation, preventing remaining obsolete events or finish/lap bookkeeping from corrupting a successor race.
|
|
68
|
+
|
|
69
|
+
Independent sprite and track texture loads start concurrently. Fresh root tests resolve repository-demo imports to the current public source entrypoints; fresh packed consumers separately prove package resolution. The option-normalization test now fixes seed/track seed instead of making random track generation part of its timing/reproducibility.
|
|
70
|
+
|
|
71
|
+
## Tooling and package boundary
|
|
72
|
+
|
|
73
|
+
Clean installs exposed missing optional peer entries in both browser consumer lockfiles; those are repaired. All three consumer/root locks use the patched `source-map-js@1.2.2`.
|
|
74
|
+
|
|
75
|
+
Changesets v2's release-only dependency chain contained an [unpatched braces advisory](https://github.com/advisories/GHSA-vfj7-8cjw-p6xm). Release tooling is now a pinned, private, nonworkspace Changesets 3.0.3 package. The simulator retains Node `>=20.19.0`; tooling uses its supported newer Node versions, with Node 24 in the release workflow. The root launcher preserves arguments, exit status and repository-root working directory. The release audit checks all four graphs with no exclusions. Local auditing found zero vulnerabilities in each graph.
|
|
76
|
+
|
|
77
|
+
The workflow uses Changesets action v2 with explicit version/publish scripts. `npm publish --provenance` is preserved. Read-only CLI status identifies only PaddockJS's pending minor release, excludes private tooling, and leaves package/lock/changelog/Changesets inputs unchanged. Default changelog resolution was verified from the isolated tool installation.
|
|
78
|
+
|
|
79
|
+
Two preexisting publishing follow-ups remain outside local verification: plain npm publishing supplies no structured Changesets publication events for automatic published-package/tag/release reporting, and the version script does not regenerate release lock metadata automatically. Synchronizing version/lock/changelog inputs and authorizing/testing real release execution remain release-handoff requirements. No versioning or publishing command was run against the live checkout.
|
|
80
|
+
|
|
81
|
+
## Verification
|
|
82
|
+
|
|
83
|
+
| Gate | Result | Scope |
|
|
84
|
+
| --- | --- | --- |
|
|
85
|
+
| `npm run check` — Node 24.15.0 / npm 11.6.2 | Passed | 67 fast test files; 1,150 passed / 93 intentionally deferred slow tests; types, dry pack, fresh packed consumers, bundle boundaries, both builds, quick showcase smoke and complete demo smoke |
|
|
86
|
+
| `npm run check:release` — Node 24.15.0 / npm 11.6.2 | Passed | All 67 exhaustive test batches / 1,243 tests; four dependency audits; types/pack/consumers/builds; full showcase matrix and complete demo smoke |
|
|
87
|
+
| Minimum Node 20.19.0 / npm 11.6.2 | Passed | Docs, all fast tests (1,150 passed / 93 slow skips), public types and dry pack |
|
|
88
|
+
| Standard runtime benchmark `--verify` | Passed | All 23 benchmark cases on baseline and final source |
|
|
89
|
+
| Exact-source production field matrix | Passed | 24 final executions plus 24 baseline executions; all cars finish, no DNFs, exact within-case repeat hashes |
|
|
90
|
+
| Independent runtime integration review | Passed after fixes | Partial plugin cleanup and stale callback delivery reproduced before fixes and independently rechecked after them |
|
|
91
|
+
|
|
92
|
+
The first broad run hit the option-normalization test's five-second timeout during unseeded track generation under desktop load. Fixing that test's seed/track seed made its inputs deterministic; the focused test and both supported-Node gates passed without increasing its timeout or disabling warmup. Changes after the broad gates were evidence/documentation updates only; final documentation checks and diff whitespace checks passed.
|
|
93
|
+
|
|
94
|
+
Relevant reproducible commands from this checkout:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
npm run check
|
|
98
|
+
npm run check:release
|
|
99
|
+
node scripts/benchmark-runtime-efficiency.mjs --profile=standard --verify --json
|
|
100
|
+
node scripts/benchmark-advanced-ai-fields.mjs --physics-mode arcade --repeats 2
|
|
101
|
+
node scripts/benchmark-advanced-ai-fields.mjs --physics-mode advanced --repeats 2
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Pass the untouched baseline checkout as the field harness's optional first source-root argument to reproduce baseline comparisons. Use a supported release-tool Node version for `check:release`; ordinary package tests remain compatible with Node 20.19.
|
|
105
|
+
|
|
106
|
+
Direct built-browser verification additionally exercised overview/selection, timing gap switching, telemetry open/close, safety-car deploy/clear, and 390-pixel timing reveal/resizing without horizontal overflow. A real Pixi startup was destroyed before completion, released its stage/renderer, left no canvas, delivered no ready/error callback, then retried successfully with one canvas and a 60 FPS ticker. Automated smoke also verifies painted canvases and the broader public controls, expert/headless and preset paths.
|
|
107
|
+
|
|
108
|
+
Subsequent skill-dependent physical-envelope tuning, timing-line boundary repair and measured limitations are documented in [limit driving, 2026-10-14](limit_driving_2026-10-14.md). Earlier results above describe their recorded candidate.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inventure71/paddockjs",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A data-driven browser F1 simulator component for host websites.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -68,8 +68,6 @@
|
|
|
68
68
|
"examples/python/README.md",
|
|
69
69
|
"examples/python/base_policy_server.py",
|
|
70
70
|
"examples/python/requirements.txt",
|
|
71
|
-
"examples/train-basic-policy.mjs",
|
|
72
|
-
"examples/trainingData.mjs",
|
|
73
71
|
"src/api",
|
|
74
72
|
"src/app",
|
|
75
73
|
"src/config",
|
|
@@ -90,30 +88,40 @@
|
|
|
90
88
|
"test:fast": "node scripts/run-vitest.mjs",
|
|
91
89
|
"types:check": "tsc -p tsconfig.types.json --noEmit",
|
|
92
90
|
"docs:check": "node scripts/docs-check.mjs",
|
|
93
|
-
"check": "npm run docs:check && npm run test:fast && npm run types:check && npm run pack:dry && npm run consumer:smoke && npm run
|
|
94
|
-
"check:release": "npm run docs:check && npm test && npm run types:check && npm run pack:dry && npm run consumer:smoke && npm run
|
|
91
|
+
"check": "npm run docs:check && npm run test:fast && npm run types:check && npm run pack:dry && npm run consumer:smoke && npm run consumer:bundle-boundaries && npm run site:ci && npm run browser:smoke:quick -- --skip-build && npm run demo:smoke -- --skip-build",
|
|
92
|
+
"check:release": "npm run docs:check && npm run audit:release && npm test && npm run types:check && npm run pack:dry && npm run consumer:smoke && npm run consumer:bundle-boundaries && npm run site:ci && npm run browser:smoke:full -- --skip-build && npm run demo:smoke -- --skip-build",
|
|
93
|
+
"audit:release": "npm run tools:release:ci && npm audit --audit-level=high && npm --prefix site audit --audit-level=high && npm --prefix tools/release audit --audit-level=high",
|
|
94
|
+
"tools:release:ci": "npm --prefix tools/release ci",
|
|
95
95
|
"pack:dry": "npm pack --dry-run",
|
|
96
96
|
"consumer:smoke": "node scripts/consumer-package-smoke.mjs",
|
|
97
|
+
"consumer:bundle-boundaries": "node scripts/consumer-bundle-boundaries.mjs",
|
|
97
98
|
"browser:smoke": "node smoke/browser-smoke.mjs",
|
|
98
99
|
"browser:smoke:quick": "node smoke/browser-smoke.mjs --quick",
|
|
99
100
|
"browser:smoke:full": "node smoke/browser-smoke.mjs --full",
|
|
100
101
|
"benchmark:runtime": "node scripts/benchmark-runtime-efficiency.mjs",
|
|
101
|
-
"showcase:install": "npm
|
|
102
|
-
"showcase:dev": "npm
|
|
103
|
-
"showcase:build": "npm
|
|
104
|
-
"showcase:ci": "npm
|
|
105
|
-
"
|
|
106
|
-
"
|
|
102
|
+
"showcase:install": "npm run site:install",
|
|
103
|
+
"showcase:dev": "npm run site:dev",
|
|
104
|
+
"showcase:build": "npm run site:build",
|
|
105
|
+
"showcase:ci": "npm run site:ci",
|
|
106
|
+
"demo:install": "npm run site:install",
|
|
107
|
+
"demo:dev": "npm run site:dev",
|
|
108
|
+
"demo:build": "npm run site:build",
|
|
109
|
+
"demo:ci": "npm run site:ci",
|
|
110
|
+
"demo:smoke": "node smoke/demo-smoke.mjs",
|
|
111
|
+
"changeset": "node scripts/run-changeset.mjs",
|
|
112
|
+
"version-packages": "node scripts/run-changeset.mjs version",
|
|
107
113
|
"release": "npm publish --provenance",
|
|
108
|
-
"
|
|
114
|
+
"site:install": "npm --prefix site ci",
|
|
115
|
+
"site:dev": "npm --prefix site run dev",
|
|
116
|
+
"site:build": "npm --prefix site run check",
|
|
117
|
+
"site:ci": "npm --prefix site ci && npm --prefix site run check"
|
|
109
118
|
},
|
|
110
119
|
"dependencies": {
|
|
111
|
-
"pixi.js": "8.
|
|
120
|
+
"pixi.js": "8.20.1"
|
|
112
121
|
},
|
|
113
122
|
"devDependencies": {
|
|
114
|
-
"@changesets/cli": "2.29.7",
|
|
115
123
|
"playwright": "^1.57.0",
|
|
116
124
|
"typescript": "5.9.3",
|
|
117
|
-
"vitest": "4.1.
|
|
125
|
+
"vitest": "4.1.12"
|
|
118
126
|
}
|
|
119
127
|
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { installLayoutSupport } from '../app/layoutSupport.js';
|
|
2
|
+
import { applyPaddockThemeCssVariables } from '../config/defaultOptions.js';
|
|
3
|
+
import { formatCssUrl } from '../config/cssValues.js';
|
|
4
|
+
|
|
5
|
+
function assertMountTarget(root, label) {
|
|
6
|
+
if (!root || typeof root !== 'object' || !('innerHTML' in root)) {
|
|
7
|
+
throw new Error(`${label} requires a DOM element root.`);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function setPackageCssVariables(root, assets, theme, context = {}) {
|
|
12
|
+
root.classList?.add?.('f1-sim-component');
|
|
13
|
+
root.style?.setProperty?.('--broadcast-panel-surface', formatCssUrl(assets.broadcastPanel));
|
|
14
|
+
applyPaddockThemeCssVariables(root, theme, context);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function createCompositeRoot(getRoots, getOptions) {
|
|
18
|
+
return {
|
|
19
|
+
style: {
|
|
20
|
+
setProperty(name, value) {
|
|
21
|
+
getRoots().forEach((root) => root.style?.setProperty?.(name, value));
|
|
22
|
+
},
|
|
23
|
+
removeProperty(name) {
|
|
24
|
+
getRoots().forEach((root) => root.style?.removeProperty?.(name));
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
querySelector(selector) {
|
|
28
|
+
for (const root of getRoots()) {
|
|
29
|
+
const match = root.querySelector?.(selector);
|
|
30
|
+
if (match) return match;
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
},
|
|
34
|
+
querySelectorAll(selector) {
|
|
35
|
+
return getRoots().flatMap((root) => [...(root.querySelectorAll?.(selector) ?? [])]);
|
|
36
|
+
},
|
|
37
|
+
setAttribute(name, value) {
|
|
38
|
+
getRoots().forEach((root) => root.setAttribute?.(name, value));
|
|
39
|
+
},
|
|
40
|
+
removeAttribute(name) {
|
|
41
|
+
getRoots().forEach((root) => root.removeAttribute?.(name));
|
|
42
|
+
},
|
|
43
|
+
applyCssVariables(context = {}) {
|
|
44
|
+
const options = getOptions();
|
|
45
|
+
getRoots().forEach((root) => setPackageCssVariables(root, options.assets, options.theme, context));
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Owns mounted DOM surfaces, layout-support lifetimes and their composite query
|
|
51
|
+
// root. The simulator controller supplies runtime availability and options.
|
|
52
|
+
export class MountedSimulatorComponents {
|
|
53
|
+
constructor({ getOptions, canMount }) {
|
|
54
|
+
this.getOptions = getOptions;
|
|
55
|
+
this.canMount = canMount;
|
|
56
|
+
this.roots = new Map();
|
|
57
|
+
this.mountRenderers = new Map();
|
|
58
|
+
this.layoutSupportCleanups = new Map();
|
|
59
|
+
this.compositeRoot = createCompositeRoot(() => [...this.roots.values()], getOptions);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
mount(root, key, createMarkup) {
|
|
63
|
+
assertMountTarget(root, `mount ${key}`);
|
|
64
|
+
if (!this.canMount()) {
|
|
65
|
+
throw new Error('Mount PaddockJS components before calling start().');
|
|
66
|
+
}
|
|
67
|
+
const occupiedEntry = [...this.roots.entries()]
|
|
68
|
+
.find(([mountedKey, mountedRoot]) => mountedKey !== key && mountedRoot === root);
|
|
69
|
+
if (occupiedEntry) {
|
|
70
|
+
throw new Error(`Mount ${key} requires its own root; this root already hosts ${occupiedEntry[0]}.`);
|
|
71
|
+
}
|
|
72
|
+
const render = typeof createMarkup === 'function' ? createMarkup : () => createMarkup;
|
|
73
|
+
const previousRoot = this.roots.get(key);
|
|
74
|
+
this.layoutSupportCleanups.get(key)?.();
|
|
75
|
+
if (previousRoot && previousRoot !== root) previousRoot.innerHTML = '';
|
|
76
|
+
root.innerHTML = render();
|
|
77
|
+
setPackageCssVariables(root, this.getOptions().assets, this.getOptions().theme);
|
|
78
|
+
this.layoutSupportCleanups.set(key, installLayoutSupport(root));
|
|
79
|
+
this.roots.set(key, root);
|
|
80
|
+
this.mountRenderers.set(key, render);
|
|
81
|
+
return root;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
rerender() {
|
|
85
|
+
this.roots.forEach((root, key) => {
|
|
86
|
+
const render = this.mountRenderers.get(key);
|
|
87
|
+
if (render) root.innerHTML = render();
|
|
88
|
+
setPackageCssVariables(root, this.getOptions().assets, this.getOptions().theme);
|
|
89
|
+
this.layoutSupportCleanups.get(key)?.();
|
|
90
|
+
this.layoutSupportCleanups.set(key, installLayoutSupport(root));
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
destroy() {
|
|
95
|
+
this.layoutSupportCleanups.forEach((cleanup) => cleanup());
|
|
96
|
+
this.layoutSupportCleanups.clear();
|
|
97
|
+
this.roots.forEach((root) => { root.innerHTML = ''; });
|
|
98
|
+
this.roots.clear();
|
|
99
|
+
this.mountRenderers.clear();
|
|
100
|
+
}
|
|
101
|
+
}
|