@adatechnology/game-test-room 0.6.1 → 0.7.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/README.md CHANGED
@@ -71,10 +71,16 @@ The items join the catalogue under the module's group and its scenarios become b
71
71
 
72
72
  ## Module bench
73
73
 
74
+ The room makes **one** effects world (`game-vfx` and its `game-vfx-three` layer) and steps it once per frame, after the destruction renderer. The destruction
75
+ renderer draws into it, every module gets it as `host.effects` (an `EffectSink`: `play({ effect: 'm67', point })`, `catalog()`), grenades and rockets play the
76
+ profile of their explosive (`explosive` is on the `explosion` host event), the camera shakes and the screen flashes through an overlay in the container, and the
77
+ `particles` metric counts its pools. Without a DOM nothing is drawn on the screen. `TestRoom.applyCamera()` wraps a host's own `render`; the room's loop does it itself.
78
+ `craters: true` swaps the floor for a deformable patch that big explosions dig into.
79
+
74
80
  A module that declares `controls`, `layers` or `metrics` (see `@adatechnology/game-contracts`) gets a bench: `loadModule` checks it with
75
81
  `checkBench` (a `✓ ... bench ok` / `✗ ... bench broken` line), lends `host.bench` to `attach`, then sends one change per control and layer. The
76
82
  panel between the animations and the tests shows the active module (the one of the last `openArea`; else the first loaded with a bench, a later module never takes the panel from the one on screen): a
77
- range per number, a checkbox per boolean, buttons (up to four options) or a select per choice, a button per action, the layers, and the
83
+ range per number, a checkbox per boolean, buttons (up to four options, no groups) or a select per choice (options with a `group` sit under `optgroup`s), a button per action, the layers, and the
78
84
  module counters at 4 Hz with a bar when they have a budget (`warn` from 80 %, `bad` past it). A compact line on top shows the room counters
79
85
  (`fps`, `frame_ms`, `draw_calls`, `triangles`, `objects`, `fragments`, `particles`, `decals`); `fps` uses the real frame time, so slow motion
80
86
  does not change it.
@@ -85,6 +91,9 @@ room.bench()?.set('size', 2) // clamped and snapped; false for an unknown id, a
85
91
  room.metrics() // { room: { fps, draw_calls, ... }, module: { particles: 120 } }
86
92
  ```
87
93
 
94
+ A module can put a **sheet** on the panel (`host.bench.sheet(sheet)`, `BenchSheet` of the contracts): a card with a kicker, a title, a text, facts, steps, colour swatches and a timeline of named segments whose playhead follows one of the module's numeric metrics.
95
+ The room also runs the film of the liquids that have one (`createFilmManager` of `game-fluids-three`): a leak of fuel, oil or blood drips into grids on the floor near the camera.
96
+
88
97
  The state is `id=value;id=value` (`encodeBenchState` / `decodeBenchState`); decoding treats it as hostile input. `bench.state` is keyed by
89
98
  module id, so two modules can share a control id; a module loaded again keeps its live values. The room never touches
90
99
  `location`: the example page keeps it in `?bench.<moduleId>=`. `fps` and `frame_ms` use the real frame time, even past the 50 ms the simulation is clamped to. Loading a module again detaches the previous `attach` first. Q now reports the new fire
package/dist/index.d.ts CHANGED
@@ -181,6 +181,8 @@ interface TestRoomOptions {
181
181
  world?: DestructionWorld;
182
182
  worldOptions?: DestructionOptions;
183
183
  quality?: Quality;
184
+ /** Replaces the arena floor with a deformable patch (60 m, 33 cm cells) that the craters of big explosions dig into. Default false. */
185
+ craters?: boolean;
184
186
  /** Heaviest object the player can carry (default 60 kg). */
185
187
  maxCarryKg?: number;
186
188
  /** Arena half size in metres (default 14). */
@@ -320,6 +322,11 @@ interface TestRoom {
320
322
  /** The bench of a loaded module (default the active one: the module of the last `openArea`, else the last loaded with a bench), or null. */
321
323
  bench(moduleId?: string): BenchHandle | null;
322
324
  /** Room counters and the active module's metrics, read now. */
325
+ /**
326
+ * Shakes the camera for the render that follows, by the shake of the effects world, and answers the function that puts it back. The room's own loop
327
+ * wraps its render in it; a host that renders by itself calls it around its own `render`.
328
+ */
329
+ applyCamera(): () => void;
323
330
  metrics(): {
324
331
  room: Partial<Record<RoomMetricId, number>>;
325
332
  module: Record<string, number | string>;