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.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix(gates): a prewarmed realm is not a playing one
yhhc5e6167fe959
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 36164862c..9b92bcd84 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -278,6 +278,11 @@ published separately; it ships inside the editor.which of the two it is now, and the driver every editor check goes through asks beforeit probes, so a realm that never came up fails by name.+ What it asks for is the pair, `playing` AND `ready`, which is what the door's own+ settle asks: a realm prewarms in an iframe once a project opens, so `ready` alone is+ answered by one that is not playing — and `step` sent to that advances the EDIT world,+ in the editor's own renderer rather than the game's.+Four checks had each grown a poll of their own against exactly this, with a differentbound each; they share the driver's now. `starter-3d`, the one that had none, was theone that lost the run. It also settles the character in FRAMES rather than in secondsdiff --git a/desktop/scripts/editor-checks/starter-3d.mjs b/desktop/scripts/editor-checks/starter-3d.mjsindex ced5300a6..442ce62f5 100644--- a/desktop/scripts/editor-checks/starter-3d.mjs+++ b/desktop/scripts/editor-checks/starter-3d.mjs@@ -39,9 +39,6 @@ export async function run(ed) {await ed.sleep(800);await ed.play('playing', 180000);- // Settled in FRAMES, not in wall-clock: the realm's loop is throttled while the- // editor window is unfocused, so what a sleep buys is a question about the- // machine rather than about the character.// Few of them, and generously waited for: a frame of a lit 3D scene costs the// best part of a second on the software rasteriser a check runner draws with,// and the character starts at rest height — this is "the solver has run".diff --git a/desktop/scripts/lib/editorDriver.mjs b/desktop/scripts/lib/editorDriver.mjsindex 970773876..2bf2dbc15 100644--- a/desktop/scripts/lib/editorDriver.mjs+++ b/desktop/scripts/lib/editorDriver.mjs@@ -205,7 +205,12 @@ export async function withEditor(body, opts = {}) {* probes a realm that is not there. Here a realm that never came up fails by name.*/play: async (state = 'playing', ms = 120000) => {- const up = (s) => (state === 'stopped' ? s?.playing === false : s?.ready === true);+ // BOTH, as the door's own settle asks: a realm prewarms in an iframe once a+ // project opens, so `ready` alone is answered by one that is not playing —+ // and `step` sent to THAT drives the edit world, in the editor's own renderer.+ const up = (s) => (state === 'stopped'+ ? s?.playing === false+ : s?.playing === true && s?.ready === true);const reached = await editor.json('set_play', { state }, ms);let last = reached;for (let i = 0; i < 40 && !up(last); i++) {@@ -213,8 +218,8 @@ export async function withEditor(body, opts = {}) {last = await editor.json('get_play_state', {});}if (!up(last)) {- throw new Error(`the play realm never reported ${state === 'stopped' ? 'stopped' : 'ready'}`- + ` — set_play answered ${JSON.stringify(reached)}`);+ throw new Error(`the play realm never reported ${state === 'stopped' ? 'stopped' : 'playing and ready'}`+ + ` — set_play answered ${JSON.stringify(reached)}, and it is now ${JSON.stringify(last)}`);}return last;},