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): the size report says what the start screen weighs
esengine4219281ab2cb
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 9c3a92573..26f7b7ed8 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -16,6 +16,7 @@ published separately; it ships inside the editor.### Added+- 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`).- In the Outliner, a connected development build's world can be shown instead of this editor's (read-only, with live values in Details).diff --git a/desktop b/desktopindex a2a1535d2..56301dad0 160000--- a/desktop+++ b/desktop@@ -1 +1 @@-Subproject commit a2a1535d286e9bcc4e3e33b81b7352465dd61846+Subproject commit 56301dad010d44ae556dfbaa0b039efe24b21371diff --git a/pipeline/src/export/exportGame.ts b/pipeline/src/export/exportGame.tsindex f2b3cfab2..eb8b7eeab 100644--- a/pipeline/src/export/exportGame.ts+++ b/pipeline/src/export/exportGame.ts@@ -279,6 +279,8 @@ export interface ExportGameResult {packageFile?: string;/** Playable: what the single file is made of. See ExportPlayableResult. */inlineParts?: { path: string; bytes: number }[];+ /** The start screen written into the host page, logo included. */+ splashBytes?: number;/** What the package weighs, and how it fared against the limits in force.* Absent when the export failed, or when measuring itself did. */size?: BuildSizeReport;@@ -636,6 +638,7 @@ async function attachSizeReport(result: ExportGameResult, opts: ExportGameOptionpackages,subPackageRoots: result.subPackageRoots,inlineOf: result.inlineParts ? { file: 'index.html', parts: result.inlineParts } : undefined,+ splashBytes: result.splashBytes,inclusion: result.inclusion,packedFrom: result.packedFrom,// The project, not the build: what this target weighed last time lives with@@ -1065,9 +1068,11 @@ async function produceExport(opts: ExportGameOptions): Promise<ExportGameResult>// 5. Host page + entry-scene config. Only where a BROWSER boots the game: a// native target has no page, and saying it wrote one is a progress line that// reports work nothing did.+ let splashBytes: number | undefined;if (!nativeContent) {progress({ phase: 'Writing host page' });const look = await splashLook(opts.root, opts.splash, warnings);+ splashBytes = Buffer.byteLength(splashCss(look.background ?? PAGE_BACKGROUND) + splashHtml(title, look));await writeFile(path.join(payloadDir, 'index.html'),indexHtml(title, engineMap, look, platform === 'web' ? orientation : undefined, debugChannel),@@ -1224,5 +1229,6 @@ async function produceExport(opts: ExportGameOptions): Promise<ExportGameResult>...(apkFile ? { apkFile } : {}), ...(aabFile ? { aabFile } : {}),...(appBundles.length > 0 ? { appBundles } : {}),...(steamChecklist ? { steamChecklist } : {}),+ ...(splashBytes !== undefined ? { splashBytes } : {}),};}diff --git a/pipeline/src/export/sizeReport.ts b/pipeline/src/export/sizeReport.tsindex 745afaa83..99c9c36e4 100644--- a/pipeline/src/export/sizeReport.ts+++ b/pipeline/src/export/sizeReport.ts@@ -112,6 +112,9 @@ export interface BuildSizeReport {* limit is judged on packed bytes, so `bytes` everywhere else is the packed* number and this is the only place the other one appears. */packing?: { fromBytes: number; toBytes: number; fileCount: number };+ /** The start screen inside the host page, which is on screen before anything+ * else loads. Absent for a target whose host draws its own. */+ splashBytes?: number;}/** How many files the report names individually. Enough to find the offender,@@ -463,6 +466,7 @@ export async function measureBuild(opts: {* place anyone looks for them afterwards.*/packedFrom?: Readonly<Record<string, number>>;+ splashBytes?: number;}): Promise<BuildSizeReport> {const excluded: string[] = [];for (const file of opts.packages ?? []) {@@ -520,6 +524,7 @@ export async function measureBuild(opts: {deliverableBytes,deliverableName: opts.deliverable ? path.basename(opts.deliverable) : undefined,});+ if (opts.splashBytes !== undefined) report.splashBytes = opts.splashBytes;if (opts.history) {const record = recordOf(report, opts.platform, opts.history.settings, entries);diff --git a/pipeline/tests/export-splash.test.ts b/pipeline/tests/export-splash.test.tsindex 3c81a1ad7..5749942b9 100644--- a/pipeline/tests/export-splash.test.ts+++ b/pipeline/tests/export-splash.test.ts@@ -50,7 +50,7 @@ beforeAll(() => {afterAll(() => rmSync(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }));/** Export for web and hand back the page plus whatever the build said about it. */-async function page(splash?: ProjectPackaging['splash']): Promise<{ html: string; warnings: string[] }> {+async function page(splash?: ProjectPackaging['splash']): Promise<{ html: string; warnings: string[]; splashBytes?: number }> {const outDir = path.join(root, `dist-${Math.random().toString(36).slice(2)}`);const res = await exportGame({root,@@ -65,10 +65,18 @@ async function page(splash?: ProjectPackaging['splash']): Promise<{ html: stringsplash,});expect(res.ok, res.errors.join('\n')).toBe(true);- return { html: readFileSync(path.join(outDir, 'index.html'), 'utf8'), warnings: res.warnings };+ return { html: readFileSync(path.join(outDir, 'index.html'), 'utf8'), warnings: res.warnings, splashBytes: res.size?.splashBytes };}describe('the exported page’s start screen', () => {+ it('has its own line in the size report, logo included', async () => {+ const plain = await page();+ const withLogo = await page({ logo: 'assets/logo.png' });+ expect(plain.splashBytes).toBeGreaterThan(0);+ expect(plain.html.length).toBeGreaterThan(plain.splashBytes!);+ expect(withLogo.splashBytes! - plain.splashBytes!).toBeGreaterThanOrEqual(Math.floor(PNG.length * 4 / 3));+ }, 180_000);+it('is there with nothing configured, showing the game’s name', async () => {const { html } = await page();expect(html).toContain('id="es-splash"');diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjsindex 36c5d282a..e60d2f1b7 100644--- a/tools/releaseNotes.mjs+++ b/tools/releaseNotes.mjs@@ -1118,4 +1118,8 @@ export const NOTED = {{ note: '`createButton({ userGesture: true })` runs its click inside the host\'s own release event: on a WeChat phone, sharing a recording from a button was refused ("require user interaction (only in touchend event)"), because a click ran on the frame after the tap.' },'fix(minigame): the pixel ratio is read once, not on every frame':{ note: 'A mini-game reads the host\'s pixel ratio once and again after a resize, instead of calling getSystemInfoSync several times a frame (on vivo, a synchronous call across its bridge each time).' },+ 'feat(export): the size report says 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(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.' },};