@typeonce/ritmo-render 0.22.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,88 @@
1
1
  # @typeonce/ritmo-render
2
2
 
3
+ ## 0.24.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [2bbc1ef]
8
+ - Updated dependencies [d2f2543]
9
+ - @typeonce/ritmo@0.24.0
10
+
11
+ ## 0.23.0
12
+
13
+ ### Minor Changes
14
+
15
+ - 3037822: **Breaking, and it still compiles: a renderable a system writes with a new value now destroys and makes its node again on every write.** Count your `create` calls after upgrading: a town whose houses, trees, and fields kept writing their renderables went from 142 nodes made in 5 minutes of play to 59,445, and every effect on those nodes restarted each time.
16
+
17
+ **A `RenderSync` node follows its renderable.** A node used to be made once per entity id from the renderable's value at that time and only applied after, so an entity whose renderable a system changed (a relabel, an evolve) kept the node of its old value, and after a rewind an entity spawned under an id already drawn (an enemy where a predicted bullet was) was drawn with the other entity's node for its whole life. Now, when an entity's renderable value is no longer the one its node was made from, `RenderSync.system` destroys the node, calls `create` with the new value, and then `apply`. Writing an equal value keeps the node and runs no extra `apply`: values are compared as plain data (arrays and plain objects by their entries). Nothing changes for a renderable that is set at spawn and never written.
18
+
19
+ What a game sees differently: a renderable written with a new value each tick now makes its node again each tick. Move data that changes while the node lives (an animation `frame`, a `tint`, a facing) out of the renderable into its own component, list it in `redrawOn`, and set it in `apply`:
20
+
21
+ ```diff
22
+ -const Sprite = Descriptor.Component<{ texture: string; frame: number }>()("Game/Sprite")
23
+ +const Sprite = Descriptor.Component<{ texture: string }>()("Game/Sprite")
24
+ +const Frame = Descriptor.Component<number>()("Game/Frame")
25
+
26
+ RenderSync.system(Game, {
27
+ renderable: Sprite,
28
+ + select: { frame: Game.Query.read(Frame) },
29
+ + redrawOn: [Frame],
30
+ - apply: (node, { renderable }) => node.gotoAndStop(renderable.frame)
31
+ + apply: (node, { data }) => node.gotoAndStop(data.frame.get())
32
+ })
33
+ ```
34
+
35
+ Or key the sync on a component that never changes after spawn, and read the one systems write through a required `select` slot:
36
+
37
+ ```diff
38
+ RenderSync.system(Game, {
39
+ - renderable: House,
40
+ + renderable: Tile,
41
+ + select: { house: Game.Query.read(House) },
42
+ + redrawOn: [House],
43
+ - apply: (node, { renderable }) => node.update(renderable)
44
+ + apply: (node, { data }) => node.update(data.house.get())
45
+ })
46
+ ```
47
+
48
+ A game that listed its renderable in `redrawOn` and wrote an `apply` redoing what `create` did can drop both: a new value makes the node again.
49
+
50
+ ### Patch Changes
51
+
52
+ - ca0544d: `RenderSync` finds a node's parent with `lookup.related`, since core removed `lookup.parent`. No change for games.
53
+ - d2970e8: `RenderSync` stays correct across `runtime.restore`, which no longer reports the replaced world's entities as despawned: when its removal reads are lagged it destroys every node whose entity no longer matches, as before, and also the node of every entity added since, so an id the save gave to another entity gets a new node made from that entity's values. No change for games.
54
+ - 6704ce1: The `RenderSync.interpolate` example declares its game's root and passes it to `Schema.bind`, which now takes one.
55
+ - Updated dependencies [5a16a40]
56
+ - Updated dependencies [148ec5f]
57
+ - Updated dependencies [4df0496]
58
+ - Updated dependencies [4df0496]
59
+ - Updated dependencies [0dd0a84]
60
+ - Updated dependencies [51a0b7f]
61
+ - Updated dependencies [dff932a]
62
+ - Updated dependencies [dfe3432]
63
+ - Updated dependencies [52d6a6f]
64
+ - Updated dependencies [02ca2a4]
65
+ - Updated dependencies [7e416f5]
66
+ - Updated dependencies [40f60e7]
67
+ - Updated dependencies [51efba5]
68
+ - Updated dependencies [5f9fe33]
69
+ - Updated dependencies [1b83e0c]
70
+ - Updated dependencies [ca0544d]
71
+ - Updated dependencies [4a32ad1]
72
+ - Updated dependencies [917001b]
73
+ - Updated dependencies [0f4a5fe]
74
+ - Updated dependencies [4df0496]
75
+ - Updated dependencies [02b8683]
76
+ - Updated dependencies [791517f]
77
+ - Updated dependencies [4fc0728]
78
+ - Updated dependencies [207e611]
79
+ - Updated dependencies [d2970e8]
80
+ - Updated dependencies [c99b968]
81
+ - Updated dependencies [08c0c91]
82
+ - Updated dependencies [78683e7]
83
+ - Updated dependencies [04d2a9d]
84
+ - @typeonce/ritmo@0.23.0
85
+
3
86
  ## 0.22.0
4
87
 
5
88
  ### Patch Changes
