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
chore(ci): the gates and tests that turned red on master are green again - the transform census sees patch accessors, the native binding generator names esengine::u32, the shader unit test follows the post-process overflow units, the virtual joystick test composes transforms, the public API snapshots take extentOf, breakable throws are updated immutably, and the gate lists name Breakable, Hitboxes, ContentRect, the sound worker bundle and the Spine pick note
yhh7041a052bfaf
diff --git a/docs/astro/src/data/components.generated.json b/docs/astro/src/data/components.generated.jsonindex ed6dfb807..b61c6af34 100644--- a/docs/astro/src/data/components.generated.json+++ b/docs/astro/src/data/components.generated.json@@ -8345,6 +8345,19 @@"doc": "How far ground without end is drawn.","range": "≥ 1"},+ {+ "key": "virtualTexture",+ "type": "boolean",+ "default": "false",+ "doc": "Bake the ground's surface into pages, as Unreal's Runtime Virtual Texture does: from Virtual Texture From out, each node is drawn from its page (two texture reads) instead of every layer at every pixel. Ground with layers only; steep ground, and a node whose page is still being made, is drawn from the layers."+ },+ {+ "key": "virtualTextureFrom",+ "type": "number",+ "default": "1",+ "doc": "The first level of the ground drawn from its baked surface: 0 the nearest ground too, 1 all but it. The nearest is where the layers' own detail shows most.",+ "range": "0–15, step 1"+ },{"key": "collision","type": "boolean",@@ -8490,6 +8503,7 @@"cellSize","detail","drawDistance",+ "virtualTextureFrom","collisionDistance","collisionLayer","friction",diff --git a/sdk/etc/index.api.md b/sdk/etc/index.api.mdindex 868377a9a..b89aca5d8 100644--- a/sdk/etc/index.api.md+++ b/sdk/etc/index.api.md@@ -4192,6 +4192,7 @@ rot: Quat## EntityBoxOptions — interface @experimental```+extentOf: ((entity: Entity) => { x: number; y: number; width: number; height: number; } | null) | undefinediconHalf: number | ((at: Vec3) => number) | undefined```@@ -4258,6 +4259,7 @@ ResourceDef<EntityEventQueue>## EntityPickOptions — interface @experimental```depthLayers: number | undefined+extentOf: ((entity: Entity) => { x: number; y: number; width: number; height: number; } | null) | undefinediconHalf: number | ((at: Vec3) => number) | undefinedpickable: ((entity: Entity) => boolean) | undefinedySortLayers: number | undefineddiff --git a/sdk/etc/index.native.api.md b/sdk/etc/index.native.api.mdindex b311b4116..641de853b 100644--- a/sdk/etc/index.native.api.md+++ b/sdk/etc/index.native.api.md@@ -4200,6 +4200,7 @@ rot: Quat## EntityBoxOptions — interface @experimental```+extentOf: ((entity: Entity) => { x: number; y: number; width: number; height: number; } | null) | undefinediconHalf: number | ((at: Vec3) => number) | undefined```@@ -4266,6 +4267,7 @@ ResourceDef<EntityEventQueue>## EntityPickOptions — interface @experimental```depthLayers: number | undefined+extentOf: ((entity: Entity) => { x: number; y: number; width: number; height: number; } | null) | undefinediconHalf: number | ((at: Vec3) => number) | undefinedpickable: ((entity: Entity) => boolean) | undefinedySortLayers: number | undefineddiff --git a/sdk/etc/index.node.api.md b/sdk/etc/index.node.api.mdindex 81a7fa87b..dd8006ffb 100644--- a/sdk/etc/index.node.api.md+++ b/sdk/etc/index.node.api.md@@ -4187,6 +4187,7 @@ rot: Quat## EntityBoxOptions — interface @experimental```+extentOf: ((entity: Entity) => { x: number; y: number; width: number; height: number; } | null) | undefinediconHalf: number | ((at: Vec3) => number) | undefined```@@ -4253,6 +4254,7 @@ ResourceDef<EntityEventQueue>## EntityPickOptions — interface @experimental```depthLayers: number | undefined+extentOf: ((entity: Entity) => { x: number; y: number; width: number; height: number; } | null) | undefinediconHalf: number | ((at: Vec3) => number) | undefinedpickable: ((entity: Entity) => boolean) | undefinedySortLayers: number | undefineddiff --git a/sdk/etc/minigame.api.md b/sdk/etc/minigame.api.mdindex d3699082f..3962979d9 100644--- a/sdk/etc/minigame.api.md+++ b/sdk/etc/minigame.api.md@@ -4187,6 +4187,7 @@ rot: Quat## EntityBoxOptions — interface @experimental```+extentOf: ((entity: Entity) => { x: number; y: number; width: number; height: number; } | null) | undefinediconHalf: number | ((at: Vec3) => number) | undefined```@@ -4253,6 +4254,7 @@ ResourceDef<EntityEventQueue>## EntityPickOptions — interface @experimental```depthLayers: number | undefined+extentOf: ((entity: Entity) => { x: number; y: number; width: number; height: number; } | null) | undefinediconHalf: number | ((at: Vec3) => number) | undefinedpickable: ((entity: Entity) => boolean) | undefinedySortLayers: number | undefineddiff --git a/sdk/etc/wechat.api.md b/sdk/etc/wechat.api.mdindex ca47b0839..eafbb4020 100644--- a/sdk/etc/wechat.api.md+++ b/sdk/etc/wechat.api.md@@ -4187,6 +4187,7 @@ rot: Quat## EntityBoxOptions — interface @experimental```+extentOf: ((entity: Entity) => { x: number; y: number; width: number; height: number; } | null) | undefinediconHalf: number | ((at: Vec3) => number) | undefined```@@ -4253,6 +4254,7 @@ ResourceDef<EntityEventQueue>## EntityPickOptions — interface @experimental```depthLayers: number | undefined+extentOf: ((entity: Entity) => { x: number; y: number; width: number; height: number; } | null) | undefinediconHalf: number | ((at: Vec3) => number) | undefinedpickable: ((entity: Entity) => boolean) | undefinedySortLayers: number | undefineddiff --git a/sdk/src/breakable/breakable.ts b/sdk/src/breakable/breakable.tsindex f242cc5d6..aa47f82f3 100644--- a/sdk/src/breakable/breakable.ts+++ b/sdk/src/breakable/breakable.ts@@ -271,10 +271,9 @@ export class BreakablePlugin implements Plugin {if (b.loading) continue;// The world makes a piece's body on its next step; until then there is nothing to throw.if (b.throws.length) {- b.throws = b.throws.filter((t) => {- if (!world.valid(t.entity)) return false;- if (pusher?.(t.entity, t.velocity)) return false;- return ++t.tries < 30;+ b.throws = b.throws.flatMap((t) => {+ if (!world.valid(t.entity) || pusher?.(t.entity, t.velocity)) return [];+ return t.tries + 1 < 30 ? [{ ...t, tries: t.tries + 1 }] : [];});}b.age += time.delta;diff --git a/sdk/tests/breakable.test.ts b/sdk/tests/breakable.test.tsindex 22975dee6..c1dfad87f 100644--- a/sdk/tests/breakable.test.ts+++ b/sdk/tests/breakable.test.ts@@ -32,7 +32,7 @@ const { defineSystem, Schedule } = await import('../src/ecs/system');const { EventReader } = await import('../src/ecs/event');/** Everything said about breaking, as a game's own system would read it. */-function listen(app: InstanceType<typeof App>) {+function listen(app: ReturnType<typeof App.new>) {const heard: { entity: Entity; x: number; y: number; z: number; impulse: number }[] = [];app.addSystemToSchedule(Schedule.Update, defineSystem([EventReader(Broke)], (broke: Iterable<(typeof heard)[number]>) => {for (const e of broke) heard.push({ ...e });diff --git a/sdk/tests/helpers/nativeRegistryOps.ts b/sdk/tests/helpers/nativeRegistryOps.tsindex abfaf2bd5..a334a5147 100644--- a/sdk/tests/helpers/nativeRegistryOps.ts+++ b/sdk/tests/helpers/nativeRegistryOps.ts@@ -26,6 +26,13 @@ export function installRegistryOpDefaults(scope: Record<string, unknown>, alive?hasInactiveEntities: () => [...enabled.values()].some((v) => !v),activityEpoch: () => epoch,setParent: () => true,+ markComponentChanged: () => undefined,+ componentChangedSince: () => false,+ changeTick: () => 1,+ beginChangeRead: () => 1,+ setChangeAudit: () => undefined,+ auditChanges: () => 0,+ changeAuditTotal: () => 0,};for (const [op, binding] of Object.entries(REGISTRY_OPS) as [keyof typeof REGISTRY_OPS, string][]) {if (typeof scope[binding] !== 'function') scope[binding] = defaults[op];diff --git a/sdk/tests/physics3d-ecs.test.ts b/sdk/tests/physics3d-ecs.test.tsindex cfeac2b33..3f08bf5ca 100644--- a/sdk/tests/physics3d-ecs.test.ts+++ b/sdk/tests/physics3d-ecs.test.ts@@ -37,6 +37,7 @@ function fakeModule(): Physics3DWasmModule & {calls: { name: string; args: number[] }[];publish(records: number[]): void;publishQuery(records: number[]): void;+ publishContacts(records: number[]): void;} {const calls: { name: string; args: number[] }[] = [];// One heap the module's two pointers index into, as wasm has.@@ -754,7 +755,7 @@ describe('the 3D world and the ECS', () => {it('carries a new length and spring into a distance joint that already exists', () => {const [a, b] = pair();- const rope = world.insert<{ maxLength: number; minLength: number; frequency: number; damping: number }>(a, DistanceJoint3D, { connectedEntity: b, maxLength: 300 });+ const rope = world.insert<{ connectedEntity: Entity; maxLength: number; minLength: number; frequency: number; damping: number }>(a, DistanceJoint3D, { connectedEntity: b, maxLength: 300 });stepJoints();expect(called('setDistanceJoint')).toHaveLength(0);rope.maxLength = 100;diff --git a/sdk/tests/virtual-controls-visibility-wasm.test.ts b/sdk/tests/virtual-controls-visibility-wasm.test.tsindex 900e202dc..e0a38fd1a 100644--- a/sdk/tests/virtual-controls-visibility-wasm.test.ts+++ b/sdk/tests/virtual-controls-visibility-wasm.test.ts@@ -19,10 +19,10 @@ describe.skipIf(!HAS_WASM)('virtual controls read authored visibility on real WAlet controls: ReturnType<typeof createVirtualControlSystem>;let parent: Entity, entity: Entity;const pointers = new Map<number, ControlPointer>();- const layout = () => engine.uiLayout_update(registry, -100, -100, 100, 100, true);+ const layout = () => { engine.uiLayout_update(registry, -100, -100, 100, 100, true); engine.transform_update(registry); };const point = (pressed: boolean) => pointers.set(1, {id: 1, entity, pressedEntity: pressed ? entity : null, pressed, down: true,- layoutX: 50, layoutY: 0, worldX: 50, worldY: 0, screenX: 0, screenY: 0,+ layoutX: 50, layoutY: 100, worldX: 50, worldY: 100, screenX: 0, screenY: 0,});const tick = () => (controls.system._fn as (...args: unknown[]) => void)(input, { pointers }, { delta: 1 / 60 });beforeAll(async () => { engine = await loadWasmModule(); });diff --git a/src/esengine/renderer/frame/RenderFrame.cpp b/src/esengine/renderer/frame/RenderFrame.cppindex a566256c2..18898e6dc 100644--- a/src/esengine/renderer/frame/RenderFrame.cpp+++ b/src/esengine/renderer/frame/RenderFrame.cpp@@ -2301,8 +2301,7 @@ void RenderFrame::buildShadowPlan(ecs::Registry& registry) {// The sun's cloud shadow, before its cascades: one tile for the whole of what the camera sees under the clouds, where a cascade// is the nearest stretch of it. With the atlas full a sun then gives up its farthest cascade, as it does for a light that stands somewhere.if (cloudExtent > 0.0f) {- AtlasRefusal why = AtlasRefusal::None;- cloud_tile_ = shadow_atlas_.allocate(1, 1, why);+ claimTiles(shadow_atlas_, INVALID_ENTITY, 1, 1, cloud_tile_);}for (usize i = 0; i < shadow_casters_.size(); ++i) {const ShadowCaster& caster = shadow_casters_[i];diff --git a/tests/renderer/test_shader_variant.cpp b/tests/renderer/test_shader_variant.cppindex 1b8d8738c..a543accbf 100644--- a/tests/renderer/test_shader_variant.cpp+++ b/tests/renderer/test_shader_variant.cpp@@ -326,7 +326,9 @@ static void testMaterialOverflowUnits() {// A fullscreen pass reaches its low units through its own conventions.ParsedShader post = ShaderParser::parse(manyTextures("PostProcess", 8));- CHECK(unitOf(post, "u_m6") == 14 && unitOf(post, "u_m7") == -1, "a PostProcess shader stays at seven");+ CHECK(unitOf(post, "u_m6") == 14 && unitOf(post, "u_m7") == 5, "a PostProcess shader's eighth texture takes unit 5");+ ParsedShader postTen = ShaderParser::parse(manyTextures("PostProcess", 10));+ CHECK(unitOf(postTen, "u_m8") == 4 && unitOf(postTen, "u_m9") == -1, "its ninth takes unit 4 and its tenth finds none");}static void testWGSLEmission() {diff --git a/tools/baselines/sdk-test-types.json b/tools/baselines/sdk-test-types.jsonindex 26a221a73..e17599df0 100644--- a/tools/baselines/sdk-test-types.json+++ b/tools/baselines/sdk-test-types.json@@ -98,9 +98,6 @@"TS2345|Argument of type '{ verts: Float32Array<ArrayBuffer>; polys: Int32Array<ArrayBuffer>; neis: Int32Array<ArrayBuffer>; ... 4 more ...; verticalReach: number; }' is not assignable to parameter of type 'NavMeshData'.": 1,"TS2741|Property 'showLinks' is missing in type '{ enabled: true; showFaces: true; showBorders: true; }' but required in type 'NavDebugDrawConfig'.": 1},- "tests/physics3d-ecs.test.ts": {- "TS2339|Property 'publishContacts' does not exist on type 'Physics3DWasmModule & { calls: { name: string; args: number[]; }[]; publish(records: number[]): void; publishQuery(records: number[]): void; }'.": 1- },"tests/playableRuntime.test.ts": {"TS2554|Expected 1 arguments, but got 0.": 1},diff --git a/tools/census-transform-writers.mjs b/tools/census-transform-writers.mjsindex e1dfd2e68..0d109f5fe 100644--- a/tools/census-transform-writers.mjs+++ b/tools/census-transform-writers.mjs@@ -197,7 +197,7 @@ for (const rel of cpp) {const bound = [];lines.forEach((line, i) => {while (bound.length && bound[bound.length - 1].depth > depth[i]) bound.pop();- const b = /\b(\w+)\s*=\s*[^;]*\b(?:get|tryGet|emplace|emplaceOrReplace)<(?:[\w:]*::)?Transform>/.exec(line)+ const b = /\b(\w+)\s*=\s*[^;]*\b(?:get|tryGet|patch|emplace|emplaceOrReplace)<(?:[\w:]*::)?Transform>/.exec(line)?? /(?:[\w:]*::)?Transform&\s+(\w+)\s*[=)]/.exec(line)?? /(?:[\w:]*::)?Transform\*\s+(\w+)\s*=/.exec(line);if (b) bound.push({ name: b[1], depth: depth[i] });diff --git a/tools/check-corpus-authoring.mjs b/tools/check-corpus-authoring.mjsindex 5ed1249b8..163de7136 100644--- a/tools/check-corpus-authoring.mjs+++ b/tools/check-corpus-authoring.mjs@@ -126,6 +126,8 @@ const DISPOSITION = {MeshInstances: ['derived', 'the foliage and world generation systems write it, one entity a kind and part of a cell; its places are data a system computes, not something a scene authors'],ParticleCollider: ['owed', 'no example has a GPU emitter bouncing off a shape yet; the particle-gpu scenes are where the first one goes'],Waterfall: ['owed', 'no example has water falling off a lip yet; the terrain-and-water example, where a river meets a cliff, is where the first one goes'],+ Breakable: ['owed', 'no example scene breaks an object yet; a breakable crate in the physics-3d example is where the first one goes'],+ Hitboxes: ['owed', 'no example scene authors a hitbox set yet; the first one goes in an example with melee combat'],WaterfallAnchor: ['owed', 'no example fixes a fall to a river yet; it goes with the first Waterfall in the terrain-and-water example'],GripProfile: ['owed', 'no example holds an object in its two hands yet; a character with a rifle is where the first one goes'],GripHolder: ['owed', 'no example holds an object in its two hands yet; a character with a rifle is where the first one goes'],diff --git a/tools/check-gizmo-coverage.mjs b/tools/check-gizmo-coverage.mjsindex 929c20d53..85b6ae720 100644--- a/tools/check-gizmo-coverage.mjs+++ b/tools/check-gizmo-coverage.mjs@@ -65,6 +65,7 @@ const DISPOSITION = {'WaterBody.sizeX': 'extent','WaterBody.sizeZ': 'extent','SpringBoneCollider.radius': 'extent',+ 'ContentRect.size': 'extent','SpringBoneCollider.height': 'extent','GripSurface.radius': 'extent','GripSurface.height': 'extent',@@ -178,7 +179,6 @@ const DISPOSITION = {'PathFollower.distance': ['no-place', 'how far along the Spline the entity is, a position on a curve the Spline already draws, not a region'],'TerrainBand2D.depth': ['renders', 'how far down the filled body goes below the surface; the band drawn at it is the outline'],'TerrainBand2D.edgeWidth': ['renders', 'the thickness of the lip along the surface; the lip drawn at it is the outline'],- 'ContentRect.size': ['owed', 'a sprite or text on the entity follows it and is the outline, but a bare rect (a clip box, a hit area) draws nothing yet'],'Sprite.size': ['renders', 'the sprite drawn at it is the outline'],'Sprite.tileSize': ['renders', 'the repeat of a drawn sprite'],'ShapeRenderer.size': ['renders', 'the shape drawn at it is the outline'],diff --git a/tools/eht/generators/native_bindings.py b/tools/eht/generators/native_bindings.pyindex 9473b6dc2..20c67361a 100644--- a/tools/eht/generators/native_bindings.py+++ b/tools/eht/generators/native_bindings.py@@ -239,7 +239,7 @@ class NativeBindingsGenerator:out = []for op in REGISTRY_OPS:args = [f'esn_entity(a[{i}])' if k == 'entity'- else f'static_cast<u32>(esjs::toNumber(a[{i}]))' if k == 'number'+ else f'static_cast<esengine::u32>(esjs::toNumber(a[{i}]))' if k == 'number'else f'esjs::toBool(a[{i}])'for i, (_n, k) in enumerate(op.params)]call = op.call.replace('r.', 'esn_reg().', 1) if op.call.startswith('r.') else op.call.replace('(r,', '(esn_reg(),', 1)diff --git a/tools/lib/contractFacts.mjs b/tools/lib/contractFacts.mjsindex 33124c325..240047e23 100644--- a/tools/lib/contractFacts.mjs+++ b/tools/lib/contractFacts.mjs@@ -361,6 +361,8 @@ export const NOT_CONTRACT = {'a measured baseline, not a derivation — accepted with `perf-guard --update`.','sdk/src/runtime/planWorkerBundle.generated.ts':'the compiled text of src/worldgen/planWorker.ts, built by sdk/scripts/build-worker.mjs — one source file bundled, not a projection of a fact two places must agree on.',+ 'sdk/src/sound/soundWorkerBundle.generated.ts':+ 'the compiled text of the sound worker, built by sdk/scripts/build-worker.mjs — one source file bundled, as the planning worker is.','sdk/src/image/recipeWorkerBundle.generated.ts':'the compiled text of src/image/recipeWorker.ts, built by sdk/scripts/build-worker.mjs — one source file bundled, as the planning worker is.','native/spine/SpineCRename21.hpp':diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjsindex 0e5883f5f..11aab433c 100644--- a/tools/releaseNotes.mjs+++ b/tools/releaseNotes.mjs@@ -4834,6 +4834,8 @@ export const NOTED = {{"note": "A click selects a shape by its drawn size, and a bare Canvas no longer takes the click."},"fix(editor): nudging a selection moves each selected root once, so a selected child no longer travels twice; the clipboard and selection edits are checked end to end":{"note": "Nudging a selection moves each selected root once, so a selected child no longer travels twice."},+ "feat(pick): the box of an entity can take a drawn extent from the caller, so a skeleton is picked by what it draws":+ {"note": "A Spine skeleton is selected by the character it draws."},"fix(pick): a shape is selected by its drawn size and layer, so a click inside it lands":{"note": "A click selects a shape by its drawn size, and a bare Canvas no longer takes the click."},"feat(render): a mesh, a material, a texture and the frame's probes each carry a revision that changes whenever their content does - one counter for all of them (core/Revision.hpp), so what the renderer derives from a resource can be kept until the resource itself changes":diff --git a/tools/render-submit-cost.mjs b/tools/render-submit-cost.mjsindex 50fb310ec..7d7c9038f 100644--- a/tools/render-submit-cost.mjs+++ b/tools/render-submit-cost.mjs@@ -63,7 +63,7 @@ const meta = (file, type) => writeFile(`${file}.meta`, JSON.stringify({ uuid: ra/** The synthetic project: a camera over a grid of static meshes, a sun and a sky, in one material spread. */async function writeSynthetic(dir, spread) {- await rm(dir, { recursive: true, force: true });+ await rm(dir, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });await mkdir(path.join(dir, 'assets/scenes'), { recursive: true });await mkdir(path.join(dir, 'assets/materials'), { recursive: true });await writeFile(path.join(dir, 'project.esproject'), JSON.stringify({ name: 'RenderSubmitCost', version: '1.0', defaultScene: 'assets/scenes/main.esscene' }));