Skip to content

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.

feat(examples): six components a shipped scene now authors

esengine7d95376746e1
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 54db29e2e..f0ff650c4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -24,6 +24,15 @@ published separately; it ships inside the editor.
it runs, so switching a boss back on cannot un-switch a prop that was switched
off on its own. `set_entity_active` is the same door for automation.
+- **Six components a shipped scene now authors.** The hull bar's mask in
+ space-shooter, all three trails in trail-demo, a crosswind through the
+ third-person demo's ambient motes, a costly patch of mud in the 3D AI example,
+ and that example's patrol posts — `Marker` entities the scene places, so where
+ a hunter waits is level design rather than a number in a system. One of those
+ posts ships switched off, which is the first thing in the corpus to use
+ `Disabled` and the only place it can be watched working: a query answers with
+ three of the scene's four posts, and no hunter is ever sent to the fourth.
+
- **A disabled entity is actually skipped.** `Disabled`'s doc promised that "the
engine's systems skip it" and nothing read the tag: `setEntityActive` returned,
every query went on answering with the entity, and the only record of this was
diff --git a/desktop b/desktop
index 5f097c473..56cf25982 160000
--- a/desktop
+++ b/desktop
@@ -1 +1 @@
-Subproject commit 5f097c473ddbbdb53a1b03904de5b16377b738d8
+Subproject commit 56cf259821e8eab2d6639a79ba6e78e3eb89482c
diff --git a/examples/enemy-ai-3d/assets/scenes/main.esscene b/examples/enemy-ai-3d/assets/scenes/main.esscene
index be0e92c6d..e07aa1953 100644
--- a/examples/enemy-ai-3d/assets/scenes/main.esscene
+++ b/examples/enemy-ai-3d/assets/scenes/main.esscene
@@ -449,6 +449,145 @@
}
}
]
+ },
+ {
+ "id": 12,
+ "name": "Mud",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -300,
+ "y": 20,
+ "z": -150
+ }
+ }
+ },
+ {
+ "type": "NavArea",
+ "data": {
+ "halfExtents": {
+ "x": 260,
+ "y": 40,
+ "z": 200
+ },
+ "cost": 4,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 13,
+ "name": "Post West",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -250,
+ "y": 80,
+ "z": -180
+ }
+ }
+ },
+ {
+ "type": "Marker",
+ "data": {
+ "type": "patrol",
+ "properties": {}
+ }
+ }
+ ]
+ },
+ {
+ "id": 14,
+ "name": "Post East",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 250,
+ "y": 80,
+ "z": -180
+ }
+ }
+ },
+ {
+ "type": "Marker",
+ "data": {
+ "type": "patrol",
+ "properties": {}
+ }
+ }
+ ]
+ },
+ {
+ "id": 15,
+ "name": "Post North",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 80,
+ "z": -260
+ }
+ }
+ },
+ {
+ "type": "Marker",
+ "data": {
+ "type": "patrol",
+ "properties": {}
+ }
+ }
+ ]
+ },
+ {
+ "id": 16,
+ "name": "Post Far",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -600,
+ "y": 80,
+ "z": -620
+ }
+ }
+ },
+ {
+ "type": "Marker",
+ "data": {
+ "type": "patrol",
+ "properties": {}
+ }
+ },
+ {
+ "type": "Disabled",
+ "data": {}
+ }
+ ]
}
]
-}
+}
\ No newline at end of file
diff --git a/examples/enemy-ai-3d/src/enemy.ts b/examples/enemy-ai-3d/src/enemy.ts
index 75074f62e..30f10b72c 100644
--- a/examples/enemy-ai-3d/src/enemy.ts
+++ b/examples/enemy-ai-3d/src/enemy.ts
@@ -1,26 +1,45 @@
import {
- defineSystem, Query, Mut, GetWorld, Transform, NavAgent, Perception,
+ defineSystem, Query, Mut, GetWorld, Transform, Marker, NavAgent, Perception,
setNavDestination, stopNavAgent,
} from 'esengine';
+import type { Vec3 } from 'esengine';
/**
- * Chase what was seen, in three dimensions.
+ * Chase what was seen; hold a post when nothing is.
*
- * `Perception` reports where the target IS, on all three axes — a hunter on the
- * ground and a player on the terrace are not in the same place, and a chase that
- * dropped the third axis would send it to the spot below.
+ * `Perception` reports the target on all three axes — a hunter on the ground and
+ * a player on the terrace are not in the same place. The posts are scene-placed
+ * `Marker`s, and one switched off is not in this query at all.
*/
export const chaseSystem = defineSystem(
- [Query(Perception, NavAgent), GetWorld()],
- (hunters, world) => {
+ [Query(Perception, NavAgent), Query(Marker, Transform), GetWorld()],
+ (hunters, markers, world) => {
+ const posts: Vec3[] = [];
+ for (const [, marker, at] of markers) {
+ if (marker.type === 'patrol') posts.push(at.position);
+ }
+
for (const [entity, sight] of hunters) {
if (sight.visible) {
setNavDestination(world, entity, {
x: sight.targetX, y: sight.targetY, z: sight.targetZ,
});
- } else {
+ continue;
+ }
+ if (posts.length === 0) {
stopNavAgent(world, entity);
+ continue;
+ }
+ // The nearest post, so three hunters spread over them rather than
+ // queueing at one.
+ const here = world.get(entity, Transform).position;
+ let best = posts[0];
+ let bestD = Infinity;
+ for (const p of posts) {
+ const d = (p.x - here.x) ** 2 + (p.z - here.z) ** 2;
+ if (d < bestD) { bestD = d; best = p; }
}
+ setNavDestination(world, entity, best);
}
},
{ name: 'ChaseSystem' },
diff --git a/examples/space-shooter/assets/scenes/main.esscene b/examples/space-shooter/assets/scenes/main.esscene
index 9fa6d09b8..b77ddba3e 100644
--- a/examples/space-shooter/assets/scenes/main.esscene
+++ b/examples/space-shooter/assets/scenes/main.esscene
@@ -456,6 +456,170 @@
}
],
"visible": true
+ },
+ {
+ "id": 16,
+ "name": "HullBarBack",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -110,
+ "y": -500,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 220,
+ "y": 14
+ },
+ "pivot": {
+ "x": 0,
+ "y": 0.5
+ },
+ "layer": 10,
+ "order": 0,
+ "color": {
+ "r": 0.1,
+ "g": 0.12,
+ "b": 0.18,
+ "a": 0.85
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 17,
+ "name": "HullBarMask",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -110,
+ "y": -500,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 220,
+ "y": 14
+ },
+ "pivot": {
+ "x": 0,
+ "y": 0.5
+ },
+ "layer": 10,
+ "order": 1
+ }
+ },
+ {
+ "type": "SpriteMask",
+ "data": {}
+ },
+ {
+ "type": "HullBarMask",
+ "data": {}
+ }
+ ]
+ },
+ {
+ "id": 18,
+ "name": "HullBarFill",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -110,
+ "y": -500,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 220,
+ "y": 14
+ },
+ "pivot": {
+ "x": 0,
+ "y": 0.5
+ },
+ "layer": 10,
+ "order": 2,
+ "color": {
+ "r": 0.35,
+ "g": 0.95,
+ "b": 0.6,
+ "a": 1
+ },
+ "maskInteraction": 1
+ }
+ }
+ ]
+ },
+ {
+ "id": 19,
+ "name": "HullBarLost",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -110,
+ "y": -500,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 220,
+ "y": 14
+ },
+ "pivot": {
+ "x": 0,
+ "y": 0.5
+ },
+ "layer": 10,
+ "order": 3,
+ "color": {
+ "r": 0.85,
+ "g": 0.22,
+ "b": 0.28,
+ "a": 1
+ },
+ "maskInteraction": 2
+ }
+ }
+ ]
}
]
-}
+}
\ No newline at end of file
diff --git a/examples/space-shooter/src/systems/setup.ts b/examples/space-shooter/src/systems/setup.ts
index c0747d258..e0a758018 100644
--- a/examples/space-shooter/src/systems/setup.ts
+++ b/examples/space-shooter/src/systems/setup.ts
@@ -1,22 +1,11 @@
-import {
- defineSystem, Commands, Res, Prefabs,
- Transform, Sprite, SpriteMask, SpriteMaskInteraction,
-} from 'esengine';
+import { defineSystem, Commands, Res, Prefabs } from 'esengine';
import {
GameState, HALF_WIDTH, HALF_HEIGHT,
- PREFAB_STAR, positionOverride, propOverride, HULL_BAR_WIDTH,
+ PREFAB_STAR, positionOverride, propOverride,
} from '../resources';
-import { HullBarMask } from '../components';
const INITIAL_STAR_COUNT = 40;
-/** The hull bar, in world units. Its WIDTH is shared with the HUD that cuts it. */
-const BAR_X = -110;
-const BAR_Y = -500;
-const BAR_H = 14;
-/** Above every gameplay sprite, so the bar is never flown over. */
-const BAR_LAYER = 10;
-
export const setupSystem = defineSystem(
[Commands(), Res(Prefabs)],
(cmds, prefabServer) => {
@@ -28,55 +17,6 @@ export const setupSystem = defineSystem(
shootCooldown: 0,
});
- // The fill is CUT, not resized: scaling stretches the art, a mask takes a bite
- // out of it. The mask's width is the reading (hudSystem). Left-pivoted, and
- // ordered back < mask < fill — the order a mask has to be written in.
- cmds.spawn('HullBarBack')
- .insert(Transform, { position: { x: BAR_X, y: BAR_Y, z: 0 } })
- .insert(Sprite, {
- size: { x: HULL_BAR_WIDTH, y: BAR_H },
- pivot: { x: 0, y: 0.5 },
- color: { r: 0.10, g: 0.12, b: 0.18, a: 0.85 },
- layer: BAR_LAYER,
- order: 0,
- });
-
- cmds.spawn('HullBarMask')
- .insert(Transform, { position: { x: BAR_X, y: BAR_Y, z: 0 } })
- .insert(Sprite, {
- size: { x: HULL_BAR_WIDTH, y: BAR_H },
- pivot: { x: 0, y: 0.5 },
- layer: BAR_LAYER,
- order: 1,
- })
- .insert(SpriteMask, {})
- .insert(HullBarMask, {});
-
- cmds.spawn('HullBarFill')
- .insert(Transform, { position: { x: BAR_X, y: BAR_Y, z: 0 } })
- .insert(Sprite, {
- size: { x: HULL_BAR_WIDTH, y: BAR_H },
- pivot: { x: 0, y: 0.5 },
- color: { r: 0.35, g: 0.95, b: 0.6, a: 1 },
- layer: BAR_LAYER,
- order: 2,
- maskInteraction: SpriteMaskInteraction.VisibleInside,
- });
-
- // The same mask's other side: what the hull has LOST. One mask cuts both, so
- // the halves cannot disagree about the boundary — and at full hull this one has
- // nowhere to show, which is what makes a broken outside-test visible.
- cmds.spawn('HullBarLost')
- .insert(Transform, { position: { x: BAR_X, y: BAR_Y, z: 0 } })
- .insert(Sprite, {
- size: { x: HULL_BAR_WIDTH, y: BAR_H },
- pivot: { x: 0, y: 0.5 },
- color: { r: 0.85, g: 0.22, b: 0.28, a: 1 },
- layer: BAR_LAYER,
- order: 3,
- maskInteraction: SpriteMaskInteraction.VisibleOutside,
- });
-
for (let i = 0; i < INITIAL_STAR_COUNT; i++) {
const layer = i % 3;
const speed = 20 + layer * 30;
diff --git a/examples/third-person-3d/assets/scenes/main.esscene b/examples/third-person-3d/assets/scenes/main.esscene
index ac2bc8804..e10a95076 100644
--- a/examples/third-person-3d/assets/scenes/main.esscene
+++ b/examples/third-person-3d/assets/scenes/main.esscene
@@ -5530,6 +5530,39 @@
}
}
]
+ },
+ {
+ "id": 142,
+ "name": "AirDrift",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 260,
+ "z": -1600
+ }
+ }
+ },
+ {
+ "type": "ParticleForceField",
+ "data": {
+ "type": 0,
+ "strength": 16,
+ "radius": 900,
+ "direction": {
+ "x": 1,
+ "y": 0.15,
+ "z": 0.3
+ },
+ "falloff": true
+ }
+ }
+ ]
}
]
-}
+}
\ No newline at end of file
diff --git a/examples/trail-demo/README.md b/examples/trail-demo/README.md
index f3e0cec50..d19747304 100644
--- a/examples/trail-demo/README.md
+++ b/examples/trail-demo/README.md
@@ -3,7 +3,9 @@
A tour of the engine's **built-in trail renderer** — the `TrailRenderer`
component records an entity's world-space path and draws it as a tapering,
fading ribbon, entirely engine-side. Three emitters run distinct configs side
-by side:
+by side, each one authored in the scene: a sprite plus the tuned
+`TrailRenderer` beside it, which is the whole of setting a trail up. The
+project's systems only move them.
- **Comet** — rides a Lissajous figure with a long additive streak
(1.4 s lifetime, 26 px head tapering to 0, warm → transparent gradient).
diff --git a/examples/trail-demo/assets/scenes/main.esscene b/examples/trail-demo/assets/scenes/main.esscene
index fabebd6fb..149c7950b 100644
--- a/examples/trail-demo/assets/scenes/main.esscene
+++ b/examples/trail-demo/assets/scenes/main.esscene
@@ -216,6 +216,189 @@
}
}
]
+ },
+ {
+ "id": 5,
+ "name": "Comet",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -330,
+ "y": 20,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 22,
+ "y": 22
+ },
+ "color": {
+ "r": 1,
+ "g": 0.85,
+ "b": 0.55,
+ "a": 1
+ },
+ "layer": 3
+ }
+ },
+ {
+ "type": "TrailRenderer",
+ "data": {
+ "time": 1.4,
+ "minVertexDistance": 4,
+ "startWidth": 26,
+ "endWidth": 0,
+ "startColor": {
+ "r": 1,
+ "g": 0.72,
+ "b": 0.3,
+ "a": 0.9
+ },
+ "endColor": {
+ "r": 1,
+ "g": 0.2,
+ "b": 0.1,
+ "a": 0
+ },
+ "blendMode": 1,
+ "layer": 2
+ }
+ },
+ {
+ "type": "Comet",
+ "data": {}
+ }
+ ]
+ },
+ {
+ "id": 6,
+ "name": "Follower",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 16,
+ "y": 16
+ },
+ "color": {
+ "r": 0.55,
+ "g": 0.95,
+ "b": 1,
+ "a": 1
+ },
+ "layer": 3
+ }
+ },
+ {
+ "type": "TrailRenderer",
+ "data": {
+ "startWidth": 14,
+ "endWidth": 2,
+ "startColor": {
+ "r": 0.45,
+ "g": 0.9,
+ "b": 1,
+ "a": 0.85
+ },
+ "endColor": {
+ "r": 0.15,
+ "g": 0.35,
+ "b": 1,
+ "a": 0
+ },
+ "layer": 2
+ }
+ },
+ {
+ "type": "Follower",
+ "data": {}
+ }
+ ]
+ },
+ {
+ "id": 7,
+ "name": "Dasher",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 330,
+ "y": -140,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 30,
+ "y": 30
+ },
+ "color": {
+ "r": 0.85,
+ "g": 0.7,
+ "b": 1,
+ "a": 1
+ },
+ "layer": 3
+ }
+ },
+ {
+ "type": "TrailRenderer",
+ "data": {
+ "time": 0.25,
+ "minVertexDistance": 2,
+ "startWidth": 44,
+ "endWidth": 6,
+ "startColor": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 0.95
+ },
+ "endColor": {
+ "r": 0.6,
+ "g": 0.3,
+ "b": 1,
+ "a": 0
+ },
+ "blendMode": 1,
+ "layer": 2
+ }
+ },
+ {
+ "type": "Dasher",
+ "data": {}
+ }
+ ]
}
]
-}
+}
\ No newline at end of file
diff --git a/examples/trail-demo/src/main.ts b/examples/trail-demo/src/main.ts
index 47f153fee..77954a3ef 100644
--- a/examples/trail-demo/src/main.ts
+++ b/examples/trail-demo/src/main.ts
@@ -1,27 +1,15 @@
-// Trails — a tour of the built-in trail renderer (the `TrailRenderer`
-// component + the `Trail` resource):
-//
-// • Comet — rides a Lissajous figure with a long additive streak
-// (time 1.4 s, 26 px head tapering to 0, warm→transparent gradient).
-// • Follower — eases toward the mouse cursor with a short cool ribbon,
-// the classic cursor-trail.
-// • Dasher — click anywhere and it dashes there in 0.14 s, leaving a
-// wide short-lived burst (44 px head, 0.25 s lifetime, additive).
-//
-// Trail points are recorded and aged by the engine's TrailSystem (TrailPlugin,
-// play mode); project systems only move the emitters. The keys demonstrate
-// runtime control: E flips `emitting` (freeze — the streak fades in place),
-// C calls `trail.clear()` on every trail, T teleports the dasher home with a
-// `clear` so no streak spans the jump.
-import { addStartupSystem, addSystemToSchedule, Schedule } from 'esengine';
+// Trails — a tour of the built-in trail renderer. The three emitters are
+// authored in the scene, each a sprite plus the tuned `TrailRenderer` that makes
+// it leave a streak; project systems only move them. Controls: README.md.
+import { addSystemToSchedule, Schedule } from 'esengine';
import './components';
-import { setupSystem } from './systems/setup';
+import { setupSystem } from './systems/labels-setup';
import { motionSystem } from './systems/motion';
import { controlSystem } from './systems/control';
import { labelSystem } from './systems/labels';
-addStartupSystem(setupSystem);
+addSystemToSchedule(Schedule.Update, setupSystem);
addSystemToSchedule(Schedule.Update, motionSystem);
addSystemToSchedule(Schedule.Update, controlSystem);
addSystemToSchedule(Schedule.Update, labelSystem);
diff --git a/examples/trail-demo/src/systems/labels-setup.ts b/examples/trail-demo/src/systems/labels-setup.ts
new file mode 100644
index 000000000..1b6ddc9ec
--- /dev/null
+++ b/examples/trail-demo/src/systems/labels-setup.ts
@@ -0,0 +1,42 @@
+import {
+ defineSystem, Commands, GetWorld, Transform, Text,
+ TextAlign, TextVerticalAlign,
+} from 'esengine';
+import type { Entity, World } from 'esengine';
+import { LabelOf } from '../components';
+
+// The emitters are authored in the scene; this only adds the floating label
+// each one carries (kept over its target by labelSystem).
+const LABELS: ReadonlyArray<[string, string]> = [
+ ['Comet', 'Comet — Lissajous, long additive trail (E freezes it)'],
+ ['Follower', 'Follower — chases the cursor'],
+ ['Dasher', 'Dasher — click to dash (T teleports home + clear)'],
+];
+
+let labelled = false;
+
+export const setupSystem = defineSystem(
+ [Commands(), GetWorld()],
+ (cmds, world: World) => {
+ if (labelled) return;
+ const targets = LABELS.map(([name]) => world.findEntityByName(name));
+ // The scene loads asynchronously; without its emitters there is nothing to
+ // label and the next frame tries again.
+ if (targets.some((t) => t === null)) return;
+ labelled = true;
+
+ for (const [i, [, content]] of LABELS.entries()) {
+ cmds.spawn()
+ .insert(Transform, { position: { x: 0, y: 0, z: 0 } })
+ .insert(Text, {
+ content,
+ fontSize: 15,
+ color: { r: 0.75, g: 0.78, b: 0.88, a: 0.9 },
+ align: TextAlign.Center,
+ verticalAlign: TextVerticalAlign.Bottom,
+ })
+ .insert(LabelOf, { target: targets[i] as Entity });
+ }
+ },
+ { name: 'SetupSystem' },
+);
diff --git a/examples/trail-demo/src/systems/setup.ts b/examples/trail-demo/src/systems/setup.ts
deleted file mode 100644
index 38234b834..000000000
--- a/examples/trail-demo/src/systems/setup.ts
+++ /dev/null
@@ -1,95 +0,0 @@
-import {
- defineSystem, Commands, Transform, Sprite, TrailRenderer, Text,
- TextAlign, TextVerticalAlign, BlendMode,
-} from 'esengine';
-import type { Entity } from 'esengine';
-import { Comet, Follower, Dasher, LabelOf } from '../components';
-import { COMET, DASHER_HOME, COMET_SIZE, FOLLOWER_SIZE, DASHER_SIZE } from '../config';
-
-// Spawns the three emitters, each pairing a small sprite with a differently
-// tuned TrailRenderer, plus a floating world-space label per emitter (kept over
-// its target by labelSystem). Trail recording itself is entirely engine-side.
-export const setupSystem = defineSystem(
- [Commands()],
- (cmds) => {
- const label = (target: Entity, content: string) => {
- cmds.spawn()
- .insert(Transform, { position: { x: 0, y: 0, z: 0 } })
- .insert(Text, {
- content,
- fontSize: 15,
- color: { r: 0.75, g: 0.78, b: 0.88, a: 0.9 },
- align: TextAlign.Center,
- verticalAlign: TextVerticalAlign.Bottom,
- })
- .insert(LabelOf, { target });
- };
-
- // Long additive streak: generous lifetime, wide head tapering to zero,
- // warm head fading to a fully transparent ember red.
- const comet = cmds.spawn('Comet')
- .insert(Transform, { position: { x: COMET.centerX, y: COMET.centerY, z: 0 } })
- .insert(Sprite, {
- size: { x: COMET_SIZE, y: COMET_SIZE },
- color: { r: 1, g: 0.85, b: 0.55, a: 1 },
- layer: 3,
- })
- .insert(TrailRenderer, {
- time: 1.4,
- minVertexDistance: 4,
- startWidth: 26,
- endWidth: 0,
- startColor: { r: 1, g: 0.72, b: 0.3, a: 0.9 },
- endColor: { r: 1, g: 0.2, b: 0.1, a: 0 },
- blendMode: BlendMode.Additive,
- layer: 2,
- })
- .insert(Comet)
- .id();
- label(comet, 'Comet — Lissajous, long additive trail (E freezes it)');
-
- // Cursor trail: default lifetime/spacing, slim cool ribbon, normal blend.
- const follower = cmds.spawn('Follower')
- .insert(Transform, { position: { x: 0, y: 0, z: 0 } })
- .insert(Sprite, {
- size: { x: FOLLOWER_SIZE, y: FOLLOWER_SIZE },
- color: { r: 0.55, g: 0.95, b: 1, a: 1 },
- layer: 3,
- })
- .insert(TrailRenderer, {
- startWidth: 14,
- endWidth: 2,
- startColor: { r: 0.45, g: 0.9, b: 1, a: 0.85 },
- endColor: { r: 0.15, g: 0.35, b: 1, a: 0 },
- layer: 2,
- })
- .insert(Follower)
- .id();
- label(follower, 'Follower — chases the cursor');
-
- // Dash burst: very short lifetime with a wide head, so the streak is a
- // bright slash that vanishes almost immediately. Dense spacing keeps the
- // ribbon smooth over the fast 0.14 s flight.
- const dasher = cmds.spawn('Dasher')
- .insert(Transform, { position: { x: DASHER_HOME.x, y: DASHER_HOME.y, z: 0 } })
- .insert(Sprite, {
- size: { x: DASHER_SIZE, y: DASHER_SIZE },
- color: { r: 0.85, g: 0.7, b: 1, a: 1 },
- layer: 3,
- })
- .insert(TrailRenderer, {
- time: 0.25,
- minVertexDistance: 2,
- startWidth: 44,
- endWidth: 6,
- startColor: { r: 1, g: 1, b: 1, a: 0.95 },
- endColor: { r: 0.6, g: 0.3, b: 1, a: 0 },
- blendMode: BlendMode.Additive,
- layer: 2,
- })
- .insert(Dasher)
- .id();
- label(dasher, 'Dasher — click to dash (T teleports home + clear)');
- },
- { name: 'SetupSystem' },
-);
diff --git a/tools/check-corpus-authoring.mjs b/tools/check-corpus-authoring.mjs
index 2494eebae..b095fdc18 100644
--- a/tools/check-corpus-authoring.mjs
+++ b/tools/check-corpus-authoring.mjs
@@ -120,12 +120,6 @@ const DISPOSITION = {
BitmapText: ['owed', 'Create > Bitmap Text exists; every corpus scene uses Text instead, so the pixel-font path ships unwitnessed'],
- SpriteMask: ['owed', 'space-shooter masks from code; masking is authored geometry and belongs in a scene'],
- TrailRenderer: ['owed', 'Create > Trail exists and trail-demo builds its trail in code'],
- ParticleForceField: ['owed', 'particle-demo adds force fields from code, and the field has a radius gizmo the Inspector already draws'],
- NavArea: ['owed', 'cost-modifying nav regions (mud, road) never appear; enemy-ai-3d authors NavVolume, NavLink and NavObstacle but no area'],
- Marker: ['owed', 'Create > Marker and Create > Trigger Area are one click each, and not one project places either — the converged target for .tmj object groups has no hand-authored instance'],
- Disabled: ['owed', 'queries skip it and the outliner switches it now; what is missing is a scene that ships something switched off — a boss gate, a tutorial-only prop'],
Velocity: ['owed', 'motion without a physics body — the cheapest thing in the engine, authored nowhere'],
};
diff --git a/tools/goldenProjects.mjs b/tools/goldenProjects.mjs
index 1c5732b17..c4f5eea92 100644
--- a/tools/goldenProjects.mjs
+++ b/tools/goldenProjects.mjs
@@ -292,9 +292,10 @@ export const EVIDENCE = {
'third-person': /\b(ThirdPersonController|ThirdPersonCamera)\b/,
particles: /\bParticleEmitter\b/,
'lighting-2d': /\b(Light2D|ShadowCaster2D)\b/,
- // A scene that STATES its draw order, rather than leaving it to where things
- // stand: the field, or the group that takes a subtree's place in the order.
- 'sprite-sorting': /\border:\s*\d|\bSortingGroup\b/,
+ // A scene that STATES its draw order: the field, or the group that takes a
+ // subtree's place in it. The optional quote matches a field set in a SCENE
+ // (`"order": 0`) as well as one set in code.
+ 'sprite-sorting': /\border"?:\s*\d|\bSortingGroup\b/,
'sprite-mask': /\bSpriteMask\b/,
// Components OR the resource: audio-demo takes Res(Audio) and never inserts a
// component, and a pattern that only knew the components read it as unused.
diff --git a/tools/lib/apiEvidence.mjs b/tools/lib/apiEvidence.mjs
index 54e16f8cb..99fae8111 100644
--- a/tools/lib/apiEvidence.mjs
+++ b/tools/lib/apiEvidence.mjs
@@ -112,6 +112,10 @@ export function declarationsOf(wanted, program, checker) {
export { createSdkProgram };
+/** Frozen, and its only users write it into a scene rather than importing it —
+ * so the corpus holds MORE of it than before and `exercised` sees none. */
+const AUTHORED_INSTEAD = (what) => `${what} — the corpus writes it in scenes, which \`exercised\` does not read`;
+
/**
* Symbols the evidence above cannot see, and why. Each is handed to a system body
* by a declared parameter, or built by the engine on a game's behalf: a golden
@@ -130,10 +134,11 @@ export const BLIND = {
// game reads it and every golden project's layout walks it every frame, but
// nothing imports the name.
Children: 'engine-maintained from Parent — walked every frame, named in no import list',
- // A newer blindness: `exercised` reads a project's TypeScript, and this unit
- // is what a SCENE writes as `unit: 1`. The one golden project that laid UI
- // out in code now authors that panel, so the evidence moved out of reach.
- percent: 'the code spelling of a unit every authored UINode carries — the corpus writes it in scenes, which `exercised` does not read',
+ // A newer blindness, and one that grows as the corpus moves from building
+ // things in code to AUTHORING them: `exercised` reads a golden project's
+ // TypeScript, and a scene writes these as plain numbers.
+ percent: AUTHORED_INSTEAD('the code spelling of a unit every authored UINode carries'),
+ SpriteMaskInteraction: AUTHORED_INSTEAD("the enum behind Sprite.maskInteraction, which space-shooter's hull bar now sets in its scene"),
CommandsInstance: RECEIVED,
EntityCommands: RECEIVED,
EventReaderInstance: RECEIVED,