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.

fix(nav): a tilemap's rows run down, a nav grid's run up

esengine3364ab8c9974
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 07d888f54..8e1bcd64b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -59,6 +59,25 @@ published separately; it ships inside the editor.
a GPU. The unmasked strings are read where the browser allows it, so a report
now names `ANGLE Metal Renderer: Apple M4` instead of a constant.
+### Fixed
+
+- **Navigation built from a tilemap was upside down, so enemies walked into
+ walls and stood still in the open.** `navGridFromTilemapLayer` read tilemap row
+ `y` for nav cell `y`, but the two count in opposite directions: a tilemap's row
+ 0 is its TOP (`centre.y = originY - (row + 0.5) * tileH`) while a nav grid's
+ cell 0 is its BOTTOM (`cellToWorld.y = originY + gy * cellSize`). Every
+ obstacle therefore landed mirrored about the map's middle, and no `origin`
+ could correct it — the mirroring was in the row mapping, not the offset.
+
+ The visible symptom was worse than a wrong path: an agent whose own cell fell
+ outside the grid found no path at all and never moved, so an enemy that could
+ plainly see the player simply stood there.
+
+ The row is now flipped inside the wrapper, and `origin` keeps the meaning it
+ has everywhere else — the world centre of the bottom-left cell. The pure core
+ (`navGridFromTiles`) was always right and always tested; the seam where two
+ subsystems with opposite conventions meet had no test, and now does.
+
## [0.47.0] - 2026-08-08
### Added
diff --git a/examples/celestial-heights/THIRD_PARTY_ASSETS.md b/examples/celestial-heights/THIRD_PARTY_ASSETS.md
index b7d4e8c15..452ce4594 100644
--- a/examples/celestial-heights/THIRD_PARTY_ASSETS.md
+++ b/examples/celestial-heights/THIRD_PARTY_ASSETS.md
@@ -9,7 +9,17 @@ One row per asset or asset pack:
| Asset | Where it is used | Source | Licence | Attribution required |
|---|---|---|---|---|
-| _(none yet — the project runs on placeholder primitives)_ | | | | |
+| _(none yet — see placeholders below)_ | | | | |
+
+## Placeholders in the tree
+
+| File | Stands in for | Shape it commits to |
+|---|---|---|
+| `assets/textures/tileset.png` | the terrain atlas | 6 tiles, 64×64, one row, no margin or spacing; ids 1–3 walkable (grass, path, blossom), 4–6 solid (rock, water, wall) |
+
+Actors are still untextured `Sprite` colour quads at their final sizes: Lyra
+84×150, a wisp 64×96. Replacing any of these is a swap of the file plus the
+licence row above — not a change to a scene or a system.
## Rules
diff --git a/examples/celestial-heights/assets/scenes/main.esscene b/examples/celestial-heights/assets/scenes/main.esscene
index e55b0bae0..677df6eb9 100644
--- a/examples/celestial-heights/assets/scenes/main.esscene
+++ b/examples/celestial-heights/assets/scenes/main.esscene
@@ -1,210 +1,797 @@
{
"version": "1.0",
- "name": "Main",
- "folders": ["Environment", "Actors"],
+ "name": "main",
+ "folders": [
+ "Environment",
+ "Actors"
+ ],
"entities": [
{
"id": 0,
"name": "Camera",
"parent": null,
"children": [],
+ "visible": true,
"components": [
- { "type": "Transform", "data": { "position": { "x": 0, "y": 0, "z": 10 } } },
- { "type": "Camera", "data": { "projectionType": 1, "orthoSize": 540, "isActive": true, "priority": 0 } }
- ],
- "visible": true
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -992,
+ "y": -32,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 540,
+ "isActive": true,
+ "priority": 0
+ }
+ },
+ {
+ "type": "FollowTarget",
+ "data": {
+ "target": -1,
+ "offsetX": 0,
+ "offsetY": 0,
+ "deadzone": 40,
+ "damping": 0.18
+ }
+ }
+ ]
},
{
"id": 1,
- "name": "Ground",
+ "name": "Terrain",
"parent": null,
"children": [],
"folder": "Environment",
+ "visible": true,
"components": [
- { "type": "Transform", "data": { "position": { "x": 0, "y": 0, "z": 0 } } },
- { "type": "Sprite", "data": { "size": { "x": 1600, "y": 900 }, "color": { "r": 0.106, "g": 0.09, "b": 0.169, "a": 1 }, "layer": 0 } }
- ],
- "visible": true
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -1280,
+ "y": 768,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "TilemapLayer",
+ "data": {
+ "cellSize": {
+ "x": 64,
+ "y": 64
+ },
+ "renderLayer": 0,
+ "opacity": 1,
+ "visible": true,
+ "tilesetAsset": "@uuid:cf5ed115-8369-48af-bbd1-163efd25c1aa",
+ "collidableTileIds": [
+ 4,
+ 5,
+ 6
+ ],
+ "chunks": "RVNUTQYAAAAAAAAAAAAAAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAYAAQABAAEAAQADAAMAAwADAAMAAwADAAEAAQABAAEABgABAAEAAQABAAMAAwADAAMAAwADAAMAAQABAAUABQAGAAEAAQABAAEAAwADAAMAAwADAAMAAwABAAEABQAFAAYAAQABAAEAAQADAAMAAwADAAMAAwADAAEAAQAFAAUABgABAAEAAQABAAMAAwADAAMAAwADAAMAAQABAAUABQAGAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEABQAFAAYAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEABgABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAYAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIABgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAGAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAYAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAAYAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAYABgABAAEAAQABAAEAAQABAAEAAQABAAUABQAFAAEABgAGAAEAAQABAAEAAQAEAA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"name": "CobblestonePath",
+ "id": 40,
+ "name": "Gate",
"parent": null,
"children": [],
"folder": "Environment",
+ "visible": true,
"components": [
- { "type": "Transform", "data": { "position": { "x": 0, "y": -120, "z": 0 } } },
- { "type": "Sprite", "data": { "size": { "x": 1200, "y": 260 }, "color": { "r": 0.192, "g": 0.169, "b": 0.263, "a": 1 }, "layer": 1 } }
- ],
- "visible": true
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 1120,
+ "y": -32,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 72,
+ "y": 132
+ },
+ "color": {
+ "r": 0.545,
+ "g": 0.902,
+ "b": 0.918,
+ "a": 1
+ },
+ "layer": 2
+ }
+ },
+ {
+ "type": "Gate",
+ "data": {
+ "toScene": "moonlit-gallery",
+ "radius": 90
+ }
+ }
+ ]
},
{
- "id": 10,
- "name": "Wall_North",
+ "id": 20,
+ "name": "Lyra_Player",
"parent": null,
"children": [],
- "folder": "Environment",
+ "folder": "Actors",
+ "visible": true,
"components": [
- { "type": "Transform", "data": { "position": { "x": 0, "y": 470, "z": 0 } } },
- { "type": "Sprite", "data": { "size": { "x": 1680, "y": 40 }, "color": { "r": 0.267, "g": 0.235, "b": 0.361, "a": 1 }, "layer": 2 } },
- { "type": "RigidBody", "data": { "bodyType": 0 } },
- { "type": "BoxCollider", "data": { "halfExtents": { "x": 8.4, "y": 0.2 }, "categoryBits": 1, "maskBits": 65535 } }
- ],
- "visible": true
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -992,
+ "y": -32,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 84,
+ "y": 150
+ },
+ "color": {
+ "r": 0.855,
+ "g": 0.788,
+ "b": 0.976,
+ "a": 1
+ },
+ "layer": 2
+ }
+ },
+ {
+ "type": "Player",
+ "data": {
+ "speed": 380
+ }
+ },
+ {
+ "type": "Facing",
+ "data": {
+ "x": 1,
+ "y": 0
+ }
+ },
+ {
+ "type": "Health",
+ "data": {
+ "current": 120,
+ "max": 120,
+ "invulnerability": 0.5,
+ "invulnerable": 0
+ }
+ },
+ {
+ "type": "MeleeAttack",
+ "data": {
+ "damage": 30,
+ "reach": 110,
+ "arcDegrees": 120,
+ "cooldown": 0.4,
+ "cooldownLeft": 0,
+ "pending": false,
+ "hits": 4
+ }
+ },
+ {
+ "type": "PerceptionTarget",
+ "data": {}
+ },
+ {
+ "type": "RigidBody",
+ "data": {
+ "bodyType": 1
+ }
+ },
+ {
+ "type": "CircleCollider",
+ "data": {
+ "radius": 0.3,
+ "offset": {
+ "x": 0,
+ "y": -0.5
+ },
+ "categoryBits": 2,
+ "maskBits": 1
+ }
+ },
+ {
+ "type": "CharacterController",
+ "data": {
+ "up": {
+ "x": 0,
+ "y": 1
+ },
+ "snapLength": 0,
+ "maskBits": 1
+ }
+ }
+ ]
},
{
- "id": 11,
- "name": "Wall_South",
+ "id": 30,
+ "name": "Wisp_30",
"parent": null,
- "children": [],
- "folder": "Environment",
- "components": [
- { "type": "Transform", "data": { "position": { "x": 0, "y": -470, "z": 0 } } },
- { "type": "Sprite", "data": { "size": { "x": 1680, "y": 40 }, "color": { "r": 0.267, "g": 0.235, "b": 0.361, "a": 1 }, "layer": 2 } },
- { "type": "RigidBody", "data": { "bodyType": 0 } },
- { "type": "BoxCollider", "data": { "halfExtents": { "x": 8.4, "y": 0.2 }, "categoryBits": 1, "maskBits": 65535 } }
+ "children": [
+ 300,
+ 301
],
- "visible": true
- },
- {
- "id": 12,
- "name": "Wall_West",
- "parent": null,
- "children": [],
- "folder": "Environment",
- "components": [
- { "type": "Transform", "data": { "position": { "x": -820, "y": 0, "z": 0 } } },
- { "type": "Sprite", "data": { "size": { "x": 40, "y": 940 }, "color": { "r": 0.267, "g": 0.235, "b": 0.361, "a": 1 }, "layer": 2 } },
- { "type": "RigidBody", "data": { "bodyType": 0 } },
- { "type": "BoxCollider", "data": { "halfExtents": { "x": 0.2, "y": 4.7 }, "categoryBits": 1, "maskBits": 65535 } }
- ],
- "visible": true
- },
- {
- "id": 13,
- "name": "Wall_East",
- "parent": null,
- "children": [],
- "folder": "Environment",
+ "folder": "Actors",
+ "visible": true,
"components": [
- { "type": "Transform", "data": { "position": { "x": 820, "y": 0, "z": 0 } } },
- { "type": "Sprite", "data": { "size": { "x": 40, "y": 940 }, "color": { "r": 0.267, "g": 0.235, "b": 0.361, "a": 1 }, "layer": 2 } },
- { "type": "RigidBody", "data": { "bodyType": 0 } },
- { "type": "BoxCollider", "data": { "halfExtents": { "x": 0.2, "y": 4.7 }, "categoryBits": 1, "maskBits": 65535 } }
- ],
- "visible": true
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -96,
+ "y": -224,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 64,
+ "y": 96
+ },
+ "color": {
+ "r": 0.412,
+ "g": 0.812,
+ "b": 0.902,
+ "a": 1
+ },
+ "layer": 2
+ }
+ },
+ {
+ "type": "Enemy",
+ "data": {}
+ },
+ {
+ "type": "Facing",
+ "data": {
+ "x": -1,
+ "y": 0
+ }
+ },
+ {
+ "type": "Health",
+ "data": {
+ "current": 60,
+ "max": 60,
+ "invulnerability": 0.2,
+ "invulnerable": 0
+ }
+ },
+ {
+ "type": "MeleeAttack",
+ "data": {
+ "damage": 12,
+ "reach": 76,
+ "arcDegrees": 160,
+ "cooldown": 1.2,
+ "cooldownLeft": 0,
+ "pending": false,
+ "hits": 2
+ }
+ },
+ {
+ "type": "Perceiver",
+ "data": {
+ "range": 380,
+ "fovDegrees": 360
+ }
+ },
+ {
+ "type": "NavAgent",
+ "data": {
+ "speed": 150,
+ "arriveRadius": 48,
+ "repathInterval": 0.4
+ }
+ },
+ {
+ "type": "BehaviorTreeAgent",
+ "data": {
+ "bt": "assets/ai/wisp.esbt"
+ }
+ },
+ {
+ "type": "RigidBody",
+ "data": {
+ "bodyType": 1
+ }
+ },
+ {
+ "type": "CircleCollider",
+ "data": {
+ "radius": 0.26,
+ "offset": {
+ "x": 0,
+ "y": -0.3
+ },
+ "categoryBits": 4,
+ "maskBits": 1
+ }
+ }
+ ]
},
{
- "id": 20,
- "name": "Lyra_Player",
- "parent": null,
+ "id": 300,
+ "name": "HealthBar_Back",
+ "parent": 30,
"children": [],
"folder": "Actors",
+ "visible": true,
"components": [
- { "type": "Transform", "data": { "position": { "x": -260, "y": -90, "z": 0 } } },
- { "type": "Sprite", "data": { "size": { "x": 84, "y": 150 }, "color": { "r": 0.855, "g": 0.788, "b": 0.976, "a": 1 }, "layer": 2 } },
- { "type": "Player", "data": { "speed": 380 } },
- { "type": "Facing", "data": { "x": 1, "y": 0 } },
- { "type": "Health", "data": { "current": 120, "max": 120, "invulnerability": 0.5, "invulnerable": 0 } },
- { "type": "MeleeAttack", "data": { "damage": 30, "reach": 110, "arcDegrees": 120, "cooldown": 0.4, "cooldownLeft": 0, "pending": false, "hits": 4 } },
- { "type": "PerceptionTarget", "data": {} },
- { "type": "RigidBody", "data": { "bodyType": 1 } },
- { "type": "CircleCollider", "data": { "radius": 0.3, "offset": { "x": 0, "y": -0.5 }, "categoryBits": 2, "maskBits": 1 } },
- { "type": "CharacterController", "data": { "up": { "x": 0, "y": 1 }, "snapLength": 0, "maskBits": 1 } }
- ],
- "visible": true
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 66,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 76,
+ "y": 12
+ },
+ "color": {
+ "r": 0.078,
+ "g": 0.067,
+ "b": 0.125,
+ "a": 1
+ },
+ "layer": 3
+ }
+ }
+ ]
},
{
- "id": 30,
- "name": "Wisp_A",
- "parent": null,
- "children": [300, 301],
+ "id": 301,
+ "name": "HealthBar_Fill",
+ "parent": 30,
+ "children": [],
"folder": "Actors",
+ "visible": true,
"components": [
- { "type": "Transform", "data": { "position": { "x": 320, "y": 150, "z": 0 } } },
- { "type": "Sprite", "data": { "size": { "x": 64, "y": 96 }, "color": { "r": 0.412, "g": 0.812, "b": 0.902, "a": 1 }, "layer": 2 } },
- { "type": "Enemy", "data": {} },
- { "type": "Facing", "data": { "x": -1, "y": 0 } },
- { "type": "Health", "data": { "current": 60, "max": 60, "invulnerability": 0.2, "invulnerable": 0 } },
- { "type": "MeleeAttack", "data": { "damage": 12, "reach": 76, "arcDegrees": 160, "cooldown": 1.2, "cooldownLeft": 0, "pending": false, "hits": 2 } },
- { "type": "Perceiver", "data": { "range": 380, "fovDegrees": 360 } },
- { "type": "NavAgent", "data": { "speed": 150, "arriveRadius": 48, "repathInterval": 0.35 } },
- { "type": "BehaviorTreeAgent", "data": { "bt": "assets/ai/wisp.esbt" } },
- { "type": "RigidBody", "data": { "bodyType": 1 } },
- { "type": "CircleCollider", "data": { "radius": 0.26, "offset": { "x": 0, "y": -0.3 }, "categoryBits": 4, "maskBits": 1 } }
- ],
- "visible": true
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 66,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 72,
+ "y": 8
+ },
+ "color": {
+ "r": 0.906,
+ "g": 0.353,
+ "b": 0.412,
+ "a": 1
+ },
+ "layer": 3
+ }
+ },
+ {
+ "type": "HealthBarFill",
+ "data": {
+ "width": 72
+ }
+ }
+ ]
},
{
"id": 31,
- "name": "Wisp_B",
+ "name": "Wisp_31",
"parent": null,
- "children": [310, 311],
+ "children": [
+ 310,
+ 311
+ ],
"folder": "Actors",
+ "visible": true,
"components": [
- { "type": "Transform", "data": { "position": { "x": 460, "y": -220, "z": 0 } } },
- { "type": "Sprite", "data": { "size": { "x": 64, "y": 96 }, "color": { "r": 0.522, "g": 0.729, "b": 0.976, "a": 1 }, "layer": 2 } },
- { "type": "Enemy", "data": {} },
- { "type": "Facing", "data": { "x": -1, "y": 0 } },
- { "type": "Health", "data": { "current": 60, "max": 60, "invulnerability": 0.2, "invulnerable": 0 } },
- { "type": "MeleeAttack", "data": { "damage": 12, "reach": 76, "arcDegrees": 160, "cooldown": 1.4, "cooldownLeft": 0, "pending": false, "hits": 2 } },
- { "type": "Perceiver", "data": { "range": 320, "fovDegrees": 360 } },
- { "type": "NavAgent", "data": { "speed": 125, "arriveRadius": 48, "repathInterval": 0.5 } },
- { "type": "BehaviorTreeAgent", "data": { "bt": "assets/ai/wisp.esbt" } },
- { "type": "RigidBody", "data": { "bodyType": 1 } },
- { "type": "CircleCollider", "data": { "radius": 0.26, "offset": { "x": 0, "y": -0.3 }, "categoryBits": 4, "maskBits": 1 } }
- ],
- "visible": true
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 416,
+ "y": 96,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 64,
+ "y": 96
+ },
+ "color": {
+ "r": 0.522,
+ "g": 0.729,
+ "b": 0.976,
+ "a": 1
+ },
+ "layer": 2
+ }
+ },
+ {
+ "type": "Enemy",
+ "data": {}
+ },
+ {
+ "type": "Facing",
+ "data": {
+ "x": -1,
+ "y": 0
+ }
+ },
+ {
+ "type": "Health",
+ "data": {
+ "current": 60,
+ "max": 60,
+ "invulnerability": 0.2,
+ "invulnerable": 0
+ }
+ },
+ {
+ "type": "MeleeAttack",
+ "data": {
+ "damage": 12,
+ "reach": 76,
+ "arcDegrees": 160,
+ "cooldown": 1.4,
+ "cooldownLeft": 0,
+ "pending": false,
+ "hits": 2
+ }
+ },
+ {
+ "type": "Perceiver",
+ "data": {
+ "range": 320,
+ "fovDegrees": 360
+ }
+ },
+ {
+ "type": "NavAgent",
+ "data": {
+ "speed": 125,
+ "arriveRadius": 48,
+ "repathInterval": 0.4
+ }
+ },
+ {
+ "type": "BehaviorTreeAgent",
+ "data": {
+ "bt": "assets/ai/wisp.esbt"
+ }
+ },
+ {
+ "type": "RigidBody",
+ "data": {
+ "bodyType": 1
+ }
+ },
+ {
+ "type": "CircleCollider",
+ "data": {
+ "radius": 0.26,
+ "offset": {
+ "x": 0,
+ "y": -0.3
+ },
+ "categoryBits": 4,
+ "maskBits": 1
+ }
+ }
+ ]
},
{
- "id": 300,
+ "id": 310,
"name": "HealthBar_Back",
- "parent": 30,
+ "parent": 31,
"children": [],
"folder": "Actors",
+ "visible": true,
"components": [
- { "type": "Transform", "data": { "position": { "x": 0, "y": 66, "z": 0 } } },
- { "type": "Sprite", "data": { "size": { "x": 76, "y": 12 }, "color": { "r": 0.078, "g": 0.067, "b": 0.125, "a": 1 }, "layer": 3 } }
- ],
- "visible": true
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 66,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 76,
+ "y": 12
+ },
+ "color": {
+ "r": 0.078,
+ "g": 0.067,
+ "b": 0.125,
+ "a": 1
+ },
+ "layer": 3
+ }
+ }
+ ]
},
{
- "id": 301,
+ "id": 311,
"name": "HealthBar_Fill",
- "parent": 30,
+ "parent": 31,
"children": [],
"folder": "Actors",
+ "visible": true,
"components": [
- { "type": "Transform", "data": { "position": { "x": 0, "y": 66, "z": 0 } } },
- { "type": "Sprite", "data": { "size": { "x": 72, "y": 8 }, "color": { "r": 0.906, "g": 0.353, "b": 0.412, "a": 1 }, "layer": 3 } },
- { "type": "HealthBarFill", "data": { "width": 72 } }
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 66,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 72,
+ "y": 8
+ },
+ "color": {
+ "r": 0.906,
+ "g": 0.353,
+ "b": 0.412,
+ "a": 1
+ },
+ "layer": 3
+ }
+ },
+ {
+ "type": "HealthBarFill",
+ "data": {
+ "width": 72
+ }
+ }
+ ]
+ },
+ {
+ "id": 32,
+ "name": "Wisp_32",
+ "parent": null,
+ "children": [
+ 320,
+ 321
],
- "visible": true
+ "folder": "Actors",
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 736,
+ "y": -416,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 64,
+ "y": 96
+ },
+ "color": {
+ "r": 0.643,
+ "g": 0.647,
+ "b": 0.988,
+ "a": 1
+ },
+ "layer": 2
+ }
+ },
+ {
+ "type": "Enemy",
+ "data": {}
+ },
+ {
+ "type": "Facing",
+ "data": {
+ "x": -1,
+ "y": 0
+ }
+ },
+ {
+ "type": "Health",
+ "data": {
+ "current": 60,
+ "max": 60,
+ "invulnerability": 0.2,
+ "invulnerable": 0
+ }
+ },
+ {
+ "type": "MeleeAttack",
+ "data": {
+ "damage": 12,
+ "reach": 76,
+ "arcDegrees": 160,
+ "cooldown": 1.3,
+ "cooldownLeft": 0,
+ "pending": false,
+ "hits": 2
+ }
+ },
+ {
+ "type": "Perceiver",
+ "data": {
+ "range": 340,
+ "fovDegrees": 360
+ }
+ },
+ {
+ "type": "NavAgent",
+ "data": {
+ "speed": 135,
+ "arriveRadius": 48,
+ "repathInterval": 0.4
+ }
+ },
+ {
+ "type": "BehaviorTreeAgent",
+ "data": {
+ "bt": "assets/ai/wisp.esbt"
+ }
+ },
+ {
+ "type": "RigidBody",
+ "data": {
+ "bodyType": 1
+ }
+ },
+ {
+ "type": "CircleCollider",
+ "data": {
+ "radius": 0.26,
+ "offset": {
+ "x": 0,
+ "y": -0.3
+ },
+ "categoryBits": 4,
+ "maskBits": 1
+ }
+ }
+ ]
},
{
- "id": 310,
+ "id": 320,
"name": "HealthBar_Back",
- "parent": 31,
+ "parent": 32,
"children": [],
"folder": "Actors",
+ "visible": true,
"components": [
- { "type": "Transform", "data": { "position": { "x": 0, "y": 66, "z": 0 } } },
- { "type": "Sprite", "data": { "size": { "x": 76, "y": 12 }, "color": { "r": 0.078, "g": 0.067, "b": 0.125, "a": 1 }, "layer": 3 } }
- ],
- "visible": true
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 66,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 76,
+ "y": 12
+ },
+ "color": {
+ "r": 0.078,
+ "g": 0.067,
+ "b": 0.125,
+ "a": 1
+ },
+ "layer": 3
+ }
+ }
+ ]
},
{
- "id": 311,
+ "id": 321,
"name": "HealthBar_Fill",
- "parent": 31,
+ "parent": 32,
"children": [],
"folder": "Actors",
+ "visible": true,
"components": [
- { "type": "Transform", "data": { "position": { "x": 0, "y": 66, "z": 0 } } },
- { "type": "Sprite", "data": { "size": { "x": 72, "y": 8 }, "color": { "r": 0.906, "g": 0.353, "b": 0.412, "a": 1 }, "layer": 3 } },
- { "type": "HealthBarFill", "data": { "width": 72 } }
- ],
- "visible": true
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 66,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 72,
+ "y": 8
+ },
+ "color": {
+ "r": 0.906,
+ "g": 0.353,
+ "b": 0.412,
+ "a": 1
+ },
+ "layer": 3
+ }
+ },
+ {
+ "type": "HealthBarFill",
+ "data": {
+ "width": 72
+ }
+ }
+ ]
}
]
}
diff --git a/examples/celestial-heights/assets/scenes/moonlit-gallery.esscene b/examples/celestial-heights/assets/scenes/moonlit-gallery.esscene
new file mode 100644
index 000000000..2a1e76d5f
--- /dev/null
+++ b/examples/celestial-heights/assets/scenes/moonlit-gallery.esscene
@@ -0,0 +1,609 @@
+{
+ "version": "1.0",
+ "name": "moonlit-gallery",
+ "folders": [
+ "Environment",
+ "Actors"
+ ],
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -864,
+ "y": -32,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 540,
+ "isActive": true,
+ "priority": 0
+ }
+ },
+ {
+ "type": "FollowTarget",
+ "data": {
+ "target": -1,
+ "offsetX": 0,
+ "offsetY": 0,
+ "deadzone": 40,
+ "damping": 0.18
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Terrain",
+ "parent": null,
+ "children": [],
+ "folder": "Environment",
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -1024,
+ "y": 640,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "TilemapLayer",
+ "data": {
+ "cellSize": {
+ "x": 64,
+ "y": 64
+ },
+ "renderLayer": 0,
+ "opacity": 1,
+ "visible": true,
+ "tilesetAsset": "@uuid:cf5ed115-8369-48af-bbd1-163efd25c1aa",
+ "collidableTileIds": [
+ 4,
+ 5,
+ 6
+ ],
+ "chunks": "RVNUTQQAAAAAAAAAAAAAAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAGAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIABAAEAAYAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAEAAQABgACAAIAAgACAAYABgACAAIAAgACAAYABgACAAIAAgAGAAIAAgACAAIABgAGAAIAAgACAAIABgAGAAIAAgACAAYAAgACAAIAAgAGAAYAAgACAAIAAgAGAAYAAgACAAIABgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAGAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAYAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAGAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAYAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIABgACAAIAAgACAAYABgACAAIAAgACAAYABgACAAIAAgAGAAIAAgACAAIABgAGAAIAAgACAAIABgAGAAIAAgACAAYAAgACAAIAAgAGAAYAAgACAAIAAgAGAAYAAgACAAIAAQAAAAAAAAAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAYABAAEAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIABgAEAAQAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAGAAIABgAGAAIAAgACAAIABgAGAAIAAgACAAIAAgACAAYAAgAGAAYAAgACAAIAAgAGAAYAAgACAAIAAgACAAIABgACAAYABgACAAIAAgACAAYABgACAAIAAgACAAIAAgAGAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAYAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIABgADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAGAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIABgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAGAAIABgAGAAIAAgACAAIABgAGAAIAAgACAAIAAgACAAYAAgAGAAYAAgACAAIAAgAGAAYAAgACAAIAAgACAAIABgACAAYABgACAAIAAgACAAYABgACAAIAAgACAAIAAgAGAAAAAAABAAAABgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAQABAAGAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIABAAEAAYAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAA"
+ }
+ }
+ ]
+ },
+ {
+ "id": 40,
+ "name": "Gate",
+ "parent": null,
+ "children": [],
+ "folder": "Environment",
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 928,
+ "y": -32,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 72,
+ "y": 132
+ },
+ "color": {
+ "r": 0.545,
+ "g": 0.902,
+ "b": 0.918,
+ "a": 1
+ },
+ "layer": 2
+ }
+ },
+ {
+ "type": "Gate",
+ "data": {
+ "toScene": "main",
+ "radius": 90
+ }
+ }
+ ]
+ },
+ {
+ "id": 20,
+ "name": "Lyra_Player",
+ "parent": null,
+ "children": [],
+ "folder": "Actors",
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -864,
+ "y": -32,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 84,
+ "y": 150
+ },
+ "color": {
+ "r": 0.855,
+ "g": 0.788,
+ "b": 0.976,
+ "a": 1
+ },
+ "layer": 2
+ }
+ },
+ {
+ "type": "Player",
+ "data": {
+ "speed": 380
+ }
+ },
+ {
+ "type": "Facing",
+ "data": {
+ "x": 1,
+ "y": 0
+ }
+ },
+ {
+ "type": "Health",
+ "data": {
+ "current": 120,
+ "max": 120,
+ "invulnerability": 0.5,
+ "invulnerable": 0
+ }
+ },
+ {
+ "type": "MeleeAttack",
+ "data": {
+ "damage": 30,
+ "reach": 110,
+ "arcDegrees": 120,
+ "cooldown": 0.4,
+ "cooldownLeft": 0,
+ "pending": false,
+ "hits": 4
+ }
+ },
+ {
+ "type": "PerceptionTarget",
+ "data": {}
+ },
+ {
+ "type": "RigidBody",
+ "data": {
+ "bodyType": 1
+ }
+ },
+ {
+ "type": "CircleCollider",
+ "data": {
+ "radius": 0.3,
+ "offset": {
+ "x": 0,
+ "y": -0.5
+ },
+ "categoryBits": 2,
+ "maskBits": 1
+ }
+ },
+ {
+ "type": "CharacterController",
+ "data": {
+ "up": {
+ "x": 0,
+ "y": 1
+ },
+ "snapLength": 0,
+ "maskBits": 1
+ }
+ }
+ ]
+ },
+ {
+ "id": 30,
+ "name": "Wisp_30",
+ "parent": null,
+ "children": [
+ 300,
+ 301
+ ],
+ "folder": "Actors",
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 32,
+ "y": 224,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 64,
+ "y": 96
+ },
+ "color": {
+ "r": 0.412,
+ "g": 0.812,
+ "b": 0.902,
+ "a": 1
+ },
+ "layer": 2
+ }
+ },
+ {
+ "type": "Enemy",
+ "data": {}
+ },
+ {
+ "type": "Facing",
+ "data": {
+ "x": -1,
+ "y": 0
+ }
+ },
+ {
+ "type": "Health",
+ "data": {
+ "current": 60,
+ "max": 60,
+ "invulnerability": 0.2,
+ "invulnerable": 0
+ }
+ },
+ {
+ "type": "MeleeAttack",
+ "data": {
+ "damage": 12,
+ "reach": 76,
+ "arcDegrees": 160,
+ "cooldown": 1.1,
+ "cooldownLeft": 0,
+ "pending": false,
+ "hits": 2
+ }
+ },
+ {
+ "type": "Perceiver",
+ "data": {
+ "range": 400,
+ "fovDegrees": 360
+ }
+ },
+ {
+ "type": "NavAgent",
+ "data": {
+ "speed": 160,
+ "arriveRadius": 48,
+ "repathInterval": 0.4
+ }
+ },
+ {
+ "type": "BehaviorTreeAgent",
+ "data": {
+ "bt": "assets/ai/wisp.esbt"
+ }
+ },
+ {
+ "type": "RigidBody",
+ "data": {
+ "bodyType": 1
+ }
+ },
+ {
+ "type": "CircleCollider",
+ "data": {
+ "radius": 0.26,
+ "offset": {
+ "x": 0,
+ "y": -0.3
+ },
+ "categoryBits": 4,
+ "maskBits": 1
+ }
+ }
+ ]
+ },
+ {
+ "id": 300,
+ "name": "HealthBar_Back",
+ "parent": 30,
+ "children": [],
+ "folder": "Actors",
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 66,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 76,
+ "y": 12
+ },
+ "color": {
+ "r": 0.078,
+ "g": 0.067,
+ "b": 0.125,
+ "a": 1
+ },
+ "layer": 3
+ }
+ }
+ ]
+ },
+ {
+ "id": 301,
+ "name": "HealthBar_Fill",
+ "parent": 30,
+ "children": [],
+ "folder": "Actors",
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 66,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 72,
+ "y": 8
+ },
+ "color": {
+ "r": 0.906,
+ "g": 0.353,
+ "b": 0.412,
+ "a": 1
+ },
+ "layer": 3
+ }
+ },
+ {
+ "type": "HealthBarFill",
+ "data": {
+ "width": 72
+ }
+ }
+ ]
+ },
+ {
+ "id": 31,
+ "name": "Wisp_31",
+ "parent": null,
+ "children": [
+ 310,
+ 311
+ ],
+ "folder": "Actors",
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 416,
+ "y": -224,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 64,
+ "y": 96
+ },
+ "color": {
+ "r": 0.522,
+ "g": 0.729,
+ "b": 0.976,
+ "a": 1
+ },
+ "layer": 2
+ }
+ },
+ {
+ "type": "Enemy",
+ "data": {}
+ },
+ {
+ "type": "Facing",
+ "data": {
+ "x": -1,
+ "y": 0
+ }
+ },
+ {
+ "type": "Health",
+ "data": {
+ "current": 60,
+ "max": 60,
+ "invulnerability": 0.2,
+ "invulnerable": 0
+ }
+ },
+ {
+ "type": "MeleeAttack",
+ "data": {
+ "damage": 12,
+ "reach": 76,
+ "arcDegrees": 160,
+ "cooldown": 1.3,
+ "cooldownLeft": 0,
+ "pending": false,
+ "hits": 2
+ }
+ },
+ {
+ "type": "Perceiver",
+ "data": {
+ "range": 360,
+ "fovDegrees": 360
+ }
+ },
+ {
+ "type": "NavAgent",
+ "data": {
+ "speed": 140,
+ "arriveRadius": 48,
+ "repathInterval": 0.4
+ }
+ },
+ {
+ "type": "BehaviorTreeAgent",
+ "data": {
+ "bt": "assets/ai/wisp.esbt"
+ }
+ },
+ {
+ "type": "RigidBody",
+ "data": {
+ "bodyType": 1
+ }
+ },
+ {
+ "type": "CircleCollider",
+ "data": {
+ "radius": 0.26,
+ "offset": {
+ "x": 0,
+ "y": -0.3
+ },
+ "categoryBits": 4,
+ "maskBits": 1
+ }
+ }
+ ]
+ },
+ {
+ "id": 310,
+ "name": "HealthBar_Back",
+ "parent": 31,
+ "children": [],
+ "folder": "Actors",
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 66,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 76,
+ "y": 12
+ },
+ "color": {
+ "r": 0.078,
+ "g": 0.067,
+ "b": 0.125,
+ "a": 1
+ },
+ "layer": 3
+ }
+ }
+ ]
+ },
+ {
+ "id": 311,
+ "name": "HealthBar_Fill",
+ "parent": 31,
+ "children": [],
+ "folder": "Actors",
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 66,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 72,
+ "y": 8
+ },
+ "color": {
+ "r": 0.906,
+ "g": 0.353,
+ "b": 0.412,
+ "a": 1
+ },
+ "layer": 3
+ }
+ },
+ {
+ "type": "HealthBarFill",
+ "data": {
+ "width": 72
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/examples/celestial-heights/assets/scenes/moonlit-gallery.esscene.meta b/examples/celestial-heights/assets/scenes/moonlit-gallery.esscene.meta
new file mode 100644
index 000000000..74a29a4d6
--- /dev/null
+++ b/examples/celestial-heights/assets/scenes/moonlit-gallery.esscene.meta
@@ -0,0 +1,8 @@
+{
+ "uuid": "f3dc6c98-4fba-44ee-a79a-7145b959205f",
+ "version": "2.0",
+ "type": "scene",
+ "importer": {
+ "autoMigrate": true
+ }
+}
diff --git a/examples/celestial-heights/assets/textures/tileset.png b/examples/celestial-heights/assets/textures/tileset.png
new file mode 100644
index 000000000..17b09b37c
Binary files /dev/null and b/examples/celestial-heights/assets/textures/tileset.png differ
diff --git a/examples/celestial-heights/assets/textures/tileset.png.meta b/examples/celestial-heights/assets/textures/tileset.png.meta
new file mode 100644
index 000000000..20e7b19c5
--- /dev/null
+++ b/examples/celestial-heights/assets/textures/tileset.png.meta
@@ -0,0 +1,17 @@
+{
+ "uuid": "110f13ee-8280-4e9c-8bce-a5207e31edf6",
+ "version": "2.0",
+ "type": "texture",
+ "importer": {
+ "maxSize": 2048,
+ "filterMode": "nearest",
+ "wrapMode": "clamp",
+ "premultiplyAlpha": false,
+ "sliceBorder": {
+ "left": 0,
+ "right": 0,
+ "top": 0,
+ "bottom": 0
+ }
+ }
+}
diff --git a/examples/celestial-heights/assets/tilesets/heights.estileset b/examples/celestial-heights/assets/tilesets/heights.estileset
new file mode 100644
index 000000000..6f6b5d84a
--- /dev/null
+++ b/examples/celestial-heights/assets/tilesets/heights.estileset
@@ -0,0 +1,15 @@
+{
+ "version": "1",
+ "texture": "@uuid:110f13ee-8280-4e9c-8bce-a5207e31edf6",
+ "tileWidth": 64,
+ "tileHeight": 64,
+ "columns": 6,
+ "margin": 0,
+ "spacing": 0,
+ "tileCount": 6,
+ "tiles": {
+ "4": { "collision": { "type": "box" } },
+ "5": { "collision": { "type": "box" } },
+ "6": { "collision": { "type": "box" } }
+ }
+}
diff --git a/examples/celestial-heights/assets/tilesets/heights.estileset.meta b/examples/celestial-heights/assets/tilesets/heights.estileset.meta
new file mode 100644
index 000000000..52f9d9bca
--- /dev/null
+++ b/examples/celestial-heights/assets/tilesets/heights.estileset.meta
@@ -0,0 +1,6 @@
+{
+ "uuid": "cf5ed115-8369-48af-bbd1-163efd25c1aa",
+ "version": "2.0",
+ "type": "tileset",
+ "importer": {}
+}
diff --git a/examples/celestial-heights/src/ai/wisp.ts b/examples/celestial-heights/src/ai/wisp.ts
index 36190fd8c..1affa5d51 100644
--- a/examples/celestial-heights/src/ai/wisp.ts
+++ b/examples/celestial-heights/src/ai/wisp.ts
@@ -1,10 +1,9 @@
import {
- defineSystem, Query, Mut, Res,
+ defineSystem, Query, Mut,
registerAction, registerCondition, setNavDestination,
- Nav, NavGrid, Perception, Status,
+ Perception, Status,
} from 'esengine';
import { Facing, MeleeAttack } from '../components';
-import { ROOM_HALF_W, ROOM_HALF_H } from '../config';
// Leaves for assets/ai/wisp.esbt. The tree is authored as data and resolves
// these names from the engine's AI registry, so the brain's shape is editable
@@ -49,17 +48,3 @@ export const perceiverFacingSystem = defineSystem(
{ name: 'PerceiverFacingSystem' },
);
-/** An open grid over the room, until the room is a tilemap to derive one from. */
-export const setupNavGridSystem = defineSystem(
- [Res(Nav)],
- (nav) => {
- const cell = 25;
- nav.setGrid(new NavGrid({
- width: (ROOM_HALF_W * 2) / cell,
- height: (ROOM_HALF_H * 2) / cell,
- cellSize: cell,
- origin: { x: -ROOM_HALF_W, y: -ROOM_HALF_H },
- }));
- },
- { name: 'SetupNavGridSystem' },
-);
diff --git a/examples/celestial-heights/src/components.ts b/examples/celestial-heights/src/components.ts
index a55ac9ef7..8b2f4d4b2 100644
--- a/examples/celestial-heights/src/components.ts
+++ b/examples/celestial-heights/src/components.ts
@@ -12,6 +12,15 @@ export const Player = defineComponent('Player', {
/** Anything the player fights. */
export const Enemy = defineTag('Enemy');
+/** A way out of an area. `toScene` is the packaged scene name, e.g. `main`. */
+export const Gate = defineComponent('Gate', {
+ toScene: '',
+ radius: 90,
+});
+
+/** Set once a tilemap's navigation grid has been derived from its tiles. */
+export const NavGridBuilt = defineTag('NavGridBuilt');
+
/**
* Where the actor is facing, as a unit vector. Melee arcs and animation both
* read it, so it is written once per actor rather than derived twice from
diff --git a/examples/celestial-heights/src/config.ts b/examples/celestial-heights/src/config.ts
index 2bcd9341e..889653dc4 100644
--- a/examples/celestial-heights/src/config.ts
+++ b/examples/celestial-heights/src/config.ts
@@ -18,10 +18,6 @@ export const Collide = {
Enemy: 1 << 2,
} as const;
-/** Half-extents of the walkable room, in world units. */
-export const ROOM_HALF_W = 800;
-export const ROOM_HALF_H = 450;
-
/**
* A 3/4 view foreshortens depth, so a step "north" covers less ground than a
* step "east". Vertical input is scaled by this so the two read as one speed.
diff --git a/examples/celestial-heights/src/main.ts b/examples/celestial-heights/src/main.ts
index 19b8a590d..368d6cbbe 100644
--- a/examples/celestial-heights/src/main.ts
+++ b/examples/celestial-heights/src/main.ts
@@ -1,4 +1,4 @@
-import { addStartupSystem, addSystemToSchedule, Schedule } from 'esengine';
+import { addSystemToSchedule, Schedule } from 'esengine';
import './components';
import { playerMoveSystem, playerAttackSystem } from './systems/player';
@@ -6,15 +6,23 @@ import {
meleeResolveSystem, damageSystem, invulnerabilitySystem, deathSystem,
} from './systems/combat';
import { healthBarSystem, hitFlashSystem } from './systems/feedback';
-import { perceiverFacingSystem, setupNavGridSystem } from './ai/wisp';
+import { cameraBindSystem, navFromTerrainSystem, gateSystem } from './systems/world';
+import { perceiverFacingSystem } from './ai/wisp';
-// Perception, nav following and the behaviour-tree tick are engine plugins and
-// need no wiring; only the project's own systems are registered here.
-addStartupSystem(setupNavGridSystem);
+// Perception, nav following, the behaviour-tree tick and scene switching are
+// engine plugins, and the runtime already knows every .esscene the package
+// ships by its file name — so only the project's own systems appear here.
+
+// The world systems run every frame rather than at startup: an area switch
+// brings a new camera, a new terrain and a new player, and startup is long past.
+addSystemToSchedule(Schedule.PreUpdate, navFromTerrainSystem);
+addSystemToSchedule(Schedule.PreUpdate, cameraBindSystem);
addSystemToSchedule(Schedule.Update, playerMoveSystem);
addSystemToSchedule(Schedule.Update, playerAttackSystem);
addSystemToSchedule(Schedule.Update, perceiverFacingSystem);
+addSystemToSchedule(Schedule.Update, gateSystem);
+
// Damage resolves after everyone has decided to swing, and death after damage,
// so a hit lands in the frame it was thrown rather than the next one.
addSystemToSchedule(Schedule.PostUpdate, meleeResolveSystem);
diff --git a/examples/celestial-heights/src/systems/world.ts b/examples/celestial-heights/src/systems/world.ts
new file mode 100644
index 000000000..3630ee906
--- /dev/null
+++ b/examples/celestial-heights/src/systems/world.ts
@@ -0,0 +1,79 @@
+import {
+ defineSystem, Query, Mut, Res, Commands, GetWorld,
+ Transform, Camera, FollowTarget, TilemapLayer, RuntimeOnly,
+ Nav, navGridFromTilemapLayer, SceneManager, transitionTo,
+} from 'esengine';
+import { Player, Gate, NavGridBuilt } from '../components';
+
+/**
+ * Points the camera at whoever is playing. The camera is authored per area and
+ * the player is spawned by the same scene, so the entity id is not knowable
+ * until the scene is live — and it changes again on every area switch.
+ */
+export const cameraBindSystem = defineSystem(
+ [Query(Mut(FollowTarget), Camera), Query(Transform, Player), GetWorld()],
+ (cameras, players, world) => {
+ for (const [, follow] of cameras) {
+ if (follow.target >= 0 && world.has(follow.target as never, Player)) continue;
+ for (const [player] of players) {
+ follow.target = player;
+ break;
+ }
+ }
+ },
+ { name: 'CameraBindSystem' },
+);
+
+/**
+ * Derives navigation from the painted terrain, once per tilemap. The solid tile
+ * ids are the tileset's own — the same ones the layer turns into colliders —
+ * so what blocks a wisp and what blocks the player cannot drift apart.
+ */
+export const navFromTerrainSystem = defineSystem(
+ [Query(Transform, TilemapLayer).without(NavGridBuilt), Res(Nav), Commands()],
+ (layers, nav, commands) => {
+ for (const [entity, transform, layer] of layers) {
+ const cell = layer.cellSize.x;
+ if (!cell) continue;
+ const width = Math.round((-transform.position.x * 2) / cell);
+ const height = Math.round((transform.position.y * 2) / cell);
+ if (width <= 0 || height <= 0) continue;
+ nav.setGrid(navGridFromTilemapLayer(entity, {
+ width,
+ height,
+ cellSize: cell,
+ // A nav grid counts up from its bottom-left cell centre, while the
+ // Transform names the tilemap's top-left corner.
+ origin: {
+ x: transform.position.x + cell / 2,
+ y: transform.position.y - height * cell + cell / 2,
+ },
+ blockedTileIds: SOLID_TILES,
+ }));
+ commands.entity(entity).insert(NavGridBuilt, {}).insert(RuntimeOnly, {});
+ }
+ },
+ { name: 'NavFromTerrainSystem' },
+);
+
+/** Tiles that stop movement — mirrors `collision` in assets/tilesets/heights.estileset. */
+const SOLID_TILES = [4, 5, 6];
+
+/** Walking into a gate hands the game to the next area. */
+export const gateSystem = defineSystem(
+ [Query(Transform, Gate), Query(Transform, Player), Res(SceneManager)],
+ (gates, players, scenes) => {
+ if (scenes.isTransitioning()) return;
+ for (const [, gateTransform, gate] of gates) {
+ if (!gate.toScene) continue;
+ for (const [, playerTransform] of players) {
+ const dx = playerTransform.position.x - gateTransform.position.x;
+ const dy = playerTransform.position.y - gateTransform.position.y;
+ if (Math.hypot(dx, dy) > gate.radius) continue;
+ void transitionTo(scenes, gate.toScene, { type: 'fade', duration: 0.35 });
+ return;
+ }
+ }
+ },
+ { name: 'GateSystem' },
+);
diff --git a/sdk/src/ai/nav/navGridFromTilemap.ts b/sdk/src/ai/nav/navGridFromTilemap.ts
index 06f6424e5..6e96db553 100644
--- a/sdk/src/ai/nav/navGridFromTilemap.ts
+++ b/sdk/src/ai/nav/navGridFromTilemap.ts
@@ -51,9 +51,15 @@ export function navGridFromTiles(
return new NavGrid({ width, height, cellSize: opts.cellSize, origin: opts.origin, walkable });
}
-/** Build a NavGrid from a live tilemap layer entity via TilemapAPI. */
+/**
+ * Build a NavGrid from a live tilemap layer entity via TilemapAPI.
+ *
+ * A tilemap's row 0 is its top and a NavGrid's cell 0 its bottom, so the row is
+ * flipped here — no `origin` could correct that mirroring. `origin` keeps its
+ * usual meaning: the world centre of the BOTTOM-left cell.
+ */
export function navGridFromTilemapLayer(entity: Entity, opts: BuildNavGridOptions): NavGrid {
- return navGridFromTiles((x, y) => TilemapAPI.getTile(entity, x, y), opts);
+ return navGridFromTiles((x, y) => TilemapAPI.getTile(entity, x, opts.height - 1 - y), opts);
}
function resolveBlocked(opts: BuildNavGridOptions): (tileId: number) => boolean {
diff --git a/sdk/tests/nav-step.test.ts b/sdk/tests/nav-step.test.ts
index 534977f96..1888a1b74 100644
--- a/sdk/tests/nav-step.test.ts
+++ b/sdk/tests/nav-step.test.ts
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import { describe, it, expect } from 'vitest';
+import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { Transform } from '../src/ecs/component';
import type { Entity } from '../src/types';
import { NavGrid } from '../src/ai/nav/NavGrid';
@@ -11,7 +11,8 @@ import {
type AgentRuntime,
type NavWorldView,
} from '../src/ai/nav/NavPlugin';
-import { navGridFromTiles } from '../src/ai/nav/navGridFromTilemap';
+import { navGridFromTiles, navGridFromTilemapLayer } from '../src/ai/nav/navGridFromTilemap';
+import { initTilemapAPI, shutdownTilemapAPI } from '../src/tilemap/tilemapAPI';
/** Minimal in-memory world satisfying what stepNavigation calls. */
class FakeWorld implements NavWorldView {
@@ -176,3 +177,41 @@ describe('navGridFromTiles', () => {
expect(grid.isWalkable(0, 0)).toBe(false);
});
});
+
+describe('navGridFromTilemapLayer', () => {
+ // A tilemap's row 0 is the map's top and a NavGrid's cell 0 its bottom, so
+ // only a map blocked along ONE edge says which way up the conversion is: a
+ // mirrored grid passes anything that reads the same upside down.
+ const map = [
+ [9, 9, 9], // tilemap row 0 — the map's TOP
+ [0, 0, 0],
+ [0, 0, 0],
+ ];
+
+ beforeEach(() => {
+ initTilemapAPI({
+ tilemap_getTile: (_e: number, x: number, y: number) => map[y][x],
+ } as never);
+ });
+ afterEach(() => shutdownTilemapAPI());
+
+ it('reads the tilemap top-down into a bottom-up grid', () => {
+ const grid = navGridFromTilemapLayer(7, { width: 3, height: 3, cellSize: 16 });
+ // The blocked tilemap row is the map's top, so it must land on the grid's
+ // TOP cell row — the highest gy, not gy 0.
+ expect(grid.isWalkable(1, 2)).toBe(false);
+ expect(grid.isWalkable(1, 0)).toBe(true);
+ });
+
+ it('puts an obstacle where cellToWorld says it is', () => {
+ const cellSize = 16;
+ // origin = world centre of the BOTTOM-left cell, per the NavGrid contract.
+ const grid = navGridFromTilemapLayer(7, {
+ width: 3, height: 3, cellSize, origin: { x: -16, y: -16 },
+ });
+ const blocked = grid.cellToWorld(1, 2);
+ // The tilemap draws its row 0 at the top: origin.y + (height-1)*cellSize.
+ expect(blocked.y).toBe(-16 + 2 * cellSize);
+ expect(grid.isWalkable(1, 2)).toBe(false);
+ });
+});
diff --git a/tools/goldenProjects.mjs b/tools/goldenProjects.mjs
index 222f4e5ab..fa66ccde2 100644
--- a/tools/goldenProjects.mjs
+++ b/tools/goldenProjects.mjs
@@ -61,7 +61,7 @@ export const CAPABILITIES = [
// What a game needs and no sample carried end to end. Each holds a gap below
// until the phase covering it lands, so the gate prints how much of a game the
// corpus still cannot certify. See docs/REARCH_CELESTIAL_HEIGHTS.md.
- 'navigation', 'behavior-tree', 'scene-transition',
+ 'navigation', 'behavior-tree', 'scene-transition', 'y-sort',
'settings', 'controller', 'achievements', 'ui-inventory',
];
@@ -78,9 +78,6 @@ export const KNOWN_GAPS = {
rollback: 'hot-update-demo swaps forward; nothing exercises a failed manifest rolling back',
// Present in the engine and shown by non-golden samples, but never carried
// through the chain by a project the release argues from.
- navigation: 'enemy-ai navigates, but it is outside the corpus — Celestial Heights P2',
- 'behavior-tree': 'enemy-ai drives an FSM; nothing golden runs a behaviour tree — Celestial Heights P2',
- 'scene-transition': 'scene-flow switches scenes outside the corpus; no golden project streams between areas — Celestial Heights P2',
settings: 'no project persists graphics/audio/language/rebinds and reads them back — Celestial Heights P3',
controller: 'input-actions binds a gamepad, but no golden run drives one — Celestial Heights P5',
achievements: 'the achievements service has no project that unlocks one in play — Celestial Heights P4',
@@ -173,6 +170,17 @@ export const GOLDEN = [
parityGap: 'shuffles per run and plays video; two runs of one build do not match either',
interactGap: 'pointer-driven; no stable tile target pinned yet',
},
+ {
+ id: 'celestial-heights',
+ certifies: ['tilemap', 'tile-collision', 'navigation', 'behavior-tree', 'scene-transition', 'y-sort'],
+ targets: ['web', 'desktop'],
+ // Nightly, not pr: a project earns the release gate by having run, and this
+ // one has not run anywhere yet. It is also the biggest thing in the corpus.
+ tier: 'nightly',
+ // The camera follows Lyra, so walking scrolls the whole screen — no reading
+ // of a small sprite is needed to see that the key arrived.
+ interact: { keys: ['KeyD'], frames: 60 },
+ },
{
id: 'input-actions',
certifies: ['input'],