@threenative/playtest 0.3.3 → 0.3.4
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/capture.d.ts +7 -0
- package/dist/{diagnostics-Bpy15z5f.d.ts → diagnostics-BXhYI2sc.d.ts} +389 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.js +206 -41
- package/dist/protocol.d.ts +7 -0
- package/dist/runner/cli.d.ts +2 -2
- package/dist/runner/cli.js +1192 -298
- package/dist/runner/index.d.ts +71 -240
- package/dist/runner/index.js +1651 -971
- package/dist/{shared-eFOF5bZO.d.ts → shared-CHIDDJpp.d.ts} +38 -5
- package/dist/three/index.d.ts +10 -1
- package/dist/three/index.js +11 -6
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { u as IPlaytestPerformanceAssertion, c as IPlaytestReport, w as IPlaytestProtocolDiagnostic, p as IPlaytestDiagnosticsPolicy, d as IPlaytestAssertionResult } from './diagnostics-BXhYI2sc.js';
|
|
1
2
|
import { IPlaytestObservationSnapshot } from './protocol.js';
|
|
2
|
-
import { c as IPlaytestReport, w as IPlaytestProtocolDiagnostic, p as IPlaytestDiagnosticsPolicy, d as IPlaytestAssertionResult } from './diagnostics-Bpy15z5f.js';
|
|
3
3
|
|
|
4
4
|
interface IPlaytestServerConfig {
|
|
5
5
|
command: string;
|
|
@@ -23,7 +23,18 @@ interface IStandalonePlaytestConfig {
|
|
|
23
23
|
adbPath?: string;
|
|
24
24
|
/** @see IAndroidDriverOptions.touchRotation */
|
|
25
25
|
touchRotation?: number;
|
|
26
|
+
/**
|
|
27
|
+
* The built artifact this run is about to exercise, for `--build-report` to hash. Set by
|
|
28
|
+
* `--artifact`; desktop and iOS already name theirs, so the flag is refused there.
|
|
29
|
+
*/
|
|
30
|
+
artifactPath?: string;
|
|
26
31
|
artifactDirectory: string;
|
|
32
|
+
/**
|
|
33
|
+
* The `<artifact>.build-report.json` a `threenative build` published beside the artifact, carrying
|
|
34
|
+
* the profile's `performanceBudget`. Resolved and proved against the artifact under test before
|
|
35
|
+
* anything launches; its budget is merged into every scenario's `assert.performance`.
|
|
36
|
+
*/
|
|
37
|
+
buildReportPath?: string;
|
|
27
38
|
/**
|
|
28
39
|
* Capture the run's `before.png`/`after.png` artifact frames. Default true. A scenario that
|
|
29
40
|
* asserts on a frame still captures one — this only drops the convenience captures every run
|
|
@@ -45,7 +56,13 @@ interface IStandalonePlaytestConfig {
|
|
|
45
56
|
bundleId: string;
|
|
46
57
|
transport: "device" | "simulator";
|
|
47
58
|
};
|
|
59
|
+
judgeMarkerUrl?: string;
|
|
48
60
|
mailboxRoot?: string;
|
|
61
|
+
/**
|
|
62
|
+
* The performance ceilings the build report declared, already proved against the artifact under
|
|
63
|
+
* test. Merged into each scenario's `assert.performance`; absent when no report was passed.
|
|
64
|
+
*/
|
|
65
|
+
performanceBudget?: IPlaytestPerformanceAssertion;
|
|
49
66
|
port?: number;
|
|
50
67
|
projectPath: string;
|
|
51
68
|
scenarioPath: string;
|
|
@@ -95,11 +112,21 @@ declare const PLAYTEST_FLAGS: {
|
|
|
95
112
|
readonly summary: "built iOS .app bundle";
|
|
96
113
|
readonly takesValue: true;
|
|
97
114
|
};
|
|
115
|
+
readonly "--artifact": {
|
|
116
|
+
readonly default: "none (browser and android: with --build-report)";
|
|
117
|
+
readonly summary: "the built artifact this run exercises, hashed to prove the build report describes it";
|
|
118
|
+
readonly takesValue: true;
|
|
119
|
+
};
|
|
98
120
|
readonly "--artifacts": {
|
|
99
121
|
readonly default: "artifacts/playtest";
|
|
100
122
|
readonly summary: "artifact output directory";
|
|
101
123
|
readonly takesValue: true;
|
|
102
124
|
};
|
|
125
|
+
readonly "--build-report": {
|
|
126
|
+
readonly default: "none";
|
|
127
|
+
readonly summary: "the <artifact>.build-report.json threenative build published; its performanceBudget bounds every scenario, and a stale or foreign report refuses the run";
|
|
128
|
+
readonly takesValue: true;
|
|
129
|
+
};
|
|
103
130
|
readonly "--no-screenshots": {
|
|
104
131
|
readonly default: "false";
|
|
105
132
|
readonly summary: "skip the before/after artifact frames; scenarios that assert on a frame still capture one";
|
|
@@ -147,6 +174,11 @@ declare const PLAYTEST_FLAGS: {
|
|
|
147
174
|
readonly summary: "show the browser window";
|
|
148
175
|
readonly takesValue: false;
|
|
149
176
|
};
|
|
177
|
+
readonly "--judge-marker-url": {
|
|
178
|
+
readonly default: "none";
|
|
179
|
+
readonly summary: "judge-owned loopback marker URL whose POST failures are not network errors";
|
|
180
|
+
readonly takesValue: true;
|
|
181
|
+
};
|
|
150
182
|
readonly "--host-arg": {
|
|
151
183
|
readonly allowDashValue: true;
|
|
152
184
|
readonly default: "none";
|
|
@@ -252,10 +284,11 @@ interface IStandalonePlaytestReport extends IPlaytestReport {
|
|
|
252
284
|
/**
|
|
253
285
|
* What the run waited for before it observed anything, and what it settled on.
|
|
254
286
|
*
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
287
|
+
* `rule: "compile-settled"` means the sustained in-budget frame window was not required,
|
|
288
|
+
* because the operator declared a software adapter: the wait still ran to full readiness, but
|
|
289
|
+
* a CPU rasteriser reaches it on the bounded window rather than on five sustained frames. A
|
|
290
|
+
* pass from such a run is not a smoothness measurement and must not be read as one, so the
|
|
291
|
+
* report says which rule applied rather than leaving a reader to assume the stricter one.
|
|
259
292
|
*/
|
|
260
293
|
startup?: {
|
|
261
294
|
compileSettled?: boolean;
|
package/dist/three/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Camera, Scene, Object3D, Vector2 } from 'three';
|
|
2
|
-
import { IPlaytestSampleRequest, IPlaytestObservationSnapshot, IPlaytestBridgeV1, JsonValue, IPlaytestGameplayObservation, IPlaytestRuntimeDiagnosticsSample, IPlaytestRenderChainObservation, IPlaytestStartupObservation, IPlaytestSceneObservation } from '../protocol.js';
|
|
2
|
+
import { IPlaytestSampleRequest, IPlaytestObservationSnapshot, IPlaytestBridgeV1, PlaytestClockMode, JsonValue, IPlaytestGameplayObservation, IPlaytestRuntimeDiagnosticsSample, IPlaytestRenderChainObservation, IPlaytestStartupObservation, IPlaytestSceneObservation } from '../protocol.js';
|
|
3
3
|
|
|
4
4
|
type RenderAdvisorOwner = "framework" | "generated-src";
|
|
5
5
|
type RenderAdvisorSeverity = "info" | "warning";
|
|
@@ -149,6 +149,15 @@ interface IThreePlaytestResources {
|
|
|
149
149
|
}
|
|
150
150
|
interface IThreePlaytestBridgeOptions {
|
|
151
151
|
camera: Camera;
|
|
152
|
+
/**
|
|
153
|
+
* The clock this producer is actually running on, reported verbatim in every observation.
|
|
154
|
+
*
|
|
155
|
+
* `wall-clock` is a producer that lets its own frame pump move the simulation, which is the only
|
|
156
|
+
* way to observe a game *playing*: on that clock `advance` delivers the span of wall time the tick
|
|
157
|
+
* count names and reports the ticks that clock really ran, instead of stepping the loop itself.
|
|
158
|
+
* A production profile asks for it; a deterministic scenario never does.
|
|
159
|
+
*/
|
|
160
|
+
clockMode?: PlaytestClockMode;
|
|
152
161
|
components?: () => Record<string, Record<string, JsonValue>>;
|
|
153
162
|
/**
|
|
154
163
|
* Runtime diagnostics for the current frame.
|
package/dist/three/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var SPRITE_FLOOR = 32;
|
|
|
10
10
|
var POINT_OBJECT_FLOOR = 16;
|
|
11
11
|
var VERIFIED_EXAMPLE_PATHS = {
|
|
12
12
|
gpuParticles: "examples/abyss-framework/src/scenes/Abyss.ts",
|
|
13
|
-
hudInstancing: "packages/create-threenative/templates/
|
|
13
|
+
hudInstancing: "packages/create-threenative/templates/rts/src/render/army.ts",
|
|
14
14
|
materialSharing: "packages/create-threenative/templates/starter/src/render/materials.ts",
|
|
15
15
|
staticMerge: "examples/native-cpu-load-test/src/main.ts"
|
|
16
16
|
};
|
|
@@ -824,7 +824,11 @@ function sampleThreeObservations(input, request) {
|
|
|
824
824
|
return {
|
|
825
825
|
clock: {
|
|
826
826
|
mode: input.clockMode,
|
|
827
|
-
...input.tick === void 0 ? { timeMs: performance.now() } : { tick: input.tick }
|
|
827
|
+
...input.tick === void 0 ? { timeMs: performance.now() } : { tick: input.tick },
|
|
828
|
+
// A live run is measured in seconds: the runner reads `timeMs` for any mode that is not
|
|
829
|
+
// fixed-step, so a wall-clock producer that reported only a tick would leave every
|
|
830
|
+
// seconds-based rate unmeasured rather than measured.
|
|
831
|
+
...input.clockMode === "wall-clock" ? { timeMs: performance.now() } : {}
|
|
828
832
|
},
|
|
829
833
|
...input.diagnostics === void 0 ? {} : { diagnostics: input.diagnostics() },
|
|
830
834
|
entities,
|
|
@@ -1219,6 +1223,7 @@ function installThreePlaytestBridge(options) {
|
|
|
1219
1223
|
if (options.physics !== void 0 && options.tick === void 0)
|
|
1220
1224
|
throw new Error("A physics provider requires the authoritative tick provider, and therefore fixedStep.");
|
|
1221
1225
|
const recorder = options.physics === void 0 ? void 0 : new ThreePlaytestPhysicsRecorder(options.physics);
|
|
1226
|
+
const clockMode = () => options.clockMode ?? (options.fixedStep === void 0 ? "render-frame" : "fixed-step");
|
|
1222
1227
|
const host = globalThis;
|
|
1223
1228
|
const previous = host[PLAYTEST_BRIDGE_GLOBAL];
|
|
1224
1229
|
const registry = new ThreePlaytestEntityRegistry();
|
|
@@ -1253,9 +1258,9 @@ function installThreePlaytestBridge(options) {
|
|
|
1253
1258
|
await options.fixedStep(ticks);
|
|
1254
1259
|
const tick = options.tick();
|
|
1255
1260
|
const advanced = tick - startTick;
|
|
1256
|
-
if (advanced !== ticks)
|
|
1257
|
-
throw new Error(`fixedStep advanced ${advanced} actual ticks; expected ${ticks}.`);
|
|
1258
|
-
return { clock: { mode:
|
|
1261
|
+
if (clockMode() === "wall-clock" ? advanced < 1 : advanced !== ticks)
|
|
1262
|
+
throw new Error(clockMode() === "wall-clock" ? `wall-clock advance moved no tick in ${ticks} step(s) of wall time; the host presented no frame.` : `fixedStep advanced ${advanced} actual ticks; expected ${ticks}.`);
|
|
1263
|
+
return { clock: { mode: clockMode(), tick }, ticks: advanced };
|
|
1259
1264
|
}
|
|
1260
1265
|
},
|
|
1261
1266
|
applySetup: async (request) => {
|
|
@@ -1286,7 +1291,7 @@ function installThreePlaytestBridge(options) {
|
|
|
1286
1291
|
syncEntities(registry, options.entities);
|
|
1287
1292
|
const snapshot = sampleThreeObservations({
|
|
1288
1293
|
camera: options.camera,
|
|
1289
|
-
clockMode:
|
|
1294
|
+
clockMode: clockMode(),
|
|
1290
1295
|
diagnostics: options.diagnostics,
|
|
1291
1296
|
gameplay: options.gameplay,
|
|
1292
1297
|
runtimeDiagnosticsSeries: options.runtimeDiagnosticsSeries,
|
package/package.json
CHANGED