Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad client performance because of frequent entities store updates #264

Open
1 of 3 tasks
pwrstudio opened this issue May 5, 2024 · 0 comments
Open
1 of 3 tasks

Comments

@pwrstudio
Copy link
Member

pwrstudio commented May 5, 2024

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:

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:

Solutions / improvements

  • In initEntites, only write the data that is relevant to the player.
  • In createComponentSystem, abort before updating store if the data is not relevant
  • Set svelte store in a web worker. Doesn't solve the problem of the growing amount of data to handle.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant