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

Client syncing does not scale #262

Open
pwrstudio opened this issue May 4, 2024 · 0 comments
Open

Client syncing does not scale #262

pwrstudio opened this issue May 4, 2024 · 0 comments

Comments

@pwrstudio
Copy link
Member

pwrstudio commented May 4, 2024

Problem

Current syncing of indexer state to client does not scale.

Getting data from the indexer is quick and no problem. It is the updating of the entities store that takes long (currently about 10 seconds) and blocks the UI in the process, so we can't show any progress indication either.

We are currently getting everything from the indexer, syncing it all to the entitites store, then filter it down to only the machines etc... that are in the player's own pod.

This problem will get worse and worse very quickly.

Current method

We set up listeners for all tables we are interested in here:

for (const componentKey of mudLayer.tableKeys) {

The svelte store is then update on each update from the chain:

So far this works OK once you are in the game – but not on load when you get 3000+ updates quickly.

Possible solution 1

Filter what we sync from the indexer.

We need:

  • All orders, recipes, offers, materials.
  • gameConfig
  • all players names
  • only machines, tanks that are in the player's pod (same carriedBy component value)

Can we filter by the carriedBy value?

How do we know the id of the players pod before syncing?

Possible solution 2

Get state from indexer.
Set entities in one go.
Avoiding the many calls to entities.update.

Possible solution 3

Move updating the entities store to a webworker.

Probably not possible.

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