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
docs(residency): a place readied before it is wanted, and the target that refuses one
esengine3f67d88f5249
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex dfe9ae50e..4357d4f28 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -56,8 +56,29 @@ published separately; it ships inside the editor.because a cell that is not drawn and a cell that is not there look the samefrom a camera. See the guide: **World → World Streaming**.- Not in this version: HLOD, streaming priority or prefetch, an asset memory- budget, navmesh or texture streaming, and world origin rebasing.+ **A place is readied before it is asked for.** `prefetchRadius` marks cells+ worth PREPARING — fetched, decoded, their assets acquired — while creating not+ one entity, so nothing in the world can observe them: no query, no renderer, no+ body, no enemy deciding anything. Publication is the only thing that makes+ entities, and it happens when a source actually reaches `loadRadius`. Measured+ on Estella's own fixture, walking into a readied place costs 0.6 ms where the+ same walk cost 19 ms of fetching and decoding.++ Preparation is speculation and never authority: a cell readied for a player who+ turns around is thrown away and its assets given back, rather than published+ because it happened to be ready — and a preparation that finishes asks again+ whether the cell is still wanted instead of assuming the answer from when it+ started.++ A target that cannot cut worlds now REFUSES a streamed one. Mini-game, WeChat+ and playable-ad builds return before the cook that cuts cells, so shipping them+ a streamed world would succeed and quietly deliver the whole thing; that is the+ same shape as a declaration the runtime never receives, and it is an error now.++ Not in this version: HLOD, an admission budget (measured: the largest atomic+ main-thread phase of a heavy cell is 7 ms, and the frame it lands on 3.5 ms —+ there is nothing to slice), an asset memory budget, navmesh or texture+ streaming, and world origin rebasing.- **Level of detail: an object can hand over to a cheaper mesh once it is smallon screen.** A rock a hundred units away and a rock two thousand units awaydiff --git a/docs/astro/src/content/docs/world/streaming.mdx b/docs/astro/src/content/docs/world/streaming.mdxindex dc92183eb..8730566cf 100644--- a/docs/astro/src/content/docs/world/streaming.mdx+++ b/docs/astro/src/content/docs/world/streaming.mdx@@ -47,6 +47,7 @@ A cell exists because a **source** is near it:```typescriptworld.insert(player, WorldStreamingSource, {+ prefetchRadius: 3000, // cells this close are READIED, not brought inloadRadius: 2000, // cells this close are brought inunloadRadius: 3000, // resident cells are kept until past this});@@ -63,6 +64,28 @@ Distance is measured to the cell's **box**, not its centre: to a centre, a sourcstanding on a diagonal corner reads the same as one a whole cell away, which iswhere holes open along the diagonals of a grid.+### Readied before it is wanted++A cell inside `prefetchRadius` is **prepared**: its document is fetched, its+prefabs expanded, its assets acquired — and not one of its entities exists. So+nothing can observe it. No query returns it, no renderer draws it, no body+collides with it, no enemy in it decides anything, because there is nothing+there yet. Publication is the only thing that creates entities, and it happens+when a source actually reaches `loadRadius`.++That is worth about twenty milliseconds of a player's time. On Estella's own+fixture, walking into a readied place costs 0.6 ms; walking into an unreadied+one costs the fetching and decoding too.++Preparation is **speculation, never authority**. A cell readied for a player who+turns around is thrown away and its assets given back — never published because+it happened to be ready. And a preparation that finishes asks again whether the+cell is still wanted, rather than assuming the answer from when it started.++`prefetchRadius` is never used as less than `loadRadius`; beyond that it is not+ordered against `unloadRadius` at all. They answer different questions — how+early to get ready, and how late to let go.+### The band between the two radiiA cell comes in at `loadRadius` and only leaves once it is past `unloadRadius`.diff --git a/docs/astro/src/content/docs/zh-cn/world/streaming.mdx b/docs/astro/src/content/docs/zh-cn/world/streaming.mdxindex 9a5f3f4e3..0a6d5ff16 100644--- a/docs/astro/src/content/docs/zh-cn/world/streaming.mdx+++ b/docs/astro/src/content/docs/zh-cn/world/streaming.mdx@@ -43,6 +43,7 @@ residency 到底能不能移除它。```typescriptworld.insert(player, WorldStreamingSource, {+ prefetchRadius: 3000, // 距离在此以内的格子被**准备好**,但不进入世界loadRadius: 2000, // 距离在此以内的格子被带进来unloadRadius: 3000, // 已常驻的格子在越过这个距离前一直保留});@@ -56,6 +57,24 @@ world.insert(player, WorldStreamingSource, {距离量到格子的**包围盒**,而不是中心点:按中心量,站在对角角落的源和隔了整整一格的源读数相同,而网格的对角线正是"洞"出现的地方。+### 在被需要之前就准备好++落在 `prefetchRadius` 以内的格子会被**准备**:文档取回、预制体展开、资产获取——+而它的实体一个都还不存在。所以没有任何东西能观察到它:查询查不到、渲染器不画、+刚体不碰撞、里面的敌人不做任何决策,因为那里根本还没有东西。**只有发布才创建实体**,+而发布发生在某个源真正进入 `loadRadius` 的时候。++这大约值玩家二十毫秒。在 Estella 自己的 fixture 上,走进一个已准备好的地方要等+0.6ms;走进一个没准备的,还要连取回和解码一起等。++准备是**推测,不是权威**。为一个掉头走开的玩家准备好的格子会被丢弃、资产交回——+绝不会因为"都准备好了"就塞进世界。而且一次准备完成时会**重新问**这个格子是否仍被+需要,不会拿开始时的答案当结论。++`prefetchRadius` 的取值永远不会低于 `loadRadius`;除此之外它和 `unloadRadius`+之间**没有**任何大小关系要求——它们回答的是两个不同方向的问题:多早开始准备,和+多晚才放手。+### 两个半径之间的带格子在 `loadRadius` 处进来,直到越过 `unloadRadius` 才离开。两者之间的空隙就是它们都diff --git a/docs/astro/src/data/components.generated.json b/docs/astro/src/data/components.generated.jsonindex 80aace373..f8ff6e3cd 100644--- a/docs/astro/src/data/components.generated.json+++ b/docs/astro/src/data/components.generated.json@@ -5490,6 +5490,13 @@"name": "WorldStreamingSource","source": "ts","fields": [+ {+ "key": "prefetchRadius",+ "type": "number",+ "default": "3000",+ "doc": "Cells this close are prepared, not shown.",+ "range": "≥ 0"+ },{"key": "loadRadius","type": "number",@@ -5511,6 +5518,7 @@}],"animatable": [+ "prefetchRadius","loadRadius","unloadRadius"]