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(project): a project file's settings that nothing reads are named
esengine38132c9e10ac
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 68b8a303c..bb3214a04 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -30,6 +30,7 @@ published separately; it ships inside the editor.- Importing a model converts its DDS textures to PNG — BC1 to BC5 and uncompressed, whether the file sits beside the model or inside an FBX — so a model shipped with DDS art arrives with every map instead of references nothing can load. BC5 normal maps get their Z rebuilt; BC6H and BC7 are named and skipped.- An FBX model's specular map can be read as packed occlusion, roughness and metalness (Specular Map → Packed ORM in its import settings, `--specular-map orm` on the command line), the way scenes authored for Falcor such as Bistro store it. Read as a colour, as before, it has no slot in metal/rough shading and is left out.- An FBX material takes its alpha from its base colour image, since FBX has no alpha mode: an image that is mostly clear where it is not solid imports as a cutout (alpha test 0.5), one that is mostly in between as blended, and one without a real alpha channel stays opaque. A material whose name ends in `.DoubleSided`, as Lumberyard-era exports such as Bistro mark it, draws both sides. Bistro's trees were leaf cards drawn opaque and one-sided — black squares with a few leaves on them.+- A project file's settings that nothing reads are named instead of dropped: opening the project in the editor and exporting from the command line both say which keys of `project.esproject` are ignored, and point a block written at the wrong level (a `rendering` beside `features` rather than inside it) to where it belongs. That misplaced block had left a linear, ACES project running in gamma with no tone curve and no word.- A model import says when a map's pixels contradict its slot: an occlusion map that is zero in every texel is left out with a warning, since it would take all ambient light from the surface, and a map that is one colour throughout is noted.- **Export profiles.** A project can name several exports of one target in `packaging.profiles` — a test and a production WeChat build, each with its own AppID, CDN root and development or shipping configuration, writing only what differs from the project's settings. The Build dialog creates, edits and deletes them per target, marking each setting a profile overrides with a reset that hands it back to the project; `estella export --profile <name>` and the agent's `export_game` build the same one, and the size history records which profile a build used.diff --git a/desktop b/desktopindex 7653e5c1a..c8a96e89f 160000--- a/desktop+++ b/desktop@@ -1 +1 @@-Subproject commit 7653e5c1a0354af5f095625cbce146116dcd126a+Subproject commit c8a96e89f4ce0144221d001bfaeb1f08c97f9ff8diff --git a/pipeline/bin/estella.mjs b/pipeline/bin/estella.mjsindex 0f053a472..90694a440 100644--- a/pipeline/bin/estella.mjs+++ b/pipeline/bin/estella.mjs@@ -823,11 +823,16 @@ const desktopTemplates = platform !== 'desktop' ? [] : (opts.templateconst { mod: fmt, cleanup: cleanupFmt } = await loadPipeline(path.join(PIPELINE, 'src', 'project', 'index.ts'), 'projectFormat.mjs');-const { parseManifest } = fmt;+const { parseManifest, ignoredManifestKeys } = fmt;// PARSED, not read by hand: the parser normalizes legacy platform ids and drops// values that could not be judged against. A setting read straight off the JSON// here is a second answer to what a project means.const manifest = parseManifest(project);+for (const { key, under } of ignoredManifestKeys(project)) {+ console.warn(under+ ? ` ! project.esproject: "${key}" belongs under "${under}" — ignored where it is`+ : ` ! project.esproject: "${key}" is not a project setting — ignored`);+}const { mod: exporter, cleanup: cleanupExport } = await loadPipeline(path.join(PIPELINE, 'src', 'export', 'exportGame.ts'), 'exportGame.mjs');diff --git a/pipeline/src/project/format.ts b/pipeline/src/project/format.tsindex 8925b2df6..873b8edae 100644--- a/pipeline/src/project/format.ts+++ b/pipeline/src/project/format.ts@@ -577,6 +577,39 @@ export interface OpenedProject {* the renderer must say so LOUDLY: a silently skipped mirror is exactly how* "cannot find module 'esengine'" shipped without a trace (issue #49). */stagingError?: string;+ /** Keys of `project.esproject` this format never reads (see {@link ignoredManifestKeys}). */+ ignoredKeys?: IgnoredManifestKey[];+}++/** A key of a project file that nothing reads; `under` names the block it belongs in. */+export interface IgnoredManifestKey {+ key: string;+ under?: 'features';+}++/** Records every key `parse` asks of the proxied object. */+function keysRead(target: object, parse: (o: object) => void): Set<string> {+ const read = new Set<string>();+ const note = (k: string | symbol): void => { if (typeof k === 'string') read.add(k); };+ parse(new Proxy(target, {+ get: (t, k, r) => { note(k); return Reflect.get(t, k, r); },+ has: (t, k) => { note(k); return Reflect.has(t, k); },+ }));+ return read;+}++/**+ * Top-level keys of a project file that {@link parseManifest} never reads, which+ * would otherwise drop a misplaced or misspelt setting silently. Taken from the+ * parser's own reads, so a newly added setting can never be reported.+ */+export function ignoredManifestKeys(raw: unknown): IgnoredManifestKey[] {+ if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return [];+ const top = keysRead(raw, (o) => parseManifest(o));+ const featureKeys = keysRead({}, (f) => parseManifest({ name: 'probe', features: f }));+ return Object.keys(raw)+ .filter((key) => !top.has(key))+ .map((key) => (featureKeys.has(key) ? { key, under: 'features' as const } : { key }));}/** A directory entry from a sandboxed readdir. */diff --git a/pipeline/src/project/readProject.ts b/pipeline/src/project/readProject.tsindex b0d5b68ef..a5a8505f5 100644--- a/pipeline/src/project/readProject.ts+++ b/pipeline/src/project/readProject.ts@@ -14,6 +14,7 @@ import {WORKSPACE_DIR,WORKSPACE_FILE,parseManifest,+ ignoredManifestKeys,type ProjectManifest,type OpenedProject,type WorkspaceState,@@ -30,18 +31,24 @@ export async function readTextInRoot(abs: string): Promise<string> {return text.charCodeAt(0) === 0xfeff ? text.slice(1) : text;}-/** Require + parse a project's `project.esproject` manifest (no workspace load). */-export async function readManifest(root: string): Promise<ProjectManifest> {+async function readManifestJson(root: string): Promise<unknown> {const manifestPath = path.join(root, PROJECT_MANIFEST_FILE);if (!existsSync(manifestPath)) {throw new Error(`not an Estella project (missing ${PROJECT_MANIFEST_FILE}): ${root}`);}- return parseManifest(JSON.parse(await readTextInRoot(manifestPath)));+ return JSON.parse(await readTextInRoot(manifestPath));+}++/** Require + parse a project's `project.esproject` manifest (no workspace load). */+export async function readManifest(root: string): Promise<ProjectManifest> {+ return parseManifest(await readManifestJson(root));}/** Open a project: require + parse `project.esproject`, load workspace if present. */export async function openProject(root: string): Promise<OpenedProject> {- const manifest = await readManifest(root);+ const raw = await readManifestJson(root);+ const manifest = parseManifest(raw);+ const ignoredKeys = ignoredManifestKeys(raw);let workspace: WorkspaceState = {};const wsPath = path.join(root, WORKSPACE_DIR, WORKSPACE_FILE);@@ -52,5 +59,5 @@ export async function openProject(root: string): Promise<OpenedProject> {// A corrupt workspace file is non-fatal — start clean.}}- return { root, manifest, workspace };+ return { root, manifest, workspace, ...(ignoredKeys.length > 0 ? { ignoredKeys } : {}) };}diff --git a/pipeline/tests/manifest-ignored-keys.test.ts b/pipeline/tests/manifest-ignored-keys.test.tsnew file mode 100644index 000000000..92718e037--- /dev/null+++ b/pipeline/tests/manifest-ignored-keys.test.ts@@ -0,0 +1,38 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+/**+ * @file A project file's settings that nothing reads are named, not dropped.+ */+import { describe, it, expect } from 'vitest';+import { readdirSync, readFileSync, existsSync } from 'node:fs';+import path from 'node:path';+import { ignoredManifestKeys } from '../src/project/format';++const ROOT = path.resolve(__dirname, '../..');++describe('keys a project file carries that nothing reads', () => {+ it('names a features block written beside features instead of in it', () => {+ expect(ignoredManifestKeys({+ name: 'Bistro', formatVersion: '1',+ rendering: { colorSpace: 'linear', outputTransform: 'aces' },+ })).toEqual([{ key: 'rendering', under: 'features' }]);+ });++ it('names a misspelt key', () => {+ expect(ignoredManifestKeys({ name: 'x', desginResolution: { width: 1, height: 1 } }))+ .toEqual([{ key: 'desginResolution' }]);+ });++ it('finds nothing in any project the repository ships', () => {+ const found: Record<string, unknown> = {};+ for (const dir of ['examples', 'templates']) {+ for (const name of readdirSync(path.join(ROOT, dir))) {+ const file = path.join(ROOT, dir, name, 'project.esproject');+ if (!existsSync(file)) continue;+ const ignored = ignoredManifestKeys(JSON.parse(readFileSync(file, 'utf8')));+ if (ignored.length > 0) found[`${dir}/${name}`] = ignored;+ }+ }+ expect(found).toEqual({});+ });+});diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjsindex e3031c8f4..5beb6d684 100644--- a/tools/releaseNotes.mjs+++ b/tools/releaseNotes.mjs@@ -1246,6 +1246,10 @@ export const NOTED = {{ note: 'Normal, roughness/metalness and occlusion maps are sampled as data' },'fix(import): a model\'s data maps reach their .meta as not sRGB':{ note: 'Normal, roughness/metalness and occlusion maps are sampled as data' },+ 'feat(project): a project file\'s settings that nothing reads are named':+ { note: 'A project file\'s settings that nothing reads are named instead of dropped' },+ 'feat(project): opening a project names the settings its file carries that nothing reads':+ { note: 'A project file\'s settings that nothing reads are named instead of dropped' },'fix(eht): the generator writes LF on every platform':{ internal: 'The engine header tool is a repository generator; on Windows it rewrote every generated file with CRLF, which only a contributor there ever saw.' },};