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.

test(examples): the corpus ships a 分包, and it is the DLC one

esengine8c13326c7b24
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ee8fc6e16..44d1ab7f3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,15 @@ published separately; it ships inside the editor.
## [Unreleased]
+### Changed
+
+- **The hot-update demo now ships a real 分包.** Its two groups take the two modes
+ their flows need: `cdn` stays remote, because a hot update has to replace it after
+ the game shipped, and `pack` — the DLC tile strip the *下载资源包* button pulls on
+ demand — is a subpackage, which is what shipping optional content inside a
+ mini-game package means. Nothing in the corpus delivered a group lazily before, so
+ no project produced a subPackage root for anyone to check.
+
### Fixed
- **A folder that is no longer a 分包 stops being declared as one.** A group is a
diff --git a/examples/hot-update-demo/.esengine/asset-groups.json b/examples/hot-update-demo/.esengine/asset-groups.json
index e408299f6..20869247c 100644
--- a/examples/hot-update-demo/.esengine/asset-groups.json
+++ b/examples/hot-update-demo/.esengine/asset-groups.json
@@ -7,7 +7,7 @@
},
"pack": {
"folder": "assets/pack",
- "mode": "remote"
+ "mode": "subpackage"
}
},
"activeProfile": "dev",
diff --git a/examples/hot-update-demo/README.md b/examples/hot-update-demo/README.md
index f2ad5093e..28e2c5c5c 100644
--- a/examples/hot-update-demo/README.md
+++ b/examples/hot-update-demo/README.md
@@ -22,7 +22,7 @@ frame. The layout lives in the scene — the code never builds UI.
### 1. On-demand download (the DLC pattern) — watch it download
-`assets/pack/` is a `remote` group the scene does **not** reference, so nothing
+`assets/pack/` is a `subpackage` group the scene does **not** reference, so nothing
loads it at boot. Press **下载资源包** and the game calls:
```ts
@@ -81,15 +81,17 @@ it by `contentHash`, download the assets whose hash changed, swap the active
manifest.* Nothing is ever overwritten, so a cache can never go stale, and
`applyUpdate` verifies every downloaded file's hash before committing.
-The delivery config is `.esengine/asset-groups.json`: `assets/cdn` and
-`assets/pack` are ordinarily-named folders the config marks as `remote` groups,
-and build profiles (`dev` / `prod`) carry the CDN root per environment:
+The delivery config is `.esengine/asset-groups.json`, and the two groups take
+the two modes their flows need: `cdn` is **remote** because a hot update has to
+replace it after the game shipped, and `pack` is a **subpackage** because it
+ships inside the package and is only fetched when asked for. Build profiles
+(`dev` / `prod`) carry the CDN root per environment:
```json
{
"groups": {
"cdn": { "folder": "assets/cdn", "mode": "remote" },
- "pack": { "folder": "assets/pack", "mode": "remote" }
+ "pack": { "folder": "assets/pack", "mode": "subpackage" }
},
"activeProfile": "dev",
"profiles": { "dev": { "remoteRoot": "" }, "prod": { "remoteRoot": "https://cdn.example.com/hot-update-demo" } }
diff --git a/examples/hot-update-demo/src/config.ts b/examples/hot-update-demo/src/config.ts
index 2b8fd680f..5a7eb5c8f 100644
--- a/examples/hot-update-demo/src/config.ts
+++ b/examples/hot-update-demo/src/config.ts
@@ -2,13 +2,15 @@
// refs, and the palette. Kept data-only so the systems read as pure wiring.
import type { Color } from 'esengine';
-/** The `pack` addressable group (see `.esengine/asset-groups.json`) pulled on
- * demand by the "Download pack" button — the DLC pattern. */
+/** The `pack` group (see `.esengine/asset-groups.json`), pulled on demand by the
+ * "Download pack" button. Delivered as a SUBPACKAGE — it ships inside the
+ * package and the vendor fetches it on the first `loadGroup` (WeChat 分包) —
+ * unlike `cdn`, which is remote so a hot update can replace it after ship. */
export const PACK_GROUP = 'pack';
/** The pack's textures, by ordinary project-relative path (the ref a game
- * actually writes — loaders resolve it, routing through the `pack` remote group
- * to the CDN automatically). The order here is the on-screen tile order. */
+ * actually writes — the loader resolves it to wherever the `pack` group's
+ * delivery staged it). The order here is the on-screen tile order. */
export const PACK_TILES: readonly string[] = [
'assets/pack/tile0.png',
'assets/pack/tile1.png',
diff --git a/examples/hot-update-demo/updates/v2-manifest.json b/examples/hot-update-demo/updates/v2-manifest.json
index 2294cb1b0..956fcee8b 100644
--- a/examples/hot-update-demo/updates/v2-manifest.json
+++ b/examples/hot-update-demo/updates/v2-manifest.json
@@ -17,7 +17,7 @@
}
},
"pack": {
- "bundleMode": "remote",
+ "bundleMode": "lazy",
"labels": [],
"assets": {
"a1b2c3d4-0003-4003-8003-000000000000": { "path": "assets/pack/tile0.png", "type": "texture", "size": 0, "labels": [] },
diff --git a/tools/goldenProjects.mjs b/tools/goldenProjects.mjs
index 0c0dd05db..1c5732b17 100644
--- a/tools/goldenProjects.mjs
+++ b/tools/goldenProjects.mjs
@@ -362,9 +362,10 @@ export const KNOWN_GAPS = {
// Present in the engine and shown by non-golden samples, but never carried
// through the chain by a project the release argues from.
settings: 'Celestial Heights persists language, effects and key bindings and reads them back at boot; volume waits on the game having sound',
- // Nothing in the corpus makes a vendor mount a subPackage root and read a file
- // out of it, so the download itself has only ever been exercised by hand.
- subpackage: 'no golden project ships a 分包: loadGroup on a lazy group is unit-tested against a stubbed platform, and the download itself needs devtools',
+ // hot-update-demo ships one now, so the package SHAPE is a real project's.
+ // What no automated run reaches is the vendor mounting it: only a mini-game
+ // host implements the download, and none of the tiers builds for one.
+ subpackage: 'hot-update-demo delivers `pack` as a 分包 and its button loads it, but no tier builds that project for a mini-game host — the vendor download itself is verified by hand in devtools',
};
/**