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(verify): a package can be asked what it decided, and the slot doors are held
esenginecd657ed68613
diff --git a/pipeline/src/runtime/gameHost.ts b/pipeline/src/runtime/gameHost.tsindex f312611ef..bb16568aa 100644--- a/pipeline/src/runtime/gameHost.ts+++ b/pipeline/src/runtime/gameHost.ts@@ -19,7 +19,7 @@ import {acquireWebGPUDevice, ThirdPersonCamera, CharacterController3D, AnimatorController,Animator, TPC_SPEED, TPC_GROUNDED, Particle, MeleeAttack, Health,Hunter, NavAgent, Perception, AnimatorRootMotion, Playthrough, Name,- worldResidencyReport,+ worldResidencyReport, PostProcess, Renderer,} from 'esengine';import type {SceneData, AddressableManifest, PackagedGameConfig, RenderSurfaceSource, WorldManifest,@@ -573,6 +573,37 @@ async function boot(): Promise<void> {return {};}},+ /**+ * The capability decisions the SHIPPING renderer committed to, asked of+ * the frame that drew rather than of the editor's account of what a build+ * would do. Those are two code paths, and an explanation that is right+ * about one nothing takes explains nothing.+ */+ renderFacts(): Record<string, unknown> {+ const post = app.hasResource(PostProcess) ? app.getResource(PostProcess) : null;+ return {+ backend: gpu.device ? 'webgpu' : 'webgl2',+ msaa: { requested: cfg.msaaSamples ?? null, ...(post?.msaaCapability() ?? {}) },+ hdr: post?.hdrFormat() ?? null,+ texture: app.getResource(Assets)?.textureFormatReport() ?? null,+ };+ },+ /**+ * The per-entity decisions a frame made about one named thing: which LOD+ * the view chose, whether the light cap kept it, what the shadow atlas+ * granted. Read through the same Renderer API the editor's panels use, so+ * a divergence here is the shipping path and not a second implementation.+ */+ decisions(name: string, view = 0): Record<string, unknown> | null {+ const entity = app.world.findEntityByName(name);+ if (entity === null) return null;+ return {+ entity,+ lod: Renderer.lodInspect(view, entity),+ light: Renderer.lightStatus(entity),+ shadow: Renderer.shadowStatus(entity),+ };+ },/*** Take the GPU away, and read what the renderer says about itself after.*diff --git a/tools/check-live-asset-rebind.mjs b/tools/check-live-asset-rebind.mjsindex c69f6c046..157cbf432 100644--- a/tools/check-live-asset-rebind.mjs+++ b/tools/check-live-asset-rebind.mjs@@ -257,8 +257,43 @@ if (loaders < 10) {process.exit(1);}+/**+ * 6. A slot takes an asset out through the door its loader HAS. Seven loaders+ * publish by name — a `registry` era and no `.load` — and `Assets.loadX`+ * rejects those, so the editor's live load threw for every timeline, tilemap,+ * tileset, state machine, behaviour tree, animator controller and anim clip.+ * The failure was recorded against the path and the preflight read it as a+ * reference resolving to nothing: three golden projects could not be built.+ * Ground truth (does the loader declare `.load`) against the declaration+ * (which door the slot calls), so neither can drift alone.+ */+const SLOTS = 'desktop/src/project/assetSlots.ts';+const byName = new Set();+for (const name of readdirSync(LOADERS_DIR).filter((f) => f.endsWith('.ts'))) {+ const code = stripComments(readFileSync(path.join(LOADERS_DIR, name), 'utf8'));+ const type = /readonly type = '([a-z-]+)'/.exec(code);+ if (!type) continue;+ const hasLoad = /^\s{4}(?:async )?load\(/m.test(code) || /^\s{4}load:/m.test(code);+ if (!hasLoad && /readonly registry/.test(code)) byName.add(type[1]);+}+if (byName.size === 0) {+ findings.push(`${LOADERS_DIR}: no name-publishing loader found — the parser no longer matches how they declare a registry.`);+} else if (existsSync(path.join(ROOT, SLOTS))) {+ const slots = stripComments(readFileSync(path.join(ROOT, SLOTS), 'utf8'));+ for (const type of byName) {+ const row = new RegExp(`['"]?${type}['"]?: \\{[^}]*\\}`).exec(slots);+ if (!row) {+ findings.push(`${SLOTS}: no slot for "${type}", which the preload acquires — a live load has no door.`);+ } else if (/\ba\.load[A-Z]/.test(row[0])) {+ findings.push(`${SLOTS}: the "${type}" slot loads through a load* door, and its loader publishes by name — acquire it through its slot.`);+ }+ }+} else {+ console.log(`check-live-asset-rebind: no editor checkout — ${SLOTS} was not read, so the ${byName.size} name-publishing slot(s) were not judged.`);+}+if (findings.length === 0) {- console.log(`check-live-asset-rebind: the rebind path reads the declaration for all ${components.size} asset-bearing components, acquires by receipt, asks one place who owns what, and each of the ${loaders} loaders has one door, owns nothing and declares no edges.`);+ console.log(`check-live-asset-rebind: the rebind path reads the declaration for all ${components.size} asset-bearing components, acquires by receipt, asks one place who owns what, and each of the ${loaders} loaders has one door, owns nothing and declares no edges; ${byName.size} name-publishing slot(s) acquire through theirs.`);process.exit(0);}for (const f of findings) console.error(f);diff --git a/tools/launchers/residency-run.mjs b/tools/launchers/residency-run.mjsindex 49a2a55b6..3e893316b 100644--- a/tools/launchers/residency-run.mjs+++ b/tools/launchers/residency-run.mjs@@ -20,8 +20,8 @@** A script is a list of steps: {do:"read",as}, {do:"walkTo",x,z},* {do:"tap",key}, {do:"step",frames}, {do:"stream",as,key,count},- * {do:"loseDevice",as}, {do:"readiness",as,cell}, {do:"counters",as}. Each read- * prints one JSON line.+ * {do:"loseDevice",as}, {do:"readiness",as,cell}, {do:"counters",as},+ * {do:"renderFacts",as}, {do:"decisions",as,name}. Each read prints one JSON line.*/import { app, BrowserWindow } from 'electron';import http from 'node:http';@@ -253,6 +253,19 @@ async function main() {console.log(`readiness ${step.as}: ${JSON.stringify({ claim, device })}`);continue;}+ if (step.do === 'renderFacts') {+ await settle();+ const facts = await exec('window.__estellaCooked.renderFacts()');+ console.log(`reading ${step.as}: ${JSON.stringify(facts)}`);+ continue;+ }+ if (step.do === 'decisions') {+ await settle();+ const d = await exec(+ `window.__estellaCooked.decisions(${JSON.stringify(step.name)}, ${step.view ?? 0})`);+ console.log(`reading ${step.as}: ${JSON.stringify(d)}`);+ continue;+ }if (step.do === 'counters') {// The PEAK across the window, not the last frame's. A cold compile happens// on one frame — the first one that shows the content — and a single