Continuation of #262
Problem
Client is laggy.
The entities store is updated every time any table is updated.
Due to how the tables are structured, with CarriedBy, indicating which pod a machine belongs in, not being a key there does not seem to be a way for us to filter to only get the content of the players pod from the indexer.
The loading problem in #262 was improved by not relying on the update streams to set the initial local state. Rather using this:
https://github.com/Moving-Castles/this-cursed-machine/blob/main/packages/client/src/svelte/modules/systems/initEntities.ts
And then ignoring updates where the new and old values are the same:
|
if (deepEqual(nextValue, prevValue)) return |
Problems are:
entitites store is large and growing
- Updates to the store is triggered frequently, disrupting the UI
How do we ignore updates that are not relevant to the player?
The heavy part of the update is this:
|
entities.update(value => { |
Solutions / improvements
Continuation of #262
Problem
Client is laggy.
The
entitiesstore is updated every time any table is updated.Due to how the tables are structured, with
CarriedBy, indicating which pod a machine belongs in, not being a key there does not seem to be a way for us to filter to only get the content of the players pod from the indexer.The loading problem in #262 was improved by not relying on the update streams to set the initial local state. Rather using this:
https://github.com/Moving-Castles/this-cursed-machine/blob/main/packages/client/src/svelte/modules/systems/initEntities.ts
And then ignoring updates where the new and old values are the same:
this-cursed-machine/packages/client/src/svelte/modules/systems/createComponentSystem.ts
Line 14 in c64eed6
Problems are:
entititesstore is large and growingHow do we ignore updates that are not relevant to the player?
The heavy part of the update is this:
this-cursed-machine/packages/client/src/svelte/modules/systems/createComponentSystem.ts
Line 25 in c64eed6
Solutions / improvements
initEntites, only write the data that is relevant to the player.createComponentSystem, abort before updating store if the data is not relevant