@adatechnology/game-vehicles-three 0.5.0 → 0.6.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/dist/index.js CHANGED
@@ -1,47 +1,87 @@
1
1
  import {
2
+ BIKE_ENGINE,
3
+ CAR_ENGINE,
4
+ CRASH_SPEEDS,
2
5
  DEFAULT_TEST_VEHICLES,
3
6
  DEFAULT_TEST_WRECKS,
7
+ DEFAULT_VEHICLE_SOUND_KEYS,
8
+ ENGINE_PROFILES,
4
9
  LITE_CLASSES,
5
10
  PAGE_ITEM_ALIASES,
6
11
  PAGE_SCENARIO_ALIASES,
12
+ PROVING_AREA_ID,
13
+ PROVING_TEXT,
7
14
  PRUNE_BELOW,
15
+ TRUCK_ENGINE,
8
16
  VEHICLES_AREA_ID,
9
17
  VEHICLE_LOD_DISTANCE,
18
+ VEHICLE_LOOPS,
19
+ VEHICLE_LOOP_FALLOFF,
10
20
  VEHICLE_SCENARIO_IDS,
21
+ VEHICLE_SOUNDS,
22
+ VEHICLE_SOUND_BANK,
11
23
  classColor,
12
24
  classify,
13
25
  createCabinSmoke,
26
+ createGearGuess,
27
+ createProvingModule,
14
28
  createVehicleLod,
29
+ createVehicleSound,
15
30
  createVehiclesTestModule,
16
31
  createVehiclesThree,
17
32
  defaultEffectIds,
18
33
  defaultSoundIds,
34
+ engineMix,
35
+ firingHz,
19
36
  fuse,
37
+ layerWeight,
20
38
  liteMaterials,
21
39
  liteMeshes,
22
- loadVehiclesTestModule
23
- } from "./chunk-GAO7ZJP7.js";
40
+ loadProvingModule,
41
+ loadVehiclesTestModule,
42
+ rpmShare
43
+ } from "./chunk-4SUQMRS3.js";
24
44
  export {
45
+ BIKE_ENGINE,
46
+ CAR_ENGINE,
47
+ CRASH_SPEEDS,
25
48
  DEFAULT_TEST_VEHICLES,
26
49
  DEFAULT_TEST_WRECKS,
50
+ DEFAULT_VEHICLE_SOUND_KEYS,
51
+ ENGINE_PROFILES,
27
52
  LITE_CLASSES,
28
53
  PAGE_ITEM_ALIASES,
29
54
  PAGE_SCENARIO_ALIASES,
55
+ PROVING_AREA_ID,
56
+ PROVING_TEXT,
30
57
  PRUNE_BELOW,
58
+ TRUCK_ENGINE,
31
59
  VEHICLES_AREA_ID,
32
60
  VEHICLE_LOD_DISTANCE,
61
+ VEHICLE_LOOPS,
62
+ VEHICLE_LOOP_FALLOFF,
33
63
  VEHICLE_SCENARIO_IDS,
64
+ VEHICLE_SOUNDS,
65
+ VEHICLE_SOUND_BANK,
34
66
  classColor,
35
67
  classify,
36
68
  createCabinSmoke,
69
+ createGearGuess,
70
+ createProvingModule,
37
71
  createVehicleLod,
72
+ createVehicleSound,
38
73
  createVehiclesTestModule,
39
74
  createVehiclesThree,
40
75
  defaultEffectIds,
41
76
  defaultSoundIds,
77
+ engineMix,
78
+ firingHz,
42
79
  fuse,
80
+ layerWeight,
43
81
  liteMaterials,
44
82
  liteMeshes,
45
- loadVehiclesTestModule
83
+ loadProvingModule,
84
+ loadVehiclesTestModule,
85
+ rpmShare
46
86
  };
47
87
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,6 @@
1
1
  import { EffectSink, Vec3, TestableModule } from '@adatechnology/game-contracts';
