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
fix(ci): the static gates earlier reds hid pass again
yhh45b28dbf92b8
diff --git a/desktop b/desktopindex d9e726a94..97228850c 160000--- a/desktop+++ b/desktop@@ -1 +1 @@-Subproject commit d9e726a94c4add22e87b21b9741d5a05d347b13c+Subproject commit 97228850c13c29d35d8f53651ed6df9417f78ee8diff --git a/docs/astro/src/data/apiStability.generated.json b/docs/astro/src/data/apiStability.generated.jsonindex b0daabccd..b814eab17 100644--- a/docs/astro/src/data/apiStability.generated.json+++ b/docs/astro/src/data/apiStability.generated.json@@ -3,10 +3,10 @@"counts": {"public": 115,"beta": 171,- "experimental": 2388,+ "experimental": 2517,"deprecated": 3},- "total": 2674,+ "total": 2803,"subsystems": [{"id": "mobile-controls",@@ -398,10 +398,11 @@"title": "Water","titleZh": "水体","tier": "experimental",- "why": "the surface draws and its waves are shared with the CPU, but only an ocean and a rectangular lake exist so far, and nothing floats or swims in it yet",- "whyZh": "水面能画出来,波浪也和 CPU 共用同一个公式,但目前只有海洋和矩形湖泊,还没有东西能漂浮或游泳",+ "why": "oceans, lakes and rivers are baked into one zone and drawn as one surface the CPU reads back, and things float on it, but the field and its shading are still settling and nothing swims yet",+ "whyZh": "海洋、湖泊和河流烘焙进同一个水体区域、画成一张水面,CPU 读到的就是画出来的那一面,也能漂浮物体;但区域场和着色还在定型,还没有东西能游泳","entry": ["WaterBody",+ "WaterZone","Waters"]},diff --git a/pipeline/tests/asset-exclude.test.ts b/pipeline/tests/asset-exclude.test.tsindex 9ebefe078..d8b8e17b0 100644--- a/pipeline/tests/asset-exclude.test.ts+++ b/pipeline/tests/asset-exclude.test.ts@@ -15,7 +15,7 @@ import { parseManifest } from '../src/project/format';let root: string;beforeEach(() => { root = mkdtempSync(path.join(tmpdir(), 'estella-exclude-')); });-afterEach(() => { rmSync(root, { recursive: true, force: true }); });+afterEach(() => { rmSync(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }); });function put(rel: string, body = 'x'): void {const abs = path.join(root, rel);diff --git a/sdk/src/core-content.ts b/sdk/src/core-content.tsindex 29e09cc8d..001f5cce8 100644--- a/sdk/src/core-content.ts+++ b/sdk/src/core-content.ts@@ -796,8 +796,9 @@ export {// Terrain and Foliage are optional modules (`esengine/terrain`, `esengine/foliage` install them). Their API stays reachable from// here: a shared chunk is side-effect-free, so what nothing uses is not bundled.export {- Terrain, TerrainExtent, Terrains, TerrainsRes, TerrainPlugin, terrainPlugin, paintWeights, NOISE_PROVIDER, type TerrainData, type TerrainStatus,+ Terrain, TerrainExtent, Terrains, TerrainsRes, TerrainPlugin, terrainPlugin, NOISE_PROVIDER, type TerrainData, type TerrainStatus,} from './terrain/terrainPlugin';+export { paintWeights } from './terrain/paint';export {Foliage, FoliageField, FoliageRes, FoliagePlugin, foliagePlugin, type FoliageData,} from './foliage/foliagePlugin';diff --git a/sdk/src/terrain/index.ts b/sdk/src/terrain/index.tsindex ff29b00a9..41fa696b2 100644--- a/sdk/src/terrain/index.ts+++ b/sdk/src/terrain/index.ts@@ -1,7 +1,7 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamexport {- Terrain, TerrainExtent, Terrains, TerrainsRes, TerrainPlugin, terrainPlugin, paintWeights, NOISE_PROVIDER, type TerrainData, type TerrainStatus,+ Terrain, TerrainExtent, Terrains, TerrainsRes, TerrainPlugin, terrainPlugin, NOISE_PROVIDER, type TerrainData, type TerrainStatus,} from './terrainPlugin';export {erodeHeightfield, erosionJob, heightfieldFromPixels, HeightmapFormat, proceduralHeightfield, sampleHeight, terrainNormal,@@ -22,3 +22,4 @@ export {import { registerTerrainSupport } from './terrainSupport';registerTerrainSupport();+export { paintWeights } from './paint';diff --git a/sdk/src/terrain/paint.ts b/sdk/src/terrain/paint.tsnew file mode 100644index 000000000..c36545882--- /dev/null+++ b/sdk/src/terrain/paint.ts@@ -0,0 +1,23 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+/**+ * @file paint.ts+ * @brief Which paint a point of ground takes, by how high and how steep it is.+ */+import type { TerrainData } from './terrainPlugin';++const smooth = (a: number, b: number, x: number): number => {+ const t = Math.min(Math.max((x - a) / (b - a || 1e-6), 0), 1);+ return t * t * (3 - 2 * t);+};++/** The weights of grass, dirt, snow and rock at a point of ground, by how high (0 to 1 of the terrain) and how steep it is. */+export function paintWeights(h: number, ny: number, t: Pick<TerrainData, 'rockSlope' | 'dirtHeight' | 'snowHeight'>): [number, number, number, number] {+ const rock = smooth(t.rockSlope - 0.08, t.rockSlope + 0.08, 1 - ny);+ const snow = smooth(t.snowHeight - 0.06, t.snowHeight + 0.06, h) * (1 - rock * 0.85);+ const dirt = smooth(t.dirtHeight - 0.15, t.dirtHeight + 0.15, h) * (1 - snow) * (1 - rock);+ const grass = (1 - rock) * (1 - snow) * (1 - dirt);+ const sum = grass + dirt + snow + rock || 1;+ return [grass / sum, dirt / sum, snow / sum, rock / sum];+}+diff --git a/sdk/src/terrain/source.ts b/sdk/src/terrain/source.tsindex fc6b2f685..c2d20cd60 100644--- a/sdk/src/terrain/source.ts+++ b/sdk/src/terrain/source.ts@@ -13,7 +13,8 @@* be run over ground that has no edge, so its wear is the noise's own: each octave is damped where the octaves under it are* already steep, which leaves smooth valleys between sharp ridges and gullies down the slopes.*/-import { paintWeights, type TerrainData } from './terrainPlugin';+import { paintWeights } from './paint';+import type { TerrainData } from './terrainPlugin';import { sampleHeight, terrainNormal, type Heightfield } from './heightfield';/** The ground a terrain draws, as the pages and the CPU read it. */diff --git a/sdk/src/terrain/terrainPlugin.ts b/sdk/src/terrain/terrainPlugin.tsindex 1c8a630ea..2f63b8dc2 100644--- a/sdk/src/terrain/terrainPlugin.ts+++ b/sdk/src/terrain/terrainPlugin.ts@@ -19,7 +19,7 @@ import type { App, Plugin } from '../app/app';import { defineSystem, Schedule } from '../ecs/system';import { defineResource } from '../ecs/resource';import {- defineComponent, Camera, MeshRenderer, Transform,+ defineComponent, getComponent, Camera, MeshRenderer, Transform,type ComponentDef, type CameraData, type MeshRendererData, type TransformData,} from '../ecs/component';import { Assets } from '../asset/AssetPlugin';@@ -38,6 +38,7 @@ import { bakesOf } from '../runtime/bakes';import type { Color, Entity } from '../types';import { erosionJob, heightfieldFromPixels, HeightmapFormat, type Heightfield } from './heightfield';import { findGroundPath, type ReachOptions, type ReachResult } from './reach';+import { paintWeights } from './paint';import { FieldSource, ModifiedSource, type TerrainModifier, type TerrainSource } from './source';import { levelRange, nodeKey, parentOf, selectNodes, type QuadtreeParams, type TerrainNode } from './quadtree';import { makePage, PageTable, PAGE_SIDE, PAGE_TEXELS, PATCH_CELLS, type PageImage, type Repaint } from './pages';@@ -48,7 +49,6 @@ import { packLayers, type LayerImage, type LayerSource, type TerrainLayerDef } fimport { TerrainSurface, TILE_CELLS, type SurfaceTile } from './surface';import { collisionGeometryOf } from '../runtime/collisionGeometry';import { chunksOf, ProceduralChunksRes, type ChunkSource } from '../residency/chunks';-import { CharacterController3D, RigidBody3D, type RigidBody3DData } from '../physics3d/Physics3DComponents';/** The engine's own provider of ground without end: seeded noise of the world's position. */export const NOISE_PROVIDER = 'estella:noise';@@ -176,21 +176,6 @@ export const Terrain: ComponentDef<TerrainData> = defineComponent<TerrainData>('},});-const smooth = (a: number, b: number, x: number): number => {- const t = Math.min(Math.max((x - a) / (b - a || 1e-6), 0), 1);- return t * t * (3 - 2 * t);-};--/** The weights of grass, dirt, snow and rock at a point of ground, by how high (0 to 1 of the terrain) and how steep it is. */-export function paintWeights(h: number, ny: number, t: Pick<TerrainData, 'rockSlope' | 'dirtHeight' | 'snowHeight'>): [number, number, number, number] {- const rock = smooth(t.rockSlope - 0.08, t.rockSlope + 0.08, 1 - ny);- const snow = smooth(t.snowHeight - 0.06, t.snowHeight + 0.06, h) * (1 - rock * 0.85);- const dirt = smooth(t.dirtHeight - 0.15, t.dirtHeight + 0.15, h) * (1 - snow) * (1 - rock);- const grass = (1 - rock) * (1 - snow) * (1 - dirt);- const sum = grass + dirt + snow + rock || 1;- return [grass / sum, dirt / sum, snow / sum, rock / sum];-}-/** The side of the atlases the pages are kept in, in texels: 900 pages of 67 by 67. */const ATLAS_SIZE = 2048;/** The most layers a terrain draws: two paint atlases of four weights. */@@ -546,15 +531,21 @@ function movers(app: App): ChunkSource[] {const world = app.world;world.ensureTransformsComposed();const out: ChunkSource[] = [];- for (const e of world.getEntitiesWithComponents([RigidBody3D, Transform])) {- const body = world.get(e, RigidBody3D) as RigidBody3DData;- if (!body.enabled || body.bodyType === 0) continue;- const p = (world.get(e, Transform) as TransformData).worldPosition;- out.push({ x: p.x, z: p.z });+ // By name: a project without 3D physics has neither component, and the terrain must not carry the solver to look for them.+ const rigid = getComponent('RigidBody3D'), character = getComponent('CharacterController3D');+ if (rigid) {+ for (const e of world.getEntitiesWithComponents([rigid, Transform])) {+ const body = world.get(e, rigid) as { enabled: boolean; bodyType: number };+ if (!body.enabled || body.bodyType === 0) continue;+ const p = (world.get(e, Transform) as TransformData).worldPosition;+ out.push({ x: p.x, z: p.z });+ }}- for (const e of world.getEntitiesWithComponents([CharacterController3D, Transform])) {- const p = (world.get(e, Transform) as TransformData).worldPosition;- out.push({ x: p.x, z: p.z });+ if (character) {+ for (const e of world.getEntitiesWithComponents([character, Transform])) {+ const p = (world.get(e, Transform) as TransformData).worldPosition;+ out.push({ x: p.x, z: p.z });+ }}return out;}diff --git a/tools/apiSubsystems.mjs b/tools/apiSubsystems.mjsindex 2248f6280..7f7005142 100644--- a/tools/apiSubsystems.mjs+++ b/tools/apiSubsystems.mjs@@ -319,7 +319,7 @@ export const SUBSYSTEMS = [id: 'terrain-foliage',title: 'Terrain & foliage',titleZh: '地形与植被',- source: ['terrain', 'foliage'],+ source: ['terrain', 'foliage', 'worldgen'],tier: 'experimental',why: 'the ground and the plants on it draw and are checked in the editor on both backends, but nothing collides with the ground yet and the authoring panels have not been read for a shape',whyZh: '地面和上面的植物在编辑器里两个后端都能画出来并有检查,但还没有东西和地面碰撞,创作面板也还没有被拿来定下这套接口的形状',diff --git a/tools/baselines/theme-drift.json b/tools/baselines/theme-drift.jsonindex e8a1936fe..f29f91553 100644--- a/tools/baselines/theme-drift.json+++ b/tools/baselines/theme-drift.json@@ -2,6 +2,7 @@"spacing": {"agent.css": 12,"app.css": 1,+ "chrome.css": 1,"content.css": 5,"controllers.css": 1,"controls.css": 2,@@ -11,13 +12,12 @@"nodegraph.css": 3,"outliner.css": 2,"plugins.css": 3,- "profiler.css": 6,+ "profiler.css": 3,"sequencer.css": 1,"settings.css": 1,"tilemap.css": 1,"tileset.css": 1,- "viewport.css": 5,- "world.css": 1+ "viewport.css": 5},"colourLiterals": {},"colourLiteralsInCode": {},@@ -78,31 +78,27 @@"layout/MenuBar.tsx": 1,"layout/StatusBar.tsx": 6,"layout/SubsystemIndicator.tsx": 1,- "layout/Transport.tsx": 6,+ "layout/Transport.tsx": 7,"layout/WindowControls.tsx": 3,"panels/AnimatorEditor.tsx": 1,"panels/ContentBrowser.tsx": 5,"panels/ControllersPanel.tsx": 2,"panels/Details.tsx": 18,"panels/FlipbookEditor.tsx": 3,- "panels/HealthPanel.tsx": 1,"panels/HistoryPanel.tsx": 5,"panels/InputMapEditor.tsx": 1,"panels/inspector/componentDecorators.tsx": 9,"panels/inspector/controls.tsx": 13,- "panels/LightingPanel.tsx": 2,+ "panels/LightingPanel.tsx": 1,"panels/Outliner.tsx": 1,"panels/OutputLog.tsx": 1,- "panels/PluginsPanel.tsx": 1,- "panels/ProfilerPanel.tsx": 9,+ "panels/ProfilerPanel.tsx": 8,"panels/ScatterPanel.tsx": 1,"panels/Sequencer.tsx": 7,"panels/SpineDiagnosticsSection.tsx": 1,- "panels/SpinePreviewPane.tsx": 1,"panels/TilemapPainter.tsx": 11,"panels/TilesetEditor.tsx": 19,- "panels/UIWidgetsPanel.tsx": 1,"panels/Viewport.tsx": 3,- "panels/WorldPanel.tsx": 3+ "panels/WorldRulesEditor.tsx": 2}}diff --git a/tools/check-gizmo-coverage.mjs b/tools/check-gizmo-coverage.mjsindex 62b61ec81..d297761ec 100644--- a/tools/check-gizmo-coverage.mjs+++ b/tools/check-gizmo-coverage.mjs@@ -110,6 +110,9 @@ const DISPOSITION = {// The component's own drawing is the picture; an outline round it would trace// what is already on screen.+ 'PlacedFoliage.sizeX': ['renders', 'the area the plants are placed over is the outline'],+ 'PlacedFoliage.sizeZ': ['renders', 'the area the plants are placed over is the outline'],+ 'PlacedFoliage.cellSize': ['no-place', 'the side of the cells the area is cut into, not a region of the entity'],'Terrain.sizeX': ['renders', 'the ground drawn at it is the outline'],'Terrain.sizeZ': ['renders', 'the ground drawn at it is the outline'],'Terrain.height': ['renders', 'the ground drawn at it is the outline'],diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjsindex 14658fc95..abfb6c42d 100644--- a/tools/releaseNotes.mjs+++ b/tools/releaseNotes.mjs@@ -2892,6 +2892,10 @@ export const NOTED = {{"note":"A game's generated ground shows in the editor."},"fix(scaffold): a new project's gitignore keeps its plugins and platform profiles versioned, and ignores only what the editor generates":{"note":"A game's generated ground shows in the editor."},+ "feat(render): a MeshInstances component draws one mesh at many places, and plants are grown as instances of it":+ {"note":"Plants are instances of one mesh."},+ "fix(ci): the static gates earlier reds hid pass again":+ {"internal":"Gate baselines and a module split; nothing a creator sees."},"feat(assets): a project names folders its asset database leaves alone":{"note":"A project can keep folders out of its asset database."},"feat(worldgen): a plant part may cast no shadow, and far cells are capped at two cells wide":