package/README.md CHANGED
@@ -35,6 +35,36 @@ const runtime = Game.Runtime.make({
35
35
 
36
36
  `attach` receives the node to add and the node to add it under (`undefined` for the root). It is also called to move an attached node to another parent, so it must take the node out of the parent it is in, as Three.js's `add` and Pixi's `addChild` do. Declare both parameters: a one-parameter `attach` still compiles but puts every node on the root.
37
37
 
38
+ ## What goes in the renderable
39
+
40
+ A node follows its renderable. `create` builds the node from the renderable's value, and when an entity's value is no longer the one its node was made from (a system wrote another one, or after a rewind another entity holds an id already drawn), the node is destroyed and made again from the new value, then `apply` runs. Writing an equal value keeps the node: values are compared as plain data.
41
+
42
+ Making a node costs more than applying one, so split the data by how often it changes:
43
+
44
+ - The renderable holds what decides which node to make: a kind, a texture, a mesh, a material.
45
+ - What changes while the node lives (an animation frame, a tint, a facing) goes in other components, listed in `redrawOn` and set by `apply`.
46
+
47
+ ```ts
48
+ const Look = Descriptor.Component<{ character: Character }>()("Game/Look") // which sprite sheet
49
+ const Frame = Descriptor.Component<number>()("Game/Frame") // changes every few ticks
50
+
51
+ const Render = RenderSync.system(Game, {
52
+ name: "Game/Render",
53
+ renderable: Look,
54
+ transform: Position,
55
+ registry: Sprites,
56
+ select: { frame: Game.Query.read(Frame) },
57
+ redrawOn: [Frame],
58
+ create: ({ renderable }) => new AnimatedSprite(sheets[renderable.character]),
59
+ apply: (sprite, { transform, data }) => {
60
+ sprite.position.set(transform.x, transform.y)
61
+ sprite.gotoAndStop(data.frame.get())
62
+ }
63
+ })
64
+ ```
65
+
66
+ A `frame` field inside `Look` would make the sprite again each time it moved on.
67
+
38
68
  ## Hierarchies
39
69
 
40
70
  A part that moves with its entity (a turret on a tank, a name over a head) is a child entity in a `Descriptor.Hierarchy`. Pass the hierarchy to `RenderSync.system` and each child's node is attached under its parent's node, so the renderer composes the transforms:
@@ -9,8 +9,11 @@
9
9
  * in a safe order (destroy, create, update), for one bound `Game`. What a
10
10
  * node looks like and how state is applied stay caller-defined. The registry
11
11
  * belongs to the system: when removals were dropped before it read them
12
- * (`lagged()`, after it did not run for long), it destroys every node whose
13
- * entity no longer matches, so give each `RenderSync.system` its own registry.
12
+ * (`lagged()`, after it did not run for long or after a `runtime.restore`),
13
+ * it destroys every node whose entity no longer matches, and the node of
14
+ * every entity added since, which a load may have given to another entity
15
+ * under the same id: that entity gets a new node. So give each
16
+ * `RenderSync.system` its own registry.
14
17
  *
15
18
  * Change detection is per system, so the system sees every addition, change,
16
19
  * and removal exactly once, wherever it sits in the schedule, and applies each
@@ -20,6 +23,16 @@
20
23
  * interpolation). Place the system after the `applyDeferred()` that commits
21
24
  * spawns to render new entities in the same tick.
22
25
  *
26
+ * A node follows its renderable: when the entity's renderable value is no
27
+ * longer the one its node was made from (a system wrote another one, or
28
+ * after a rewind another entity holds an id the system drew), the node is
29
+ * destroyed and made again from the new value, then applied. An equal value,
30
+ * compared as plain data, keeps the node. Making a node costs more than
31
+ * applying one, so the renderable holds what decides which node to make (a
32
+ * kind, a texture, a mesh), and what changes while the node lives (a frame,
33
+ * a tint, a facing) goes in other components, listed in `redrawOn` and set by
34
+ * `apply`.
35
+ *
23
36
  * `create` and `apply` receive one context: the renderable and transform
24
37
  * values, the entity id, extra read-only slots declared in `select` (as read
25
38
  * cells in `data`), resources declared in `resources` (as read cells), and extra
@@ -110,7 +123,16 @@ export interface NodeContext<S extends Schema.Any, Root, Renderable extends Sche
110
123
  export interface Options<S extends Schema.Any, Root, Renderable extends Schema.ComponentDescriptor<S>, Transform extends Schema.ComponentDescriptor<S> | undefined, Registry extends RegistryService, Select extends Selection<S>, Services extends Readonly<Record<string, ServiceDescriptor>>, Resources extends Readonly<Record<string, Schema.ResourceDescriptor<S>>> = {}, When extends ReadonlyArray<Condition> = readonly [], Hierarchy extends Relation.Any | undefined = undefined> {
111
124
  /** The system name. */
112
125
  readonly name: string;
113
- /** The component whose presence means "this entity has a node". */
126
+ /**
127
+ * The component whose presence means "this entity has a node", and whose
128
+ * value decides which node `create` makes. When the entity's value is no
129
+ * longer the one its node was made from, the node is destroyed and made
130
+ * again from the new value; an equal value (compared as plain data) keeps
131
+ * it. Keep here only what decides which node to make (a kind, a texture, a
132
+ * mesh): a field written while the node lives (a frame, a tint) would make
133
+ * the node again each time. Put that in its own component, listed in
134
+ * `redrawOn` and set by `apply`.
135
+ */
114
136
  readonly renderable: Renderable;
115
137
  /**
116
138
  * The component applied to the node on creation and whenever it changes.
@@ -129,9 +151,12 @@ export interface Options<S extends Schema.Any, Root, Renderable extends Schema.C
129
151
  readonly resources?: Resources;
130
152
  /**
131
153
  * More components whose changes re-run `apply`, for node state other than
132
- * the transform: animation frames, tints, interpolation. `apply` then runs
133
- * once per changed entity per sync, however many of these changed, so it
134
- * should set the node's state rather than increment it.
154
+ * the transform: animation frames, tints, interpolation. This is where data
155
+ * that changes while the node lives belongs, not in the renderable, whose
156
+ * new values make the node again (listing the renderable here only re-runs
157
+ * `apply` when it is written with an equal value). `apply` then runs once
158
+ * per changed entity per sync, however many of these changed, so it should
159
+ * set the node's state rather than increment it.
135
160
  */
136
161
  readonly redrawOn?: ReadonlyArray<Schema.ComponentDescriptor<S>>;
137
162
  /**
@@ -155,11 +180,18 @@ export interface Options<S extends Schema.Any, Root, Renderable extends Schema.C
155
180
  * parent, so the cost grows with the number of children, not of changes.
156
181
  */
157
182
  readonly hierarchy?: HierarchyOption<S, Hierarchy>;
158
- /** Builds the node for a new renderable entity. */
183
+ /**
184
+ * Builds the node for a new renderable entity, and again whenever the
185
+ * entity's renderable takes a value other than the one its node was made
186
+ * from (the old node is destroyed first). Build from the renderable what
187
+ * stays for the node's life; `apply` runs right after and sets the rest.
188
+ */
159
189
  readonly create: (context: NodeContext<S, Root, Renderable, Transform, Select, Services, Resources>) => NodeOf<Registry>;
160
190
  /**
161
- * Applies the current state to the node: on creation, and whenever the
162
- * transform or a `redrawOn` component changes.
191
+ * Applies the current state to the node: on creation (also of a node made
192
+ * again for a new renderable value), and whenever the transform or a
193
+ * `redrawOn` component changes. Set here everything that changes while the
194
+ * node lives, from the transform and the `redrawOn` components.
163
195
  */
164
196
  readonly apply: (node: NodeOf<Registry>, context: NodeContext<S, Root, Renderable, Transform, Select, Services, Resources>) => void;
165
197
  }
@@ -260,7 +292,8 @@ interface InterpolateBase<S extends Schema.Any, Root, Previous extends Schema.Co
260
292
  * const PrevPosition = Descriptor.Component<{ x: number; y: number }>()("Game/PrevPosition")
261
293
  * const Position3 = Descriptor.Component<{ x: number; y: number; z: number }>()("Game/Position3")
262
294
  * const PrevPosition3 = Descriptor.Component<{ x: number; y: number; z: number }>()("Game/PrevPosition3")
263
- * const Game = Schema.bind(Schema.fragment({ components: { Position, PrevPosition, Position3, PrevPosition3 } }))
295
+ * const Root = Schema.defineRoot("Game")
296
+ * const Game = Schema.bind(Schema.fragment({ components: { Position, PrevPosition, Position3, PrevPosition3 } }), Root)
264
297
  * const Sprites = Descriptor.Service<NodeRegistry.NodeRegistry<Sprite>>()("Game/Sprites")
265
298
  * const Meshes = Descriptor.Service<NodeRegistry.NodeRegistry<Mesh>>()("Game/Meshes")
266
299
  * // The loop's render alpha, provided by the host each frame:
@@ -1 +1 @@
1
- {"version":3,"file":"RenderSync.d.ts","sourceRoot":"","sources":["../src/RenderSync.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAA;AACtF,OAAO,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,Q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,SAAS,iBAAiB,EACrC,KAAK,CAAC,IAAI,SAAS,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,EAAE,EAC/D,MAAM,GAAG,OAAO,QAEV,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,WACjB,kBAAkB,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,KACrF,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,GAAG,KAAK,GAAG,4BAA4B,CAAC,IAAI,CAAC,CAmC7E,CAAA"}
@@ -62,24 +62,91 @@ export const system = (Game, options) => {
62
62
  // Despawns are recorded as removals of every component, so these cover them too.
63
63
  removedReads[`removed${index}`] = Game.System.readRemoved(descriptor);
64
64
  });
65
- // One query: an entity whose required component was added, or whose
66
- // trigger changed, is synced once.
67
- const filters = [
65
+ // When `apply` runs: a required component was added, or a trigger changed.
66
+ const applyFilters = [
68
67
  ...additions.map((descriptor) => Game.Query.added(descriptor)),
69
68
  ...triggers.map((trigger) => Game.Query.changed(trigger))
70
69
  ];
71
- // Never empty: `required` always holds the renderable.
72
- queries["sync"] = Query({ selection, filters: [filters.length === 1 ? filters[0] : anyOf(...filters)] });
70
+ // A node follows its renderable, so the sync also meets every entity whose
71
+ // renderable changed, to compare it with the value its node was made from.
72
+ const renderableTriggers = triggers.includes(options.renderable);
73
+ const syncFilters = renderableTriggers ? applyFilters : [...applyFilters, Game.Query.changed(options.renderable)];
74
+ // One query: an entity whose required component was added, or whose
75
+ // trigger or renderable changed, is synced once.
76
+ queries["sync"] = Query({ selection, filters: [syncFilters.length === 1 ? syncFilters[0] : anyOf(...syncFilters)] });
77
+ // Whether `apply` runs for an entity the sync met only for its renderable:
78
+ // looked up (`get` checks one entity against the filters for this reader)
79
+ // when the renderable was written with an equal value, never iterated.
80
+ queries["applies"] = Query({
81
+ selection: { __renderable: Game.Query.read(options.renderable) },
82
+ filters: [applyFilters.length === 1 ? applyFilters[0] : anyOf(...applyFilters)]
83
+ });
73
84
  // Every entity that should have a node: read only after removals were lost.
74
85
  queries["members"] = Query({
75
86
  selection: { __renderable: Game.Query.read(options.renderable) },
76
87
  with: required.filter((descriptor) => descriptor !== options.renderable)
77
88
  });
89
+ // Every entity added since the last run: read only after removals were lost.
90
+ queries["added"] = Query({ selection: { __renderable: Game.Query.read(options.renderable) }, filters: [Game.Query.added(options.renderable)] });
78
91
  // Every renderable entity with a parent: checked each run against where
79
92
  // its node is attached. There is no per-reader filter for relation edges.
80
93
  if (hierarchy !== undefined) {
81
94
  queries["parented"] = Query({ selection: { __parent: Game.Query.readRelation(hierarchy) }, with: [options.renderable] });
82
95
  }
96
+ // The renderable value each node was made from, by entity, for each
97
+ // registry (one system may run in several runtimes). World values are
98
+ // never mutated, so a value still held here by reference is unchanged.
99
+ const madeFrom = new WeakMap();
100
+ const sourcesOf = (registry) => {
101
+ let sources = madeFrom.get(registry);
102
+ if (sources === undefined)
103
+ madeFrom.set(registry, sources = new Map());
104
+ return sources;
105
+ };
106
+ const destroy = (registry, sources, entity) => {
107
+ registry.remove(entity);
108
+ sources.delete(entity);
109
+ };
110
+ // The context of the node being created, read by one shared thunk, so a
111
+ // creation allocates no closure.
112
+ let creating;
113
+ const createNode = () => options.create(creating);
114
+ const create = (registry, sources, entity, data, context) => {
115
+ // A child met before its parent's node exists starts at the root; the
116
+ // reattach pass moves it under the parent in this same run.
117
+ const parent = hierarchy === undefined ? undefined : data["__parent"]?.get(entity);
118
+ creating = context;
119
+ const node = registry.ensure(entity.id, createNode, parent);
120
+ creating = undefined;
121
+ sources.set(entity.id, context.renderable);
122
+ return node;
123
+ };
124
+ // An entity whose renderable is not the value its node was made from (by
125
+ // reference): another value makes the node again, an equal one keeps it
126
+ // and is applied only when the entity was met for more than its renderable.
127
+ // A node the system did not make is applied as it is.
128
+ const follow = (registry, sources, applies, entity, data, node, context) => {
129
+ if (!sources.has(entity.id))
130
+ return options.apply(node, context);
131
+ if (!sameValue(sources.get(entity.id), context.renderable)) {
132
+ registry.remove(entity.id);
133
+ return options.apply(create(registry, sources, entity, data, context), context);
134
+ }
135
+ sources.set(entity.id, context.renderable);
136
+ if (renderableTriggers || applies.get(entity.id).ok)
137
+ options.apply(node, context);
138
+ };
139
+ // Creates, makes again, or applies the node of one entity the sync met.
140
+ const sync = (registry, sources, applies, entity, data, provided, cells) => {
141
+ const context = contextOf(entity, data, provided, cells);
142
+ const node = registry.get(entity.id);
143
+ if (node === undefined)
144
+ options.apply(create(registry, sources, entity, data, context), context);
145
+ else if (sources.get(entity.id) !== context.renderable)
146
+ follow(registry, sources, applies, entity, data, node, context);
147
+ else
148
+ options.apply(node, context);
149
+ };
83
150
  return System(options.name, {
84
151
  queries,
85
152
  removed: removedReads,
@@ -88,36 +155,37 @@ export const system = (Game, options) => {
88
155
  when: options.when ?? []
89
156
  }, ({ queries, removed, resources, services, lookup }) => {
90
157
  const registry = services.__registry;
158
+ const sources = sourcesOf(registry);
91
159
  // Destroy first: an entity that lost a required component has no node,
92
160
  // and one that lost it and got it back since the last run gets a fresh one.
93
161
  let lagged = false;
94
162
  for (let index = 0; index < required.length; index++) {
95
163
  const stream = removed[`removed${index}`];
96
164
  for (const entity of stream.all())
97
- registry.remove(entity);
165
+ destroy(registry, sources, entity);
98
166
  if (stream.lagged())
99
167
  lagged = true;
100
168
  }
101
169
  // Removals were dropped before this system read them (it did not run
102
- // for longer than the stream keeps them): destroy every node whose
103
- // entity no longer has one, so none stays on screen.
170
+ // for longer than the stream keeps them, or a restore replaced the
171
+ // world): destroy every node whose entity no longer has one, so none
172
+ // stays on screen, and every node of an entity added since, which may
173
+ // be another entity under the same id. The sync then makes those once.
104
174
  if (lagged) {
105
175
  const members = new Set();
106
176
  for (const entity of queries["members"].each())
107
177
  members.add(entity.id);
108
178
  for (const [entity] of [...registry.entries()]) {
109
179
  if (!members.has(entity))
110
- registry.remove(entity);
180
+ destroy(registry, sources, entity);
111
181
  }
182
+ for (const entity of queries["added"].each())
183
+ destroy(registry, sources, entity.id);
112
184
  }
113
185
  const data = queries["sync"].data;
114
- for (const entity of queries["sync"].each()) {
115
- const context = contextOf(entity, data, services, resources);
116
- // A child met before its parent's node exists starts at the root; the
117
- // pass below moves it under the parent in this same run.
118
- const parent = hierarchy === undefined ? undefined : data["__parent"]?.get(entity);
119
- options.apply(registry.ensure(entity.id, () => options.create(context), parent), context);
120
- }
186
+ const applies = queries["applies"];
187
+ for (const entity of queries["sync"].each())
188
+ sync(registry, sources, applies, entity, data, services, resources);
121
189
  if (hierarchy !== undefined)
122
190
  reattach(registry, queries["parented"], lookup, hierarchy);
123
191
  });
@@ -148,7 +216,7 @@ const reattach = (registry, parented, lookup, hierarchy) => {
148
216
  if (stillParented < registry.parents.size) {
149
217
  const toRoot = [];
150
218
  for (const [entity] of registry.parents) {
151
- if (!lookup.parent(entity, hierarchy).ok)
219
+ if (!lookup.related(entity, hierarchy).ok)
152
220
  toRoot.push(entity);
153
221
  }
154
222
  for (const entity of toRoot)
@@ -166,6 +234,40 @@ const reattach = (registry, parented, lookup, hierarchy) => {
166
234
  for (const move of moves)
167
235
  registry.reparent(move.entity, move.parent);
168
236
  };
237
+ // Structural equality for plain data, as the world compares resource writes:
238
+ // primitives by `Object.is`, arrays and plain objects by their entries, other
239
+ // objects (class instances, maps, sets) by reference.
240
+ const sameValue = (left, right) => {
241
+ if (Object.is(left, right))
242
+ return true;
243
+ if (typeof left !== "object" || typeof right !== "object" || left === null || right === null)
244
+ return false;
245
+ if (Array.isArray(left)) {
246
+ if (!Array.isArray(right) || left.length !== right.length)
247
+ return false;
248
+ for (let index = 0; index < left.length; index++) {
249
+ if (!sameValue(left[index], right[index]))
250
+ return false;
251
+ }
252
+ return true;
253
+ }
254
+ if (Array.isArray(right) || !isPlain(left) || !isPlain(right))
255
+ return false;
256
+ const leftKeys = Object.keys(left);
257
+ if (leftKeys.length !== Object.keys(right).length)
258
+ return false;
259
+ const leftRecord = left;
260
+ const rightRecord = right;
261
+ for (const key of leftKeys) {
262
+ if (!(key in rightRecord) || !sameValue(leftRecord[key], rightRecord[key]))
263
+ return false;
264
+ }
265
+ return true;
266
+ };
267
+ const isPlain = (value) => {
268
+ const prototype = Object.getPrototypeOf(value);
269
+ return prototype === null || prototype === Object.prototype;
270
+ };
169
271
  /**
170
272
  * Builds the system that draws moving entities between fixed steps.
171
273
  *
@@ -188,7 +290,8 @@ const reattach = (registry, parented, lookup, hierarchy) => {
188
290
  * const PrevPosition = Descriptor.Component<{ x: number; y: number }>()("Game/PrevPosition")
189
291
  * const Position3 = Descriptor.Component<{ x: number; y: number; z: number }>()("Game/Position3")
190
292
  * const PrevPosition3 = Descriptor.Component<{ x: number; y: number; z: number }>()("Game/PrevPosition3")
191
- * const Game = Schema.bind(Schema.fragment({ components: { Position, PrevPosition, Position3, PrevPosition3 } }))
293
+ * const Root = Schema.defineRoot("Game")
294
+ * const Game = Schema.bind(Schema.fragment({ components: { Position, PrevPosition, Position3, PrevPosition3 } }), Root)
192
295
  * const Sprites = Descriptor.Service<NodeRegistry.NodeRegistry<Sprite>>()("Game/Sprites")
193
296
  * const Meshes = Descriptor.Service<NodeRegistry.NodeRegistry<Mesh>>()("Game/Meshes")
194
297
  * // The loop's render alpha, provided by the host each frame:
@@ -1 +1 @@
1
- {"version":3,"file":"RenderSync.js","sourceRoot":"","sources":["../src/RenderSync.ts"],"names":[],"mappings":"AAsNA;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAYpB,IAA0B,EAC1B,OAAwG,EACsB,EAAE;IAGhI,wEAAwE;IACxE,0EAA0E;IAC1E,MAAM,MAAM,GAAG,IAAI,CAAC,MAAyF,CAAA;IAC7G,MAAM,KAAK,GAAG,IAAI,CAAC,KAA4C,CAAA;IAC/D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAiE,CAAA;IAC1F,MAAM,SAAS,GAAG,OAAO,CAAC,SAA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AI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,CAAA;gBACzF,SAAQ;YACV,CAAC;YACD,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAW,CAAA;YAChD,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAW,CAAA;YAC7C,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,EAAoB,EAAE,MAAM,CAAC,EAAE,CAAC,CAAA;QACxH,CAAC;IACH,CAAC,CAAiF,CAAA;AACpF,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typeonce/ritmo-render",
3
- "version": "0.22.0",
3
+ "version": "0.24.0",
4
4
  "description": "Renderer-agnostic entity-to-node mirroring for Ritmo",
5
5
  "author": "Sandro Maglione",
6
6
  "license": "MIT",
@@ -46,7 +46,7 @@
46
46
  "provenance": true
47
47
  },
48
48
  "dependencies": {
49
- "@typeonce/ritmo": "^0.22.0"
49
+ "@typeonce/ritmo": "^0.24.0"
50
50
  },
51
51
  "engines": {
52
52
  "node": ">=22"
package/src/RenderSync.ts CHANGED
@@ -9,8 +9,11 @@
9
9
  * in a safe order (destroy, create, update), for one bound `Game`. What a
10
10
  * node looks like and how state is applied stay caller-defined. The registry
11
11
  * belongs to the system: when removals were dropped before it read them
12
- * (`lagged()`, after it did not run for long), it destroys every node whose
13
- * entity no longer matches, so give each `RenderSync.system` its own registry.
12
+ * (`lagged()`, after it did not run for long or after a `runtime.restore`),
13
+ * it destroys every node whose entity no longer matches, and the node of
14
+ * every entity added since, which a load may have given to another entity
15
+ * under the same id: that entity gets a new node. So give each
16
+ * `RenderSync.system` its own registry.
14
17
  *
15
18
  * Change detection is per system, so the system sees every addition, change,
16
19
  * and removal exactly once, wherever it sits in the schedule, and applies each
@@ -20,6 +23,16 @@
20
23
  * interpolation). Place the system after the `applyDeferred()` that commits
21
24
  * spawns to render new entities in the same tick.
22
25
  *
26
+ * A node follows its renderable: when the entity's renderable value is no
27
+ * longer the one its node was made from (a system wrote another one, or
28
+ * after a rewind another entity holds an id the system drew), the node is
29
+ * destroyed and made again from the new value, then applied. An equal value,
30
+ * compared as plain data, keeps the node. Making a node costs more than
31
+ * applying one, so the renderable holds what decides which node to make (a
32
+ * kind, a texture, a mesh), and what changes while the node lives (a frame,
33
+ * a tint, a facing) goes in other components, listed in `redrawOn` and set by
34
+ * `apply`.
35
+ *
23
36
  * `create` and `apply` receive one context: the renderable and transform
24
37
  * values, the entity id, extra read-only slots declared in `select` (as read
25
38
  * cells in `data`), resources declared in `resources` (as read cells), and extra
@@ -151,7 +164,16 @@ export interface Options<
151
164
  > {
152
165
  /** The system name. */
153
166
  readonly name: string
154
- /** The component whose presence means "this entity has a node". */
167
+ /**
168
+ * The component whose presence means "this entity has a node", and whose
169
+ * value decides which node `create` makes. When the entity's value is no
170
+ * longer the one its node was made from, the node is destroyed and made
171
+ * again from the new value; an equal value (compared as plain data) keeps
172
+ * it. Keep here only what decides which node to make (a kind, a texture, a
173
+ * mesh): a field written while the node lives (a frame, a tint) would make
174
+ * the node again each time. Put that in its own component, listed in
175
+ * `redrawOn` and set by `apply`.
176
+ */
155
177
  readonly renderable: Renderable
156
178
  /**
157
179
  * The component applied to the node on creation and whenever it changes.
@@ -170,9 +192,12 @@ export interface Options<
170
192
  readonly resources?: Resources
171
193
  /**
172
194
  * More components whose changes re-run `apply`, for node state other than
173
- * the transform: animation frames, tints, interpolation. `apply` then runs
174
- * once per changed entity per sync, however many of these changed, so it
175
- * should set the node's state rather than increment it.
195
+ * the transform: animation frames, tints, interpolation. This is where data
196
+ * that changes while the node lives belongs, not in the renderable, whose
197
+ * new values make the node again (listing the renderable here only re-runs
198
+ * `apply` when it is written with an equal value). `apply` then runs once
199
+ * per changed entity per sync, however many of these changed, so it should
200
+ * set the node's state rather than increment it.
176
201
  */
177
202
  readonly redrawOn?: ReadonlyArray<Schema.ComponentDescriptor<S>>
178
203
  /**
@@ -196,11 +221,18 @@ export interface Options<
196
221
  * parent, so the cost grows with the number of children, not of changes.
197
222
  */
198
223
  readonly hierarchy?: HierarchyOption<S, Hierarchy>
199
- /** Builds the node for a new renderable entity. */
224
+ /**
225
+ * Builds the node for a new renderable entity, and again whenever the
226
+ * entity's renderable takes a value other than the one its node was made
227
+ * from (the old node is destroyed first). Build from the renderable what
228
+ * stays for the node's life; `apply` runs right after and sets the rest.
229
+ */
200
230
  readonly create: (context: NodeContext<S, Root, Renderable, Transform, Select, Services, Resources>) => NodeOf<Registry>
201
231
  /**
202
- * Applies the current state to the node: on creation, and whenever the
203
- * transform or a `redrawOn` component changes.
232
+ * Applies the current state to the node: on creation (also of a node made
233
+ * again for a new renderable value), and whenever the transform or a
234
+ * `redrawOn` component changes. Set here everything that changes while the
235
+ * node lives, from the transform and the `redrawOn` components.
204
236
  */
205
237
  readonly apply: (node: NodeOf<Registry>, context: NodeContext<S, Root, Renderable, Transform, Select, Services, Resources>) => void
206
238
  }
@@ -300,25 +332,112 @@ export const system = <
300
332
  // Despawns are recorded as removals of every component, so these cover them too.
301
333
  removedReads[`removed${index}`] = Game.System.readRemoved(descriptor)
302
334
  })
303
- // One query: an entity whose required component was added, or whose
304
- // trigger changed, is synced once.
305
- const filters = [
335
+ // When `apply` runs: a required component was added, or a trigger changed.
336
+ const applyFilters = [
306
337
  ...additions.map((descriptor) => Game.Query.added(descriptor)),
307
338
  ...triggers.map((trigger) => Game.Query.changed(trigger))
308
339
  ]
309
- // Never empty: `required` always holds the renderable.
310
- queries["sync"] = Query({ selection, filters: [filters.length === 1 ? filters[0] : anyOf(...filters)] })
340
+ // A node follows its renderable, so the sync also meets every entity whose
341
+ // renderable changed, to compare it with the value its node was made from.
342
+ const renderableTriggers = triggers.includes(options.renderable)
343
+ const syncFilters = renderableTriggers ? applyFilters : [...applyFilters, Game.Query.changed(options.renderable)]
344
+ // One query: an entity whose required component was added, or whose
345
+ // trigger or renderable changed, is synced once.
346
+ queries["sync"] = Query({ selection, filters: [syncFilters.length === 1 ? syncFilters[0] : anyOf(...syncFilters)] })
347
+ // Whether `apply` runs for an entity the sync met only for its renderable:
348
+ // looked up (`get` checks one entity against the filters for this reader)
349
+ // when the renderable was written with an equal value, never iterated.
350
+ queries["applies"] = Query({
351
+ selection: { __renderable: Game.Query.read(options.renderable) },
352
+ filters: [applyFilters.length === 1 ? applyFilters[0] : anyOf(...applyFilters)]
353
+ })
311
354
  // Every entity that should have a node: read only after removals were lost.
312
355
  queries["members"] = Query({
313
356
  selection: { __renderable: Game.Query.read(options.renderable) },
314
357
  with: required.filter((descriptor) => descriptor !== options.renderable)
315
358
  })
359
+ // Every entity added since the last run: read only after removals were lost.
360
+ queries["added"] = Query({ selection: { __renderable: Game.Query.read(options.renderable) }, filters: [Game.Query.added(options.renderable)] })
316
361
  // Every renderable entity with a parent: checked each run against where
317
362
  // its node is attached. There is no per-reader filter for relation edges.
318
363
  if (hierarchy !== undefined) {
319
364
  queries["parented"] = Query({ selection: { __parent: Game.Query.readRelation(hierarchy) }, with: [options.renderable] })
320
365
  }
321
366
 
367
+ // The renderable value each node was made from, by entity, for each
368
+ // registry (one system may run in several runtimes). World values are
369
+ // never mutated, so a value still held here by reference is unchanged.
370
+ const madeFrom = new WeakMap<NodeRegistry<Node>, Map<number, unknown>>()
371
+ const sourcesOf = (registry: NodeRegistry<Node>): Map<number, unknown> => {
372
+ let sources = madeFrom.get(registry)
373
+ if (sources === undefined) madeFrom.set(registry, sources = new Map())
374
+ return sources
375
+ }
376
+ const destroy = (registry: NodeRegistry<Node>, sources: Map<number, unknown>, entity: number): void => {
377
+ registry.remove(entity)
378
+ sources.delete(entity)
379
+ }
380
+
381
+ // The context of the node being created, read by one shared thunk, so a
382
+ // creation allocates no closure.
383
+ let creating: Context | undefined
384
+ const createNode = (): Node => options.create(creating!)
385
+ const create = (
386
+ registry: NodeRegistry<Node>,
387
+ sources: Map<number, unknown>,
388
+ entity: { readonly id: number },
389
+ data: Record<string, any>,
390
+ context: Context
391
+ ): Node => {
392
+ // A child met before its parent's node exists starts at the root; the
393
+ // reattach pass moves it under the parent in this same run.
394
+ const parent: number | undefined = hierarchy === undefined ? undefined : data["__parent"]?.get(entity)
395
+ creating = context
396
+ const node = registry.ensure(entity.id, createNode, parent)
397
+ creating = undefined
398
+ sources.set(entity.id, context.renderable)
399
+ return node
400
+ }
401
+
402
+ // An entity whose renderable is not the value its node was made from (by
403
+ // reference): another value makes the node again, an equal one keeps it
404
+ // and is applied only when the entity was met for more than its renderable.
405
+ // A node the system did not make is applied as it is.
406
+ const follow = (
407
+ registry: NodeRegistry<Node>,
408
+ sources: Map<number, unknown>,
409
+ applies: { get(entity: number): { readonly ok: boolean } },
410
+ entity: { readonly id: number },
411
+ data: Record<string, any>,
412
+ node: Node,
413
+ context: Context
414
+ ): void => {
415
+ if (!sources.has(entity.id)) return options.apply(node, context)
416
+ if (!sameValue(sources.get(entity.id), context.renderable)) {
417
+ registry.remove(entity.id)
418
+ return options.apply(create(registry, sources, entity, data, context), context)
419
+ }
420
+ sources.set(entity.id, context.renderable)
421
+ if (renderableTriggers || applies.get(entity.id).ok) options.apply(node, context)
422
+ }
423
+
424
+ // Creates, makes again, or applies the node of one entity the sync met.
425
+ const sync = (
426
+ registry: NodeRegistry<Node>,
427
+ sources: Map<number, unknown>,
428
+ applies: { get(entity: number): { readonly ok: boolean } },
429
+ entity: { readonly id: number },
430
+ data: Record<string, any>,
431
+ provided: Record<string, unknown>,
432
+ cells: Record<string, unknown>
433
+ ): void => {
434
+ const context = contextOf(entity, data, provided, cells)
435
+ const node = registry.get(entity.id)
436
+ if (node === undefined) options.apply(create(registry, sources, entity, data, context), context)
437
+ else if (sources.get(entity.id) !== context.renderable) follow(registry, sources, applies, entity, data, node, context)
438
+ else options.apply(node, context)
439
+ }
440
+
322
441
  return System(options.name, {
323
442
  queries,
324
443
  removed: removedReads,
@@ -327,33 +446,32 @@ export const system = <
327
446
  when: options.when ?? []
328
447
  }, ({ queries, removed, resources, services, lookup }) => {
329
448
  const registry = services.__registry as NodeRegistry<Node>
449
+ const sources = sourcesOf(registry)
330
450
  // Destroy first: an entity that lost a required component has no node,
331
451
  // and one that lost it and got it back since the last run gets a fresh one.
332
452
  let lagged = false
333
453
  for (let index = 0; index < required.length; index++) {
334
454
  const stream = removed[`removed${index}`]
335
- for (const entity of stream.all()) registry.remove(entity)
455
+ for (const entity of stream.all()) destroy(registry, sources, entity)
336
456
  if (stream.lagged()) lagged = true
337
457
  }
338
458
  // Removals were dropped before this system read them (it did not run
339
- // for longer than the stream keeps them): destroy every node whose
340
- // entity no longer has one, so none stays on screen.
459
+ // for longer than the stream keeps them, or a restore replaced the
460
+ // world): destroy every node whose entity no longer has one, so none
461
+ // stays on screen, and every node of an entity added since, which may
462
+ // be another entity under the same id. The sync then makes those once.
341
463
  if (lagged) {
342
464
  const members = new Set<number>()
343
465
  for (const entity of queries["members"].each()) members.add(entity.id)
344
466
  for (const [entity] of [...registry.entries()]) {
345
- if (!members.has(entity)) registry.remove(entity)
467
+ if (!members.has(entity)) destroy(registry, sources, entity)
346
468
  }
469
+ for (const entity of queries["added"].each()) destroy(registry, sources, entity.id)
347
470
  }
348
471
 
349
472
  const data = queries["sync"].data
350
- for (const entity of queries["sync"].each()) {
351
- const context = contextOf(entity, data, services, resources)
352
- // A child met before its parent's node exists starts at the root; the
353
- // pass below moves it under the parent in this same run.
354
- const parent: number | undefined = hierarchy === undefined ? undefined : data["__parent"]?.get(entity)
355
- options.apply(registry.ensure(entity.id, () => options.create(context), parent), context)
356
- }
473
+ const applies = queries["applies"]
474
+ for (const entity of queries["sync"].each()) sync(registry, sources, applies, entity, data, services, resources)
357
475
 
358
476
  if (hierarchy !== undefined) reattach(registry, queries["parented"], lookup, hierarchy)
359
477
  }) as RenderSystem<S, Root, Registry | Services[keyof Services] | Resources[keyof Resources] | ConditionNeedsFromConditions<When>>
@@ -361,7 +479,7 @@ export const system = <
361
479
 
362
480
  // The lookups `reattach` uses, with the generic ids erased.
363
481
  interface HierarchyLookup {
364
- parent(entity: number, relation: unknown): { readonly ok: boolean }
482
+ related(entity: number, relation: unknown): { readonly ok: boolean }
365
483
  ancestors(entity: number, relation: unknown): { readonly ok: true; readonly value: ReadonlyArray<number> } | { readonly ok: false }
366
484
  }
367
485
 
@@ -398,7 +516,7 @@ const reattach = (
398
516
  if (stillParented < registry.parents.size) {
399
517
  const toRoot: Array<number> = []
400
518
  for (const [entity] of registry.parents) {
401
- if (!lookup.parent(entity, hierarchy).ok) toRoot.push(entity)
519
+ if (!lookup.related(entity, hierarchy).ok) toRoot.push(entity)
402
520
  }
403
521
  for (const entity of toRoot) registry.reparent(entity, undefined)
404
522
  }
@@ -413,6 +531,35 @@ const reattach = (
413
531
  for (const move of moves) registry.reparent(move.entity, move.parent)
414
532
  }
415
533
 
534
+ // Structural equality for plain data, as the world compares resource writes:
535
+ // primitives by `Object.is`, arrays and plain objects by their entries, other
536
+ // objects (class instances, maps, sets) by reference.
537
+ const sameValue = (left: unknown, right: unknown): boolean => {
538
+ if (Object.is(left, right)) return true
539
+ if (typeof left !== "object" || typeof right !== "object" || left === null || right === null) return false
540
+ if (Array.isArray(left)) {
541
+ if (!Array.isArray(right) || left.length !== right.length) return false
542
+ for (let index = 0; index < left.length; index++) {
543
+ if (!sameValue(left[index], right[index])) return false
544
+ }
545
+ return true
546
+ }
547
+ if (Array.isArray(right) || !isPlain(left) || !isPlain(right)) return false
548
+ const leftKeys = Object.keys(left)
549
+ if (leftKeys.length !== Object.keys(right).length) return false
550
+ const leftRecord = left as Record<string, unknown>
551
+ const rightRecord = right as Record<string, unknown>
552
+ for (const key of leftKeys) {
553
+ if (!(key in rightRecord) || !sameValue(leftRecord[key], rightRecord[key])) return false
554
+ }
555
+ return true
556
+ }
557
+
558
+ const isPlain = (value: object): boolean => {
559
+ const prototype = Object.getPrototypeOf(value) as object | null
560
+ return prototype === null || prototype === Object.prototype
561
+ }
562
+
416
563
  /** A 2D position, the value `interpolate` blends when no `blend` is given. */
417
564
  export interface Planar {
418
565
  readonly x: number
@@ -524,7 +671,8 @@ interface InterpolateBase<
524
671
  * const PrevPosition = Descriptor.Component<{ x: number; y: number }>()("Game/PrevPosition")
525
672
  * const Position3 = Descriptor.Component<{ x: number; y: number; z: number }>()("Game/Position3")
526
673
  * const PrevPosition3 = Descriptor.Component<{ x: number; y: number; z: number }>()("Game/PrevPosition3")
527
- * const Game = Schema.bind(Schema.fragment({ components: { Position, PrevPosition, Position3, PrevPosition3 } }))
674
+ * const Root = Schema.defineRoot("Game")
675
+ * const Game = Schema.bind(Schema.fragment({ components: { Position, PrevPosition, Position3, PrevPosition3 } }), Root)
528
676
  * const Sprites = Descriptor.Service<NodeRegistry.NodeRegistry<Sprite>>()("Game/Sprites")
529
677
  * const Meshes = Descriptor.Service<NodeRegistry.NodeRegistry<Mesh>>()("Game/Meshes")
530
678
  * // The loop's render alpha, provided by the host each frame: