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(debug): a connected build reports its hot-update status to the editor
esengine46b6c139fb4b
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 26f7b7ed8..11f40f6f8 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -16,6 +16,7 @@ published separately; it ships inside the editor.### Added+- Profiling a connected development build, the Profiler shows which content revision it runs, the one its next launch starts on, and a hot update it has found but not applied; `device_update_status` answers the same for an agent.- The build's size report shows the start screen on its own line — the markup and any logo inlined into index.html, which is on screen before anything else loads.- Connected development builds are named by the device they run on — `web (Chrome · Android)`, a phone's model on a mini-game — and numbered when two read alike, in the Profiler, Outliner, Frame Debugger and `device_targets`.- Profiling a connected development build, the Profiler's Frame section shows what its debug channel costs the device per frame (and `profile_frames` reports it as `channelMs`).diff --git a/desktop b/desktopindex 56301dad0..fbab1afff 160000--- a/desktop+++ b/desktop@@ -1 +1 @@-Subproject commit 56301dad010d44ae556dfbaa0b039efe24b21371+Subproject commit fbab1afff8faea87445fc8c6521288ed7e8d45dbdiff --git a/sdk/etc/index.api.md b/sdk/etc/index.api.mdindex 98f22b4b9..5d7ebbf81 100644--- a/sdk/etc/index.api.md+++ b/sdk/etc/index.api.md@@ -2737,6 +2737,7 @@ url: string| { t: 'query'; reqId: number; kind: 'frameCapture' }| { t: 'query'; reqId: number; kind: 'frameReplay'; drawIndex: number; maxSide?: number }| { t: 'query'; reqId: number; kind: 'stats' }+ | { t: 'query'; reqId: number; kind: 'updateStatus' }| { t: 'query'; reqId: number; kind: 'snapshot'; selectedId: number | null; withTree: boolean }| ({ t: 'query'; reqId: number; kind: 'control' } & DebugControl)```diff --git a/sdk/etc/index.native.api.md b/sdk/etc/index.native.api.mdindex beba0e414..536ee2e08 100644--- a/sdk/etc/index.native.api.md+++ b/sdk/etc/index.native.api.md@@ -2745,6 +2745,7 @@ url: string| { t: 'query'; reqId: number; kind: 'frameCapture' }| { t: 'query'; reqId: number; kind: 'frameReplay'; drawIndex: number; maxSide?: number }| { t: 'query'; reqId: number; kind: 'stats' }+ | { t: 'query'; reqId: number; kind: 'updateStatus' }| { t: 'query'; reqId: number; kind: 'snapshot'; selectedId: number | null; withTree: boolean }| ({ t: 'query'; reqId: number; kind: 'control' } & DebugControl)```diff --git a/sdk/etc/index.node.api.md b/sdk/etc/index.node.api.mdindex 02989c0f8..634456b3f 100644--- a/sdk/etc/index.node.api.md+++ b/sdk/etc/index.node.api.md@@ -2732,6 +2732,7 @@ url: string| { t: 'query'; reqId: number; kind: 'frameCapture' }| { t: 'query'; reqId: number; kind: 'frameReplay'; drawIndex: number; maxSide?: number }| { t: 'query'; reqId: number; kind: 'stats' }+ | { t: 'query'; reqId: number; kind: 'updateStatus' }| { t: 'query'; reqId: number; kind: 'snapshot'; selectedId: number | null; withTree: boolean }| ({ t: 'query'; reqId: number; kind: 'control' } & DebugControl)```diff --git a/sdk/etc/minigame.api.md b/sdk/etc/minigame.api.mdindex 2362ba8eb..e52cdc23e 100644--- a/sdk/etc/minigame.api.md+++ b/sdk/etc/minigame.api.md@@ -2732,6 +2732,7 @@ url: string| { t: 'query'; reqId: number; kind: 'frameCapture' }| { t: 'query'; reqId: number; kind: 'frameReplay'; drawIndex: number; maxSide?: number }| { t: 'query'; reqId: number; kind: 'stats' }+ | { t: 'query'; reqId: number; kind: 'updateStatus' }| { t: 'query'; reqId: number; kind: 'snapshot'; selectedId: number | null; withTree: boolean }| ({ t: 'query'; reqId: number; kind: 'control' } & DebugControl)```diff --git a/sdk/etc/wechat.api.md b/sdk/etc/wechat.api.mdindex 9fde8e114..342edf4b0 100644--- a/sdk/etc/wechat.api.md+++ b/sdk/etc/wechat.api.md@@ -2732,6 +2732,7 @@ url: string| { t: 'query'; reqId: number; kind: 'frameCapture' }| { t: 'query'; reqId: number; kind: 'frameReplay'; drawIndex: number; maxSide?: number }| { t: 'query'; reqId: number; kind: 'stats' }+ | { t: 'query'; reqId: number; kind: 'updateStatus' }| { t: 'query'; reqId: number; kind: 'snapshot'; selectedId: number | null; withTree: boolean }| ({ t: 'query'; reqId: number; kind: 'control' } & DebugControl)```diff --git a/sdk/src/runtime/debugChannel.ts b/sdk/src/runtime/debugChannel.tsindex fba97c366..0f8b5da80 100644--- a/sdk/src/runtime/debugChannel.ts+++ b/sdk/src/runtime/debugChannel.ts@@ -152,6 +152,10 @@ export function startDebugChannel(config: DebugChannelConfig): void {reply({ t: 'reply', reqId: q.reqId, data: { ...report, ...span } });return;}+ if (q.kind === 'updateStatus') {+ reply({ t: 'reply', reqId: q.reqId, data: game.hasResource(Assets) ? game.getResource(Assets).updateStatus() : null });+ return;+ }if (q.kind === 'snapshot') {reply({ t: 'reply', reqId: q.reqId, data: timed(() => worldSnapshot(game, q.selectedId, q.withTree)) });return;diff --git a/sdk/src/runtime/debugChannelProtocol.ts b/sdk/src/runtime/debugChannelProtocol.tsindex 2553eb925..4d49a40bd 100644--- a/sdk/src/runtime/debugChannelProtocol.ts+++ b/sdk/src/runtime/debugChannelProtocol.ts@@ -31,6 +31,7 @@ export type DebugChannelQuery =| { t: 'query'; reqId: number; kind: 'frameCapture' }| { t: 'query'; reqId: number; kind: 'frameReplay'; drawIndex: number; maxSide?: number }| { t: 'query'; reqId: number; kind: 'stats' }+ | { t: 'query'; reqId: number; kind: 'updateStatus' }| { t: 'query'; reqId: number; kind: 'snapshot'; selectedId: number | null; withTree: boolean }| ({ t: 'query'; reqId: number; kind: 'control' } & DebugControl);diff --git a/sdk/tests/debug-channel.test.ts b/sdk/tests/debug-channel.test.tsindex 4dc6c1c1a..99eb64738 100644--- a/sdk/tests/debug-channel.test.ts+++ b/sdk/tests/debug-channel.test.ts@@ -64,6 +64,28 @@ describe('the debug channel', () => {});});+describe('a device asked about its content', () => {+ it('answers with the revision it runs and what update is staged', async () => {+ vi.resetModules();+ const base = await import('../src/platform/base');+ const channel = await import('../src/runtime/debugChannel');+ const { Assets } = await import('../src/asset/AssetPlugin');+ const s = fakeSocket();+ base.setPlatform({ name: 'web', now: () => performance.now(), createSocket: () => s.socket } as unknown as PlatformAdapter);+ channel.startDebugChannel({ url: 'ws://editor:1/?token=t', project: 'Demo' });+ s.open();+ const status = { revision: 'bfdfdde', persistedRevision: null, staged: { revision: '2c4bd22', assets: 1, bytes: 208 }, applying: false };+ channel.attachDebugChannel({+ hasResource: (r: unknown) => r === Assets,+ getResource: () => ({ updateStatus: () => status, getManifest: () => null }),+ onFrameEnd: () => () => {},+ } as unknown as App);+ s.receive({ t: 'query', reqId: 11, kind: 'updateStatus' });+ await flush();+ expect(s.sent.find((m) => (m as { reqId?: number }).reqId === 11)).toEqual({ t: 'reply', reqId: 11, data: status });+ });+});+describe('a device in the background', () => {it('refuses a capture at once instead of waiting for a frame it will not draw', async () => {// The channel is one per process; this device needs its own.diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjsindex e60d2f1b7..3d80b9eff 100644--- a/tools/releaseNotes.mjs+++ b/tools/releaseNotes.mjs@@ -1122,4 +1122,8 @@ export const NOTED = {{ note: 'The build\'s size report shows the start screen on its own line — the markup and any logo inlined into index.html, which is on screen before anything else loads.' },'feat(build): the size panel names what the start screen weighs':{ note: 'The build\'s size report shows the start screen on its own line — the markup and any logo inlined into index.html, which is on screen before anything else loads.' },+ 'feat(debug): a connected build reports its hot-update status to the editor':+ { note: 'Profiling a connected development build, the Profiler shows which content revision it runs, the one its next launch starts on, and a hot update it has found but not applied; `device_update_status` answers the same for an agent.' },+ 'feat(profiler): a connected build says which content it runs and what update waits':+ { note: 'Profiling a connected development build, the Profiler shows which content revision it runs, the one its next launch starts on, and a hot update it has found but not applied; `device_update_status` answers the same for an agent.' },};