@adatechnology/game-vehicles-three 0.8.6 → 0.9.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.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { E as EngineProfile, V as VehicleSoundKeys, B as BuiltVehicle } from './testing-Cb10i9fm.js';
2
- export { a as BIKE_ENGINE, b as BuildVehicleOptions, C as CAR_ENGINE, c as CRASH_SPEEDS, D as DEFAULT_TEST_VEHICLES, d as DEFAULT_TEST_WRECKS, e as DEFAULT_VEHICLE_SOUND_KEYS, f as DocumentLike, g as ENGINE_PROFILES, h as EffectsLike, i as EngineLayer, j as EngineLoadLayer, F as FleetDims, 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, T as TRUCK_ENGINE, q as VEHICLES_AREA_ID, r as VEHICLE_SCENARIO_IDS, s as VehicleEffectIds, t as VehicleFleetContent, u as VehicleQuality, v as VehicleSoundIds, w as VehicleWreck, x as VehiclesContext, y as VehiclesRoom, z as VehiclesTestFleet, A as VehiclesTestOptions, G as VehiclesThree, H as VehiclesThreeOptions, I as createProvingModule, J as createVehiclesTestModule, K as createVehiclesThree, L as defaultEffectIds, N as defaultSoundIds, O as loadProvingModule, Q as loadVehiclesTestModule } from './testing-Cb10i9fm.js';
1
+ import { E as EngineProfile, V as VehicleSoundKeys, B as BuiltVehicle } from './testing-D6oFFVUd.js';
2
+ export { a as BIKE_ENGINE, b as BuildVehicleOptions, C as CAR_ENGINE, c as CRASH_SPEEDS, D as DEFAULT_TEST_VEHICLES, d as DEFAULT_TEST_WRECKS, e as DEFAULT_VEHICLE_SOUND_KEYS, f as DocumentLike, g as ENGINE_PROFILES, h as EffectsLike, i as EngineLayer, j as EngineLoadLayer, F as FleetDims, 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, T as TRUCK_ENGINE, q as VEHICLES_AREA_ID, r as VEHICLE_SCENARIO_IDS, s as VehicleEffectIds, t as VehicleFleetContent, u as VehicleQuality, v as VehicleSoundIds, w as VehicleWreck, x as VehiclesContext, y as VehiclesRoom, z as VehiclesTestFleet, A as VehiclesTestOptions, G as VehiclesThree, H as VehiclesThreeOptions, I as createProvingModule, J as createVehiclesTestModule, K as createVehiclesThree, L as defaultEffectIds, N as defaultSoundIds, O as engineProfileOfGroup, Q as hornOfGroup, R as loadProvingModule, S as loadVehiclesTestModule } from './testing-D6oFFVUd.js';
3
3
  import { EffectSink, Vec3, AudioSink, AnimationClipSpec } from '@adatechnology/game-contracts';
4
4
  import { CabinSource, VehicleContext } from '@adatechnology/game-vehicles';
5
5
  import { LoopRecipe, Falloff, SampleAlias, SoundRecipe, SoundBank } from '@adatechnology/game-audio';
@@ -60,9 +60,9 @@ declare const CAR_START_RUN_STOP: {
60
60
  };
61
61
  /**
62
62
  * The vehicle ids answered by the recordings of the kit's manifest (files kept by the game, never in the SDK): the car engine layers by RPM, the
63
- * start and the stop cut out of one recording, the door and the trunk. Each recipe above stays as the fallback while the files load or where the
64
- * game has none. `car_door_open` is a file id of its own and needs no alias; the hood, the truck, the bike, the tyres, crashes and horns have no
65
- * recording yet.
63
+ * start and the stop cut out of one recording, the door, the trunk and the hood, the crashes, the tyres on asphalt and on gravel, and the idle of a
64
+ * truck and of a motorcycle. Each recipe above stays as the fallback while the files load or where the game has none. `car_door_open`, `car_hood_open`,
65
+ * `air_brake` and the horns (`horn_car`, `horn_truck`, `horn_bike`) are file ids of their own and need no alias.
66
66
  */
67
67
  declare const VEHICLE_SAMPLE_ALIASES: readonly SampleAlias[];
68
68
  /** The ids a host should decode as the vehicles load (`AudioSink.preload`): every aliased recording and the door's own file id. */
@@ -151,6 +151,8 @@ type VehicleSoundOptions = {
151
151
  readonly crankSeconds?: number;
152
152
  /** Shared by the vehicles of a scene: only the nearest few keep their loops (`createEngineBudget`). */
153
153
  readonly budget?: EngineBudget;
154
+ /** Lets the brake chambers out as the vehicle stops on the brakes (a truck's air brakes). Default: only for the truck profile. */
155
+ readonly airBrake?: boolean;
154
156
  };
