Describe how the run is written into the model (#287)
Architecture: syncToModel compares each entity with what the model last said instead of resolving every object in every frame, with the contract behind it and the measured numbers.
1 parent
c8cc9cdc2f
commit
9d9e73e243
1 file changed
+12
+12
@@ -370,6 +370,18 @@ averages per frame over 0.5 s, the window of the fps readout. *Possible* on top
|
||||
`timeSystem` unset, so the world runs untimed there. Browsers round `performance.now()` (Chromium
|
||||
to 0.1 ms without cross-origin isolation), which the average over some 30 frames smooths out.
|
||||
|
||||
Writing the run into the model is `World.syncToModel`, and it runs after every frame of a run, so an
|
||||
edit made while playing lands on the current state. It does not resolve every object each time
|
||||
(#287): for each entity the world keeps what the model said when it last read the object
|
||||
(`syncFromModel`, `spawn`) or wrote it, and a frame only compares the entity with that. A place
|
||||
that differs is written as three numbers. A value that differs is written as an override, and that
|
||||
one object is resolved again, because an override can bring rows of its own (a sprite's shader).
|
||||
The objects of entities that left the run are dropped only in a frame in which one left. The
|
||||
contract behind it: during a run nothing but the world writes the model without having it read
|
||||
again. The editor does that on every project event (`Editor`, `EditorRun.refresh`). On the
|
||||
reference project of #284 (222 entities) this took `syncToModel` from 0.92 to 0.12 ms a frame, and
|
||||
the *Editor* line of the overlay from 1.2 to 0.26 ms.
|
||||
|
||||
Rules that keep it organised: `core/` imports nothing from other layers; `ui/` never sees
|
||||
assets; position exists only on scene objects; overrides are merged in exactly one place
|
||||
(`core/properties/resolve.ts`); the inspector is generated from `PropertySchema` — a new
|
||||
|
||||
Reference in new issue
Block a user