ecs: let a changes finalizer learn that components with a trait were written through a row
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 15/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- devtools
调研方向
The request is a design change to the changes finalizer in the ECS layer, so start by locating how Finalizer.changes and its watch option are implemented and how row assignment (row[component] = value) is tracked versus command-based structural changes. Decide whether a per-table dirty bit or a changes.written field is the right shape, and agree the API with maintainers before writing code. Done means a finalizer watching a trait is notified when a row system writes one of its components, without scanning rows.
由索引模型根据 Issue 内容生成。
描述
Summary
A changes finalizer can't see a component's value being written through a row (row[component] = value in a row system), only structural changes (added, removed, spawned, despawned). So state that lives in a component and is moved by a row system (a camera's position and look, moved every frame by the control) can't be saved on change by a finalizer that watches a trait, and has to be polled.
Where this came from (mecs)
mecs keeps per-tab state (the camera's cameraPosition and cameraLook, plus resources like the selected tool) under a trait of the app's own (inTab). With 0.3.0 trait watches (#242) the resources are noticed by Finalizer.changes({ watch: [inTab] }), which is what I wanted. But the camera is a component of an entity and controlCamera moves it with row assignments:
System.create({ components: { with: [cameraPosition, cameraLook, ...] } }, row => {
row[cameraPosition] = next.position; // not reported to a changes finalizer
});
A finalizer watching inTab never fires for that. So the tab's state is polled four times a second (take a snapshot, encode it, compare bytes) which is correct but does the encode work 240 times a minute while nothing changes.
What I need
Some way for a finalizer (or a system) to learn that components with a trait were written this tick, by row or by command, without scanning every row:
- a
changes.written(or the existingchanges.groupscarryingreplacedfor row writes) per table for watched components; or - a
Finalizer.changesoption that also reports "this table's column was written", coarse is fine (a table-level dirty bit per watched column, set by row assignment, cleared when finalizers have run). I don't need which row or the values, only that something changed, because the consumer re-snapshots.
The changed: [component] filter of a system already has this information per row (it is how deriveCells runs only on moved voxels), so the world already tracks a version per column or row; this is asking for it to be reachable from a finalizer's watch, including by trait.
Why a coarse signal is enough
The consumer is "save the tab's state soon after it changes": a timer then a snapshot. A dirty flag per watched table, read once per tick, replaces the 4 Hz byte-comparing poll with nothing at all while idle.
- 主要语言
- TypeScript
- 星标
- 12
- 派生
- 8
- 平均合并
- 11 小时 2 分钟
- 30 天内合并 PR
- 23
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
adobe/data 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
ecs: let kernels issue commands through helpers (component lists, symbol-keyed values, void helpers)未关闭
难度 5/5 一周以上 新手友好度 15/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 30/100
维护者通常 1 天内回复
-
ecs: an architecture standard (layout, naming, exports, checker, diagrams) for the new ECS samples, and how to distribute it可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 5/5 一周以上 新手友好度 8/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 22/100
维护者通常 1 天内回复
相似的 Issue
-
needs investigation
难度 2/5 1-3 小时 新手友好度 60/100
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
area:visualizer tech-debt
难度 2/5 1 小时以内 新手友好度 66/100
jmbarzee/temporal-architect#292 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
riverqueue/river#1576 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
colbymchenry/codegraph#3228 ·
维护者通常 1 天内回复