@adatechnology/game-vehicles-proving 0.1.13 → 0.2.1

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/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # @adatechnology/game-vehicles-proving
2
+
3
+ Vehicle proving ground without three.js: measured tests run on the semi-simulation driver, ranges by class and design card, visual checks signed off by a person, a certificate per vehicle.
4
+
5
+ ## Clock (spec 010, rule 15 "um acumulador só")
6
+
7
+ A `ProvingRun` owns no accumulator. The physics step is `fixedStep` (default 1/120 s) and one scheduler tick (1/60 s) is `STEPS_PER_TICK` = 2 steps.
8
+
9
+ - **Hosted by a scheduler** (the room): register `run.stepFixed(STEPS_PER_TICK)` in `fixedSimulate` (`host.onFrame(fn, { phase: 'fixedSimulate' })`). The tick, the cap of ticks per frame and the room's `timeScale` (slow motion) are the scheduler's. The run does not interpolate: the drawn pose is the last tick's.
10
+ - **Standalone** (tests, CLI): call `run.stepFixed(steps)` yourself, or `run.advance(seconds)`, which feeds a private `game-runtime` scheduler (exact, no render); a remainder shorter than a tick waits for the next call. `runTest` steps to the end with `stepFixed`.
11
+ - **`time_scale`** (the proving area's control, 1 to 20) is not a clock: it is the number of ticks' worth of steps run in each tick (`stepFixed(STEPS_PER_TICK * timeScale)`), a fast-forward of the test alone. The scheduler's `timeScale` stays the room's slow motion, and the scheduler's cap of ticks per frame would cut a 20x run, so the fast-forward cannot live there.
12
+
13
+ Trajectories at 60 Hz are the same as with the old private accumulator (test `the scheduler tick and the old private accumulator...`).
package/dist/index.d.ts CHANGED
@@ -89,7 +89,12 @@ interface ProvingCertificate {
89
89
 
90
90
  /** The semi-simulation spec the runner drives a subject with: from the card's ratings and the body, with the subject's own overrides. */
91
91
  declare const subjectSpec: (subject: ProvingSubject) => SemiSimSpec;
92
- /** One measured test in progress. A host steps it with the frame's seconds and draws `driver.state`; `runTest` steps it to the end in one go. */
92
+ /** Physics steps of one scheduler tick (1/60 s): the proving run steps its driver at twice the tick, as the room's physics loop does. */
93
+ declare const STEPS_PER_TICK = 2;
94
+ /**
95
+ * One measured test in progress. It owns no clock: a host registers `stepFixed(STEPS_PER_TICK)` in its scheduler's `fixedSimulate` and draws `driver.state`;
96
+ * standalone (tests, CLI) the caller drives `stepFixed` or the thin `advance(seconds)`. `runTest` steps it to the end in one go.
97
+ */
93
98
  interface ProvingRun {
94
99
  readonly test: ProvingTest;
95
100
  readonly subject: ProvingSubject;
@@ -102,7 +107,12 @@ interface ProvingRun {
102
107
  readonly memo: ProvingMemo;
103
108
  /** What the procedure asked of the controls on the last step (all zero before the first): a host plays the brakes and the engine from it. */
104
109
  readonly input: SemiInput;
105
- step(dt: number): void;
110
+ /** Seconds of one physics step (`RunOptions.fixedStep`, default 1/120). */
111
+ readonly fixedStep: number;
112
+ /** Runs `steps` physics steps now (stops at the end of the run); no accumulator, no time scale: the caller's scheduler decides how many. */
113
+ stepFixed(steps: number): void;
114
+ /** Standalone helper: feeds `seconds` to a private `game-runtime` scheduler (exact, no render) whose fixed tick runs `STEPS_PER_TICK` steps; the remainder waits for the next call. */
115
+ advance(seconds: number): void;
106
116
  /** The result so far; pending while the run has not ended. */
107
117
  result(): ProvingResult;
108
118
  }
@@ -110,7 +120,7 @@ interface RunOptions {
110
120
  surfaces?: SurfaceRegistry;
111
121
  /** Seconds between two trace samples (default 0.1). */
112
122
  sampleEvery?: number;
113
- /** Fixed step of the simulation (default 1/120 s); `step(dt)` splits the frame into steps this long. */
123
+ /** Fixed step of the simulation (default 1/120 s): the seconds one `stepFixed` step integrates. */
114
124
  fixedStep?: number;
115
125
  }
116
126
  declare function startRun(test: ProvingTest, subject: ProvingSubject, options?: RunOptions): ProvingRun;
@@ -227,4 +237,4 @@ interface VehicleCardData {
227
237
  /** A proving subject from what a catalogue knows of a vehicle. */
228
238
  declare function subjectFromCard(id: string, card: VehicleCardData): ProvingSubject;
229
239
 
230
- export { type CertifyOptions, DEFAULT_DENSITY, type GateOptions, type ProvingCertificate, type ProvingDomain, type ProvingMemo, type ProvingProcedure, type ProvingRange, type ProvingResult, type ProvingRun, type ProvingSubject, type ProvingTest, type ProvingTestKind, type ProvingTestOptions, type ProvingTestRegistry, type ProvingVerdict, type RangeTable, type RunOptions, type SignOff, type VehicleCardData, accelerationRange, brakeRange, certify, createProvingTests, defaultProvingTests, defaultRangeTable, dryBrakeRange, expectedAcceleration, gateVehicles, inRange, runTest, startRun, statusOf, subjectFromCard, subjectSpec, topSpeedRange, turnCircleRange, wetBrakeRange, withResult };
240
+ export { type CertifyOptions, DEFAULT_DENSITY, type GateOptions, type ProvingCertificate, type ProvingDomain, type ProvingMemo, type ProvingProcedure, type ProvingRange, type ProvingResult, type ProvingRun, type ProvingSubject, type ProvingTest, type ProvingTestKind, type ProvingTestOptions, type ProvingTestRegistry, type ProvingVerdict, type RangeTable, type RunOptions, STEPS_PER_TICK, type SignOff, type VehicleCardData, accelerationRange, brakeRange, certify, createProvingTests, defaultProvingTests, defaultRangeTable, dryBrakeRange, expectedAcceleration, gateVehicles, inRange, runTest, startRun, statusOf, subjectFromCard, subjectSpec, topSpeedRange, turnCircleRange, wetBrakeRange, withResult };