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
feat(export): a packaged game reports what it is still baking, and the capture launcher can wait for it
yhha26ffccec5b1
diff --git a/pipeline/src/runtime/gameHost.ts b/pipeline/src/runtime/gameHost.tsindex 94e781d99..00d3901f4 100644--- a/pipeline/src/runtime/gameHost.ts+++ b/pipeline/src/runtime/gameHost.ts@@ -20,7 +20,7 @@ import {Animator, TPC_SPEED, TPC_GROUNDED, Particle,AnimatorRootMotion, Playthrough, Name,worldResidencyReport, PostProcess, Renderer, Audio, Camera,- getComponentRegistry,+ getComponentRegistry, BakesRes,startDebugChannel, glContextAttributes,} from 'esengine';import { installDevicePreview } from './devicePreviewClient';@@ -891,6 +891,10 @@ async function boot(): Promise<void> {};},updateStatus: () => app.getResource(Assets).updateStatus(),+ /** What the engine is still baking in the background (the world laying itself out, plants growing): empty once it has caught up. */+ bakes(): readonly { label: string; progress: number }[] {+ return app.hasResource(BakesRes) ? app.getResource(BakesRes).active : [];+ },};// Each behind its OWN export. They are different ABIs now: readying a// prepared cell ships, and deriving the same from live entities is thediff --git a/tools/launchers/launch-export.mjs b/tools/launchers/launch-export.mjsindex 278001c0e..ef06b2fa0 100644--- a/tools/launchers/launch-export.mjs+++ b/tools/launchers/launch-export.mjs@@ -108,6 +108,8 @@ const W = Number(flag('w', '640'));const H = Number(flag('h', '360'));const SETTLE = Number(flag('settle', '30'));const INPUT = flag('input', '');+/** After the input, keep running until the engine has nothing left to bake, instead of guessing a frame count. */+const UNTIL_IDLE = has('until-idle');const TIMEOUT = Number(flag('timeout', '30000'));const LOG = flag('log', '');/** Emulate a link before loading, so the start screen is asked a real question. */@@ -342,6 +344,20 @@ const SCENE = flag('scene', '');console.log(` input: ${ran} source(s) over ${Number(spec.frames ?? 40)} frames`);}+ if (painted && UNTIL_IDLE) {+ // A few quiet polls in a row: a bake that has just finished can be followed by the one it queued.+ let quiet = 0, last = '';+ for (const t0 = Date.now(); quiet < 6 && Date.now() - t0 < TIMEOUT;) {+ await new Promise((r) => setTimeout(r, 250));+ const bakes = await win.webContents.executeJavaScript('window.__estellaCooked?.bakes?.() ?? []').catch(() => []);+ quiet = bakes.length === 0 ? quiet + 1 : 0;+ const now = bakes.map((b) => `${b.label} ${Math.round(b.progress * 100)}%`).join(', ');+ if (now !== last && now) console.log(` baking: ${now}`);+ last = now;+ }+ console.log(` idle: ${quiet >= 6}`);+ }+if (FACTS) {const seen = await win.webContents.executeJavaScript('window.__estellaCooked?.facts() ?? null',