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(editor): Play registers every project scene — play == ship
esengine4b791c5af356
diff --git a/desktop/src/engine/playProtocol.ts b/desktop/src/engine/playProtocol.tsindex cbca7694f..133b008f5 100644--- a/desktop/src/engine/playProtocol.ts+++ b/desktop/src/engine/playProtocol.ts@@ -53,6 +53,12 @@ export interface PlayNetConfig {export interface PlayPayload {sceneData: SceneData;assetManifest: Record<string, string>;+ /** Export name of the entry scene (scenes-dir-relative, sans extension), so+ * switchTo back to it works exactly as in a shipped build. Absent = '__play'. */+ entrySceneName?: string;+ /** Every other project scene, registered lazily by project-relative path —+ * the same switchTo targets a shipped build exposes (play == ship). */+ extraScenes?: Array<{ name: string; path: string }>;/** Project-declared physics enable (features.physics) — forwarded to the realm. */physicsEnabled?: boolean;/** Project physics world config (gravity, solver, collision matrix) — forwarded. */diff --git a/desktop/src/playHost.ts b/desktop/src/playHost.tsindex 64148d6b3..4721a6ff2 100644--- a/desktop/src/playHost.ts+++ b/desktop/src/playHost.ts@@ -204,6 +204,10 @@ async function buildAppAndRun(msg: InitMessage): Promise<void> {canvas,sceneData: msg.sceneData,assetManifest: msg.assetManifest,+ // Play == ship: the entry keeps its export name and every sibling scene+ // registers lazily by path, so runtime switchTo works like a shipped build.+ entrySceneName: msg.entrySceneName,+ extraScenes: msg.extraScenes,// playSFX/playBGM take project-relative paths — resolve them against the project root.assetBaseUrl: projectBase,// physics.wasm is served next to esengine.wasm; load it on demand.diff --git a/desktop/src/project/ProjectStore.ts b/desktop/src/project/ProjectStore.tsindex afd5fa5df..55e6c6550 100644--- a/desktop/src/project/ProjectStore.ts+++ b/desktop/src/project/ProjectStore.ts@@ -1066,6 +1066,8 @@ class ProjectStoreImpl {playPayload(): {sceneData: SceneData;assetManifest: Record<string, string>;+ entrySceneName?: string;+ extraScenes?: Array<{ name: string; path: string }>;physicsEnabled?: boolean;physicsConfig?: PhysicsPluginConfig;audioConfig?: AudioProjectConfig;@@ -1081,6 +1083,24 @@ class ProjectStoreImpl {// same-origin estella:// — no cross-scheme dance needed.const assetManifest: Record<string, string> = {};for (const [uuid, path] of this.uuidToPath) assetManifest[uuid] = `estella://project/${path}`;+ // Play == ship: register every other project scene under its export name+ // (scenes-dir-relative path sans extension — the same rule exportGame's+ // discoverProjectScenes uses), so SceneManager.switchTo('levels/boss')+ // behaves in Play exactly as in a shipped build. The open scene's live+ // snapshot is the entry and takes its export name too.+ const st = this.state;+ const scenesDir = (st?.layout.scenes ?? 'assets/scenes').replace(/\\/g, '/');+ const exportSceneName = (p: string): string => {+ const rel = p.startsWith(`${scenesDir}/`) ? p.slice(scenesDir.length + 1) : p;+ return rel.replace(/\.esscene$/i, '');+ };+ const currentScene = st?.currentScene?.replace(/\\/g, '/') ?? null;+ const extraScenes: Array<{ name: string; path: string }> = [];+ for (const p of this.uuidToPath.values()) {+ const q = p.replace(/\\/g, '/');+ if (!/\.esscene$/i.test(q) || q === currentScene) continue;+ extraScenes.push({ name: exportSceneName(q), path: q });+ }// Carry the project's physics world config so the realm installs physics (even for// runtime-spawned bodies the static scene doesn't show) and matches the editor's// Project Settings. The collision matrix is sent ONLY when configured — otherwise@@ -1111,6 +1131,8 @@ class ProjectStoreImpl {const uiThemeOverrides = this.uiThemeOverrides();return {sceneData, assetManifest, physicsEnabled: f.enabled, physicsConfig,+ ...(currentScene ? { entrySceneName: exportSceneName(currentScene) } : {}),+ ...(extraScenes.length > 0 ? { extraScenes } : {}),...(audioConfig.buses ? { audioConfig } : {}),...(uiTheme === 'light' ? { uiTheme } : {}),...(uiThemeOverrides ? { uiThemeOverrides } : {}),