2
2
  import { Damageable, VehicleContext, VehicleKit } from '@adatechnology/game-vehicles';
3
+ import { ProvingSubject, ProvingTestRegistry, ProvingCertificate } from '@adatechnology/game-vehicles-proving';
3
4
 
4
5
  type VehicleQuality = 'high' | 'lite';
5
6
  /** The measured size of a fleet vehicle in metres (the shape of `FleetDims` of `game-vehicles-fleet`). */
@@ -76,6 +77,69 @@ interface VehiclesThreeOptions {
76
77
  */
77
78
  declare function createVehiclesThree(THREE: any, options: VehiclesThreeOptions): VehiclesThree;
78
79
 
80
+ /**
81
+ * How a vehicle sounds, as data. An engine is a few loops crossfaded by RPM (idle, low/mid, high) plus a load layer (intake and exhaust roar) that
82
+ * follows the throttle, the way a sampled engine is mixed: when recorded loops arrive they take the same ids and the same crossfade. The pitch of
83
+ * each tone layer is the firing frequency of the engine (`rpm / 60 × cylinders / 2` for a four-stroke) times its harmonic.
84
+ */
85
+ /** One tone layer of the engine: the loop id, where in the RPM range it is loudest (0 idle … 1 redline), and its level and cutoff. */
86
+ type EngineLayer = {
87
+ readonly sound: string;
88
+ /** Normalised RPM (0 at idle, 1 at the redline) where the layer is loudest. */
89
+ readonly centre: number;
90
+ /** How far from `centre` the layer fades out (equal-power crossfade). */
91
+ readonly width: number;
92
+ /** Multiple of the firing frequency the oscillator plays at. */
93
+ readonly harmonic: number;
94
+ /** Level at full load. */
95
+ readonly gain: number;
96
+ /** Low-pass cutoff, Hz, from no load at idle to full load at the redline. */
97
+ readonly cutoff: readonly [min: number, max: number];
98
+ };
99
+ /** The roar of the intake and exhaust: a noise loop that opens with the throttle and the RPM. */
100
+ type EngineLoadLayer = {
101
+ readonly sound: string;
102
+ readonly gain: number;
103
+ readonly cutoff: readonly [min: number, max: number];
104
+ };
105
+ type EngineProfile = {
106
+ readonly id: string;
107
+ readonly cylinders: number;
108
+ readonly idleRpm: number;
109
+ readonly redlineRpm: number;
110
+ /** Gear ratios times final drive per m/s, to guess the RPM from the speed when the driver has no engine model (the arcade driver). */
111
+ readonly rpmPerMps: readonly number[];
112
+ readonly layers: readonly EngineLayer[];
113
+ readonly load: EngineLoadLayer;
114
+ /** Level with the throttle closed, as a share of full load (engine braking is quieter and darker). */
115
+ readonly closedThrottle: number;
116
+ };
117
+ /** The sound ids a vehicle plays besides its engine. Every one is a key of `VEHICLE_SOUND_BANK`, and a game can point any of them elsewhere. */
118
+ type VehicleSoundKeys = {
119
+ readonly start: string;
120
+ readonly stop: string;
121
+ readonly fail: string;
122
+ readonly crashLight: string;
123
+ readonly crashMedium: string;
124
+ readonly crashHeavy: string;
125
+ readonly skidAsphalt: string;
126
+ readonly skidDirt: string;
127
+ readonly roll: string;
128
+ };
129
+ declare const DEFAULT_VEHICLE_SOUND_KEYS: VehicleSoundKeys;
130
+ /** The speed of the hit, m/s, where a crash stops being light (≈ 22 km/h: dents and plastic) and where it turns heavy (≈ 50 km/h: metal folds, glass goes). */
131
+ declare const CRASH_SPEEDS: {
132
+ readonly medium: 6;
133
+ readonly heavy: 14;
134
+ };
135
+ /** A four-cylinder petrol car: 800 to 6 500 rpm. */
136
+ declare const CAR_ENGINE: EngineProfile;
137
+ /** A six-cylinder diesel truck or bus: 650 to 2 600 rpm, low and clattering. */
138
+ declare const TRUCK_ENGINE: EngineProfile;
139
+ /** A four-cylinder sport bike: 1 300 to 12 000 rpm, bright and fast to rev. */
140
+ declare const BIKE_ENGINE: EngineProfile;
141
+ declare const ENGINE_PROFILES: Readonly<Record<string, EngineProfile>>;
142
+
79
143
  /** The fleet the area runs on: its palettes and sizes, and how it is installed in a kit (`defaultVehicleFleet()` of `game-kit-defaults`). */
80
144
  type VehiclesTestFleet = VehicleFleetContent & {
81
145
  installFleet(kit: VehicleKit): void;
@@ -98,12 +162,13 @@ type VehicleEffectIds = {
98
162
  readonly exhaust: string;
99
163
  };
100
164
  declare const defaultEffectIds: VehicleEffectIds;
101
- /** The sounds the module asks of `host.audio`, by id of the host's banks. `engine` is a loop (the game's saw through a 400 Hz low-pass), `horn` and `crash` one-shots. */
165
+ /**
166
+ * The sounds the module asks of `host.audio`, by id of the host's banks: the horn (placed at the car), and the vehicle's own sounds (`createVehicleSound`: the starter, the
167
+ * crashes by speed, the tyres). The engine loops come from the engine profile.
168
+ */
102
169
  type VehicleSoundIds = {
103
- readonly engine: string;
104
170
  readonly horn: string;
105
- readonly crash: string;
106
- };
171
+ } & VehicleSoundKeys;
107
172
  declare const defaultSoundIds: VehicleSoundIds;
108
173
  /** A damaged vehicle of the area: the item id, the fleet vehicle it is built from and the scenario of the kit applied while building. */
109
174
  type VehicleWreck = {
@@ -131,7 +196,7 @@ type VehiclesTestOptions = {
131
196
  readonly wrecks?: readonly VehicleWreck[];
132
197
  /** Effect ids requested through `host.effects` (the defaults are ids of `game-vfx`: the Garagem's `car_fuel_tank` blast, the `vehicle_fire`, `vehicle_leak` (pool and drips only), `vehicle_leak_ignited` (the whole sequence) and `vehicle_exhaust` recipes written around a car from `engine_smoke` and `fuel_leak`, and the point-based `glass_burst` and `impact_metal`). */
133
198
  readonly effects?: Partial<VehicleEffectIds>;
134
- /** Sound ids requested through `host.audio` (the defaults are the `game-audio` ones: `engine_saw`, `horn`, `sfx_impact`). */
199
+ /** Sound ids requested through `host.audio` (the defaults: the vehicle bank of this package). */
135
200
  readonly sounds?: Partial<VehicleSoundIds>;
136
201
  };
137
202
  /** The part of the test room the scenarios use (the room's `ScenarioContext.room` has all of it). */
@@ -216,4 +281,69 @@ declare const VEHICLE_SCENARIO_IDS: readonly string[];
216
281
  declare const PAGE_SCENARIO_ALIASES: Readonly<Record<string, string>>;
217
282
  declare const PAGE_ITEM_ALIASES: Readonly<Record<string, string>>;
218
283
 
219
- export { type BuildVehicleOptions as B, DEFAULT_TEST_VEHICLES as D, type EffectsLike as E, type FleetDims as F, type ModuleRoomLike as M, PAGE_ITEM_ALIASES as P, VEHICLES_AREA_ID as V, type BuiltVehicle as a, DEFAULT_TEST_WRECKS as b, type DocumentLike as c, PAGE_SCENARIO_ALIASES as d, VEHICLE_SCENARIO_IDS as e, type VehicleEffectIds as f, type VehicleFleetContent as g, type VehicleQuality as h, type VehicleSoundIds as i, type VehicleWreck as j, type VehiclesContext as k, type VehiclesRoom as l, type VehiclesTestFleet as m, type VehiclesTestOptions as n, type VehiclesThree as o, type VehiclesThreeOptions as p, createVehiclesTestModule as q, createVehiclesThree as r, defaultEffectIds as s, defaultSoundIds as t, loadVehiclesTestModule as u };
284
+ declare const PROVING_AREA_ID = "vehicles_proving";
285
+ type Three = any;
286
+ /** Content comes in by option (the adapter does not import a content pack): the example wires the kit's fleet, a game its own catalogue. */
287
+ interface ProvingModuleOptions {
288
+ locale?: string;
289
+ /** Vehicles offered on the bench, by catalogue id. */
290
+ vehicles: readonly string[];
291
+ /** The proving subject of a vehicle (`fleetProvingSubject` of game-vehicles-fleet); `mass` is the kit's own when it has one. Null hides the vehicle. */
292
+ subject(id: string, mass: number | undefined): ProvingSubject | null;
293
+ /** The vehicle's name on the bench and the board (default: the id). */
294
+ nameOf?(id: string): string | undefined;
295
+ /** The tests (default: the kit's, see `createProvingTests`). */
296
+ tests?: ProvingTestRegistry;
297
+ /** Builds the vehicle kit, with the catalogue installed, for a three.js namespace. */
298
+ createKit(THREE: Three): VehicleKit;
299
+ sounds?: Partial<VehicleSoundIds>;
300
+ /** Called whenever a certificate changes (a result in, a sign-off), so a page can keep or show them. */
301
+ onCertificate?(certificate: ProvingCertificate): void;
302
+ }
303
+ /**
304
+ * The proving ground as a `TestableModule`: a track where a fleet vehicle runs the measured tests of `game-vehicles-proving` live (0-100, top speed, braking, turning circle, wet braking, mud)
305
+ * on the same semi-simulation driver the headless runner uses, with the vehicle cameras of `game-camera` (chase, cockpit, hood) taking over the room's view, the rear-view and side mirrors
306
+ * and the reversing camera with its guide lines as extra views of the host, a board by the track with the vehicle's certificate, and the sign-off of the visual checks.
307
+ */
308
+ declare function createProvingModule(options: ProvingModuleOptions): TestableModule & {
309
+ certificates(): ProvingCertificate[];
310
+ certificate(id: string): ProvingCertificate | undefined;
311
+ };
312
+ /** What `loadProvingModule` needs of a room: `TestRoom.loadModule` has it. */
313
+ type ProvingRoomLike = {
314
+ loadModule(module: never): unknown;
315
+ openArea?(id: string): unknown;
316
+ };
317
+ declare function loadProvingModule<Room extends ProvingRoomLike>(room: Room, options: ProvingModuleOptions): ReturnType<Room['loadModule']>;
318
+
319
+ /** Texts of the proving ground, in Brazilian Portuguese and English. */
320
+ type ProvingText = {
321
+ name: string;
322
+ controls: Record<'vehicle' | 'test' | 'camera' | 'time_scale' | 'visual_check', string>;
323
+ hints: Record<'vehicle' | 'test' | 'camera' | 'time_scale' | 'visual_check', string>;
324
+ actions: Record<'run_test' | 'run_all' | 'certify_now' | 'reverse_park' | 'sign_ok' | 'sign_fail' | 'reset', string>;
325
+ layers: Record<'mirrors' | 'reverse_camera' | 'scoreboard', string>;
326
+ metrics: Record<'speed' | 'time' | 'value' | 'passed' | 'failed' | 'pending' | 'status', string>;
327
+ cameras: Record<'room' | 'chase' | 'cockpit' | 'hood', string>;
328
+ tests: Record<string, string>;
329
+ status: Record<'approved' | 'rejected' | 'pending', string>;
330
+ verdict: Record<'pass' | 'fail' | 'pending', string>;
331
+ board: {
332
+ title: string;
333
+ test: string;
334
+ value: string;
335
+ range: string;
336
+ verdict: string;
337
+ notRun: string;
338
+ running: string;
339
+ };
340
+ log: {
341
+ start: string;
342
+ result: string;
343
+ signed: string;
344
+ certified: string;
345
+ };
346
+ };
347
+ declare const PROVING_TEXT: Record<string, ProvingText>;
348
+
349
+ export { type VehiclesTestOptions as A, BIKE_ENGINE as B, CAR_ENGINE as C, DEFAULT_TEST_VEHICLES as D, type EngineProfile as E, type FleetDims as F, type VehiclesThree as G, type VehiclesThreeOptions as H, createProvingModule as I, createVehiclesTestModule as J, createVehiclesThree as K, defaultEffectIds as L, type ModuleRoomLike as M, defaultSoundIds as N, loadProvingModule as O, PAGE_ITEM_ALIASES as P, loadVehiclesTestModule as Q, TRUCK_ENGINE as T, type VehicleSoundKeys as V, type BuildVehicleOptions as a, type BuiltVehicle as b, CRASH_SPEEDS as c, DEFAULT_TEST_WRECKS as d, DEFAULT_VEHICLE_SOUND_KEYS as e, type DocumentLike as f, ENGINE_PROFILES as g, type EffectsLike as h, type EngineLayer as i, type EngineLoadLayer as j, PAGE_SCENARIO_ALIASES as k, PROVING_AREA_ID as l, PROVING_TEXT as m, type ProvingModuleOptions as n, type ProvingRoomLike as o, type ProvingText as p, VEHICLES_AREA_ID as q, VEHICLE_SCENARIO_IDS as r, type VehicleEffectIds as s, type VehicleFleetContent as t, type VehicleQuality as u, type VehicleSoundIds as v, type VehicleWreck as w, type VehiclesContext as x, type VehiclesRoom as y, type VehiclesTestFleet as z };
package/dist/testing.d.ts CHANGED
@@ -1,3 +1,4 @@
1
- export { D as DEFAULT_TEST_VEHICLES, b as DEFAULT_TEST_WRECKS, c as DocumentLike, E as EffectsLike, M as ModuleRoomLike, P as PAGE_ITEM_ALIASES, d as PAGE_SCENARIO_ALIASES, V as VEHICLES_AREA_ID, e as VEHICLE_SCENARIO_IDS, f as VehicleEffectIds, i as VehicleSoundIds, j as VehicleWreck, k as VehiclesContext, l as VehiclesRoom, m as VehiclesTestFleet, n as VehiclesTestOptions, q as createVehiclesTestModule, s as defaultEffectIds, t as defaultSoundIds, u as loadVehiclesTestModule } from './testing-DmGv7Gpb.js';
1
+ export { D as DEFAULT_TEST_VEHICLES, d as DEFAULT_TEST_WRECKS, f as DocumentLike, h as EffectsLike, M as ModuleRoomLike, P as PAGE_ITEM_ALIASES, k as PAGE_SCENARIO_ALIASES, l as PROVING_AREA_ID, m as PROVING_TEXT, n as ProvingModuleOptions, o as ProvingRoomLike, p as ProvingText, q as VEHICLES_AREA_ID, r as VEHICLE_SCENARIO_IDS, s as VehicleEffectIds, v as VehicleSoundIds, w as VehicleWreck, x as VehiclesContext, y as VehiclesRoom, z as VehiclesTestFleet, A as VehiclesTestOptions, I as createProvingModule, J as createVehiclesTestModule, L as defaultEffectIds, N as defaultSoundIds, O as loadProvingModule, Q as loadVehiclesTestModule } from './testing-gEnSqEF6.js';
2
2
  import '@adatechnology/game-contracts';
3
3
  import '@adatechnology/game-vehicles';
4
+ import '@adatechnology/game-vehicles-proving';
package/dist/testing.js CHANGED
@@ -3,23 +3,31 @@ import {
3
3
  DEFAULT_TEST_WRECKS,
4
4
  PAGE_ITEM_ALIASES,
5
5
  PAGE_SCENARIO_ALIASES,
6
+ PROVING_AREA_ID,
7
+ PROVING_TEXT,
6
8
  VEHICLES_AREA_ID,
7
9
  VEHICLE_SCENARIO_IDS,
10
+ createProvingModule,
8
11
  createVehiclesTestModule,
9
12
  defaultEffectIds,
10
13
  defaultSoundIds,
14
+ loadProvingModule,
11
15
  loadVehiclesTestModule
12
- } from "./chunk-GAO7ZJP7.js";
16
+ } from "./chunk-4SUQMRS3.js";
13
17
  export {
14
18
  DEFAULT_TEST_VEHICLES,
15
19
  DEFAULT_TEST_WRECKS,
16
20
  PAGE_ITEM_ALIASES,
17
21
  PAGE_SCENARIO_ALIASES,
22
+ PROVING_AREA_ID,
23
+ PROVING_TEXT,
18
24
  VEHICLES_AREA_ID,
19
25
  VEHICLE_SCENARIO_IDS,
26
+ createProvingModule,
20
27
  createVehiclesTestModule,
21
28
  defaultEffectIds,
22
29
  defaultSoundIds,
30
+ loadProvingModule,
23
31
  loadVehiclesTestModule
24
32
  };
25
33
  //# sourceMappingURL=testing.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adatechnology/game-vehicles-three",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "license": "MIT",
5
5
  "description": "three.js output of the vehicles of @adatechnology/game-vehicles: a vehicle in a game frame (front on +z, centred, on the ground) at full detail or fused into six meshes (the team's Frota Leve light mode), coloured by seed, with its damageable boxes; and the vehicles test module.",
6
6
  "keywords": [
@@ -41,13 +41,15 @@
41
41
  "dist"
42
42
  ],
43
43
  "dependencies": {
44
- "@adatechnology/game-contracts": "^0.22.0",
44
+ "@adatechnology/game-audio": "^0.5.0",
45
+ "@adatechnology/game-camera": "^0.2.0",
46
+ "@adatechnology/game-contracts": "^0.23.0",
45
47
  "@adatechnology/game-render-three": "^0.1.0",
46
- "@adatechnology/game-shapes-three": "^0.3.0",
47
- "@adatechnology/game-vehicles": "^0.6.0",
48
- "@adatechnology/game-audio": "^0.4.0",
49
- "@adatechnology/game-vehicles-driving": "^0.2.9",
50
- "@adatechnology/game-vehicles-fleet": "^6.0.0"
48
+ "@adatechnology/game-shapes-three": "^0.3.1",
49
+ "@adatechnology/game-vehicles": "^0.6.1",
50
+ "@adatechnology/game-vehicles-driving": "^0.2.10",
51
+ "@adatechnology/game-vehicles-fleet": "^6.0.0",
52
+ "@adatechnology/game-vehicles-proving": "^0.1.1"
51
53
  },
52
54
  "devDependencies": {
53
55
  "@types/node": "^22.10.7",
@@ -58,7 +60,7 @@
58
60
  "typescript": "^5.7.3",
59
61
  "vitest": "^3.2.4",
60
62
  "@adatechnology/game-kit-defaults": "^0.2.0",
61
- "@adatechnology/game-test-room": "^0.21.0",
63
+ "@adatechnology/game-test-room": "^0.22.0",
62
64
  "@adatechnology/golden-tool": "^0.0.0"
63
65
  },
64
66
  "peerDependencies": {