Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(gates): a package is judged at one frame of game time per rendered frame

esengine903d05f89d51
diff --git a/tools/launchers/launch-export.mjs b/tools/launchers/launch-export.mjs
index 04d02f7c5..608277230 100644
--- a/tools/launchers/launch-export.mjs
+++ b/tools/launchers/launch-export.mjs
@@ -41,9 +41,10 @@
* --gameplay p[,c] after settling, print what the third-person character
* IS: where it stands, what the physics step gave it, and
* what its animator was told
- * --frame-ms <n> every rendered frame advances the game's clock by exactly n ms,
- * so what a gesture held for N frames did does not depend on
- * how fast this machine draws
+ * --frame-ms <n> every rendered frame advances the game's clock by exactly n ms
+ * (default one 60 Hz frame; 0 = the wall clock), so what N
+ * frames of a package did does not depend on how fast this
+ * machine draws
* --log <regex> also print console lines matching this (the engine's own
* warnings say why a subsystem sat out; only `[engine]`
* lines are forwarded otherwise, which means diagnosing
@@ -184,7 +185,7 @@ const AI = flag('ai', '');
const RENDER = has('render');
/** Boot a named scene from the package instead of its entry. */
const SCENE = flag('scene', '');
- const server = await serve(DIR, flag('safe-area', ''), Number(flag('frame-ms', '0')));
+ const server = await serve(DIR, flag('safe-area', ''), Number(flag('frame-ms', String(1000 / 60))));
const query = new URLSearchParams();
if (PROBE || GAMEPLAY || PARTICLES || COMBAT || AI || RENDER || FACTS || STREAMING) query.set('headless', '');
if (SCENE) query.set('scene', SCENE);
diff --git a/tools/verify-third-person.mjs b/tools/verify-third-person.mjs
index 0fd419d27..2e3fbcfed 100644
--- a/tools/verify-third-person.mjs
+++ b/tools/verify-third-person.mjs
@@ -31,10 +31,6 @@ const PROJECT = path.join(ROOT, 'examples', 'third-person-3d');
const LAUNCHER = path.join(ROOT, 'tools', 'launchers', 'launch-export.mjs');
const W = 960, H = 640;
-/** One rendered frame of game time, whatever the machine: a gesture is held for
- * frames, and at a runner's 1.4 s a frame the loop's 0.25 s cap walked the
- * character fifteen times further than the gym is long. */
-const FRAME_MS = String(1000 / 60);
/** Frames of strafe per lane: the character covers moveSpeed/60 a frame. */
const TO_LANE = { wall: 75, step: 75, highStep: 150 };
@@ -73,7 +69,7 @@ function reading(stdout, label) {
* `undefined` — so it stops here and says what the launcher did print.
*/
function launch(args, label) {
- const r = runElectron([LAUNCHER, '--frame-ms', FRAME_MS, ...args], { encoding: 'utf8', cwd: ROOT });
+ const r = runElectron([LAUNCHER, ...args], { encoding: 'utf8', cwd: ROOT });
if (!reading(r.stdout, label)) {
console.error(`✗ third-person: a launch printed no ${label} reading, so no game ran to judge`);
for (const l of `${r.stderr ?? ''}${r.stdout ?? ''}`.trim().split('\n').slice(-12)) {