155
157
  /** What was asked of the sink, for the checks and the bench: the RPM in use and the level of each loop. */
156
158
  type VehicleSoundReading = {
@@ -67,8 +67,10 @@ var GameVehiclesThree = (() => {
67
67
  defaultEffectIds: () => defaultEffectIds,
68
68
  defaultSoundIds: () => defaultSoundIds,
69
69
  engineMix: () => engineMix,
70
+ engineProfileOfGroup: () => engineProfileOfGroup,
70
71
  firingHz: () => firingHz,
71
72
  fuse: () => fuse,
73
+ hornOfGroup: () => hornOfGroup,
72
74
  layerWeight: () => layerWeight,
73
75
  liteMaterials: () => liteMaterials,
74
76
  liteMeshes: () => liteMeshes,
@@ -44436,7 +44438,7 @@ var GameVehiclesThree = (() => {
44436
44438
  };
44437
44439
  }
44438
44440
 
44439
- // ../game-audio/dist/chunk-LZDF5XMZ.js
44441
+ // ../game-audio/dist/chunk-S6WJVZGX.js
44440
44442
  var DISTANCE_CURVES = {
44441
44443
  /** The game's `sfx`: `vol / (1 + d² × 0.004)`, cutoff `/ (1 + d × 0.01)`, silent below 0.01 (jogo L62091–62092, L62101). */
44442
44444
  game_sfx: { model: "inverse_square", k: 4e-3, cutoffK: 0.01, minGain: 0.01 },
@@ -44751,7 +44753,12 @@ var GameVehiclesThree = (() => {
44751
44753
  ["mg_cover_open", 3],
44752
44754
  ["mg_cover_close", 3],
44753
44755
  ["weapon_holster", 3],
44754
- ["scope_zoom", 3]
44756
+ ["scope_zoom", 3],
44757
+ ["breech_open", 2],
44758
+ ["breech_close", 2],
44759
+ ["grenade_load", 2],
44760
+ ["rocket_load", 2],
44761
+ ["rocket_seat", 2]
44755
44762
  ]),
44756
44763
  ...entries("impactos", [
44757
44764
  ["knife_hit_wall", 3],
@@ -44780,6 +44787,8 @@ var GameVehiclesThree = (() => {
44780
44787
  ["c4_disarming_loop", 3],
44781
44788
  ["c4_remote_detonate", 3],
44782
44789
  ["smoke_grenade_hiss", 3],
44790
+ ["explosion_rocket", 2, "boom"],
44791
+ ["rocket_motor_loop", 2],
44783
44792
  ["grenade_pin_pull", 3],
44784
44793
  ["electric_shock", 3],
44785
44794
  ["electric_spark", 3]
@@ -46185,6 +46194,8 @@ var GameVehiclesThree = (() => {
46185
46194
  skidAsphalt: "tire_skid_asphalt",
46186
46195
  skidDirt: "tire_skid_dirt",
46187
46196
  roll: "tire_roll",
46197
+ rollDirt: "tire_roll_gravel",
46198
+ airBrake: "air_brake",
46188
46199
  brakeSqueal: "brake_squeal",
46189
46200
  hitBody: "vehicle_hit_pedestrian",
46190
46201
  siren: "siren",
@@ -46228,6 +46239,9 @@ var GameVehiclesThree = (() => {
46228
46239
  closedThrottle: 0.5
46229
46240
  };
46230
46241
  var ENGINE_PROFILES = { car: CAR_ENGINE, truck: TRUCK_ENGINE, bike: BIKE_ENGINE };
46242
+ var TRUCK_GROUPS = /* @__PURE__ */ new Set(["heavy", "agricultural"]);
46243
+ var engineProfileOfGroup = (group) => group === "motorcycles" ? BIKE_ENGINE : TRUCK_GROUPS.has(group) ? TRUCK_ENGINE : CAR_ENGINE;
46244
+ var hornOfGroup = (group) => group === "motorcycles" ? "horn_bike" : TRUCK_GROUPS.has(group) ? "horn_truck" : "horn_car";
46231
46245
 
46232
46246
  // src/audio/bank.ts
46233
46247
  var VEHICLE_LOOP_FALLOFF = { model: "inverse_square", k: 4e-3, cutoffK: 0.01 };
@@ -46268,6 +46282,7 @@ var GameVehiclesThree = (() => {
46268
46282
  noiseLoop("tire_skid_asphalt", "bandpass", 1900, 5, "rubber squealing on asphalt: a narrow band of noise near 2 kHz"),
46269
46283
  noiseLoop("tire_skid_dirt", "lowpass", 700, 0.8, "tyres sliding on dirt and gravel: a dull, wide hiss"),
46270
46284
  noiseLoop("tire_roll", "lowpass", 400, 0.7, "road noise of the tyres rolling, brighter with the speed"),
46285
+ noiseLoop("tire_roll_gravel", "bandpass", 1400, 0.6, "tyres rolling on gravel: a wide crunching hiss, louder with the speed"),
46271
46286
  // a pad on a disc: a thin, nearly pure whistle near 3.4 kHz (a narrow band of noise, so it wavers as a real squeal does)
46272
46287
  // a siren: a square through a low-pass, its pitch swept by the vehicle every frame (wail: a slow rise and fall; yelp: a fast one)
46273
46288
  toneLoop("siren", "square", "lowpass", 2600, 0.8, "emergency siren, the sweep driven by the vehicle"),
@@ -46334,10 +46349,14 @@ var GameVehiclesThree = (() => {
46334
46349
  // the game's horn (two squares at 415 and 523 Hz, jogo L70272) heard from where the car is; a truck's air horn lower and longer
46335
46350
  recipe2("horn_car", [sceneTone({ wave: "square", f: 415, d: 0.6, vol: 0.09 }), sceneTone({ wave: "square", f: 523, d: 0.6, vol: 0.09 })], "car horn: the game chord, placed and panned"),
46336
46351
  recipe2("horn_truck", [sceneTone({ wave: "sawtooth", f: 220, d: 1.1, vol: 0.1 }), sceneTone({ wave: "sawtooth", f: 277, d: 1.1, vol: 0.08 }), sceneNoise({ type: "bandpass", f: 900, q: 2, d: 1.1, vol: 0.05 })], "truck air horn: low reedy chord"),
46352
+ recipe2("horn_bike", [sceneTone({ wave: "square", f: 620, d: 0.35, vol: 0.07 }), sceneTone({ wave: "square", f: 780, d: 0.35, vol: 0.07 })], "motorcycle horn: a short, thin two-note beep"),
46353
+ // the compressed air let out of a truck's brake chambers as it stops: a hiss that dies away
46354
+ recipe2("air_brake", [sceneNoise({ type: "highpass", f: 2200, a: 0.01, d: 1.1, vol: 0.28 }), sceneNoise({ type: "bandpass", f: 900, q: 0.8, d: 0.35, vol: 0.2 }), sceneTone({ f: 120, f2: 70, d: 0.12, vol: 0.2 })], "air brakes: the chambers venting as the truck stops"),
46337
46355
  // a car door is a padded "tum" with a latch, not a hollow metal box (the fridge's shut_metal)
46338
46356
  recipe2("car_door_open", [...latch(0, 0.32), sceneNoise({ f: 400, d: 0.06, vol: 0.14, delay: 0.035 })], "car door: the handle pulled, the latch released, the seal letting go"),
46339
46357
  recipe2("car_door_close", [sceneTone({ f: 75, f2: 48, d: 0.16, vol: 0.75 }), sceneNoise({ f: 320, d: 0.1, vol: 0.6 }), ...latch(0.012, 0.3)], "car door shut: a dull padded thump and the latch catching"),
46340
46358
  recipe2("car_trunk_close", [sceneTone({ f: 90, f2: 55, d: 0.15, vol: 0.65 }), sceneNoise({ type: "bandpass", f: 500, q: 1, d: 0.12, vol: 0.5 }), ...latch(0.01, 0.28), sceneNoise({ type: "bandpass", f: 1800, q: 3, d: 0.04, vol: 0.1, delay: 0.06 })], "trunk or hatch shut: a lighter thump, the latch and a small rattle"),
46359
+ recipe2("car_hood_open", [...latch(0, 0.3), sceneTone({ f: [180, 230], f2: 140, d: 0.3, vol: 0.04, delay: 0.06 }), sceneNoise({ type: "bandpass", f: 700, q: 2, d: 0.25, vol: 0.12, delay: 0.05 })], "hood released: the latch giving and the lid rising a little on its springs"),
46341
46360
  recipe2("car_hood_close", [sceneTone({ f: 70, f2: 40, d: 0.22, vol: 0.8 }), sceneNoise({ type: "bandpass", f: 850, q: 1.4, d: 0.2, vol: 0.6, wet: 0.3 }), sceneTone({ f: 900, f2: 860, d: 0.18, vol: 0.05 }), ...latch(0.015, 0.3)], "hood slammed: a big sheet of metal ringing a little, the latch")
46342
46361
  ];
46343
46362
  var CAR_RECORDED_RPM = { idle: 1e3, high: 2520 };
@@ -46349,6 +46368,13 @@ var GameVehiclesThree = (() => {
46349
46368
  /** The ignition off: the engine running down to the end of the file. */
46350
46369
  stop: { offset: 9.96, duration: 0.64 }
46351
46370
  };
46371
+ var idleLayer = (id, file, rpm, profile) => ({
46372
+ id,
46373
+ file,
46374
+ loop: true,
46375
+ baseFrequency: firingHz(profile, rpm),
46376
+ falloff: VEHICLE_LOOP_FALLOFF
46377
+ });
46352
46378
  var carLayer = (id, file, rpm, harmonic, offset) => ({
46353
46379
  id,
46354
46380
  file,
@@ -46367,9 +46393,20 @@ var GameVehiclesThree = (() => {
46367
46393
  { id: "engine_start", file: "engine_start_run_stop", only: CAR_START_RUN_STOP.take, ...CAR_START_RUN_STOP.start, falloff: VEHICLE_LOOP_FALLOFF },
46368
46394
  { id: "engine_stop", file: "engine_start_run_stop", only: CAR_START_RUN_STOP.take, ...CAR_START_RUN_STOP.stop, falloff: VEHICLE_LOOP_FALLOFF },
46369
46395
  { id: "car_door_close", file: "car_door_shut" },
46370
- { id: "car_trunk_close", file: "car_trunk_shut" }
46396
+ { id: "car_trunk_close", file: "car_trunk_shut" },
46397
+ { id: "car_hood_close", file: "car_hood_shut" },
46398
+ // a crash by speed: a dent in the plastic, the body folding, the wreck (file ids that are not the recipes' own: `crash_light` and its kin would read as tiers of `crash`)
46399
+ { id: "crash_light", file: "crash_dent" },
46400
+ { id: "crash_medium", file: "crash_fold" },
46401
+ { id: "crash_heavy", file: "crash_wreck" },
46402
+ // tyres: the squeal of rubber on asphalt and the crunch of gravel, chained like the engines
46403
+ { id: "tire_skid_asphalt", file: "tire_skid_asphalt_loop", loop: { crossfade: 0.6 }, falloff: VEHICLE_LOOP_FALLOFF },
46404
+ { id: "tire_roll_gravel", file: "tire_roll_gravel_loop", loop: { crossfade: 0.6 }, falloff: VEHICLE_LOOP_FALLOFF },
46405
+ // the idle of a truck and of a motorcycle, at the profile's idle RPM (the take plays at its own pitch there); the other layers stay on their recipes
46406
+ idleLayer("engine_truck_low", "engine_loop_truck_idle", TRUCK_ENGINE.idleRpm, TRUCK_ENGINE),
46407
+ idleLayer("engine_bike_low", "engine_loop_bike_idle", BIKE_ENGINE.idleRpm, BIKE_ENGINE)
46371
46408
  ];
46372
- var VEHICLE_PRELOAD_SOUNDS = [...VEHICLE_SAMPLE_ALIASES.map((alias) => alias.id), "car_door_open"];
46409
+ var VEHICLE_PRELOAD_SOUNDS = [...VEHICLE_SAMPLE_ALIASES.map((alias) => alias.id), "car_door_open", "car_hood_open", "horn_car", "horn_truck", "horn_bike", "air_brake"];
46373
46410
  var VEHICLE_SOUND_BANK = { id: "vehicles_three", sounds: VEHICLE_SOUNDS, loops: VEHICLE_LOOPS, sampleAliases: VEHICLE_SAMPLE_ALIASES };
46374
46411
 
46375
46412
  // src/audio/engine-budget.ts
@@ -46406,12 +46443,13 @@ var GameVehiclesThree = (() => {
46406
46443
  const profile = options.profile ?? CAR_ENGINE;
46407
46444
  const keys = { ...DEFAULT_VEHICLE_SOUND_KEYS, ...options.sounds };
46408
46445
  const crankSeconds = options.crankSeconds ?? 0.75;
46446
+ const airBrake = options.airBrake ?? profile.id === TRUCK_ENGINE.id;
46409
46447
  const gears = createGearGuess(profile);
46410
46448
  const loops = /* @__PURE__ */ new Map();
46411
46449
  const budget = options.budget;
46412
46450
  const self = {};
46413
46451
  const levels = {};
46414
- const state = { running: false, cranking: 0, catches: false, flare: 0, rpm: 0, sirenPhase: 0 };
46452
+ const state = { running: false, cranking: 0, catches: false, flare: 0, rpm: 0, sirenPhase: 0, rolling: false };
46415
46453
  const loopOf = (sound) => {
46416
46454
  let handle = loops.get(sound);
46417
46455
  if (!handle && audio?.loop) {
@@ -46472,7 +46510,15 @@ var GameVehiclesThree = (() => {
46472
46510
  const dirt = frame.surface === "dirt";
46473
46511
  setLoop(keys.skidAsphalt, heard * (dirt ? 0 : 0.16 * slide), frame.position, { cutoff: 1700 + 600 * slide });
46474
46512
  setLoop(keys.skidDirt, heard * (dirt ? 0.2 * slide : 0), frame.position, { cutoff: 500 + 500 * slide });
46475
- setLoop(keys.roll, heard * 0.06 * clamp012(speed / 25), frame.position, { cutoff: 250 + 45 * Math.min(speed, 40) });
46513
+ setLoop(keys.roll, heard * (dirt ? 0 : 0.06 * clamp012(speed / 25)), frame.position, { cutoff: 250 + 45 * Math.min(speed, 40) });
46514
+ setLoop(keys.rollDirt, heard * (dirt ? 0.1 * clamp012(speed / 20) : 0), frame.position, { cutoff: 700 + 60 * Math.min(speed, 30) });
46515
+ if (airBrake) {
46516
+ if (speed > 2) state.rolling = true;
46517
+ else if (state.rolling && speed < 0.8) {
46518
+ state.rolling = false;
46519
+ if ((frame.brake ?? 0) > 0.3 && heard > 0) play(keys.airBrake, frame.position, 0.8);
46520
+ }
46521
+ }
46476
46522
  const squeal = clamp012(((frame.brake ?? 0) - 0.3) / 0.4) * clamp012(speed / 0.8) * clamp012((5 - speed) / 2) * (slide > 0 ? 0 : 1);
46477
46523
  setLoop(keys.brakeSqueal, heard * 0.05 * squeal, frame.position, { cutoff: 3200 + 400 * squeal });
46478
46524
  const siren = frame.siren ?? "off";
@@ -50791,7 +50837,7 @@ var GameVehiclesThree = (() => {
50791
50837
  if (id === "turn_circle") run.driver.place(0, TRACK.start, 0);
50792
50838
  rig.vehicle?.reset();
50793
50839
  stopEngine();
50794
- engine = createVehicleSound(host.audio, { sounds });
50840
+ engine = createVehicleSound(host.audio, { sounds, profile: engineProfileOfGroup(car.subject.category) });
50795
50841
  engine.start([car.built.group.position.x, 0.5, car.built.group.position.z]);
50796
50842
  host.log(fillText(text.log.start, name(settings.vehicle), text.tests[id] ?? id));
50797
50843
  drawBoard();
@@ -50848,7 +50894,7 @@ var GameVehiclesThree = (() => {
50848
50894
  gauge: kitFor(three).materials?.gauge,
50849
50895
  needle: kitFor(three).materials?.amber,
50850
50896
  // the engine's own sound turns the key (starter, catch, idle by RPM)
50851
- sounds: { starter: "" },
50897
+ sounds: { starter: "", horn: hornOfGroup(car.subject.category) },
50852
50898
  hasKey,
50853
50899
  weather,
50854
50900
  stock: (compartment) => options.stock?.(compartment, settings.vehicle) ?? [],
@@ -50888,7 +50934,7 @@ var GameVehiclesThree = (() => {
50888
50934
  }
50889
50935
  rig.vehicle?.reset();
50890
50936
  stopEngine();
50891
- engine = createVehicleSound(host.audio, { sounds });
50937
+ engine = createVehicleSound(host.audio, { sounds, profile: engineProfileOfGroup(car.subject.category) });
50892
50938
  host.bench?.sheet?.({ kicker: text.name, title: fillText(text.log.drive, name(settings.vehicle)), body: `${text.cabin.keys} \xB7 ${sysText.keys} \xB7 ${sysText.bodyKeys}` });
50893
50939
  host.log(fillText(text.log.drive, name(settings.vehicle)));
50894
50940
  };
@@ -51293,6 +51339,7 @@ var GameVehiclesThree = (() => {
51293
51339
  lent.audio?.register?.(CABIN_BANK);
51294
51340
  lent.audio?.register?.(VEHICLE_SOUND_BANK);
51295
51341
  lent.audio?.register?.(RADIO_BANK);
51342
+ lent.audio?.preload?.(VEHICLE_PRELOAD_SOUNDS);
51296
51343
  const stopChange = lent.bench?.onChange(onChange);
51297
51344
  const stopFrame = lent.onFrame(frame);
51298
51345
  const stopClear = lent.onClear?.(() => {