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

Multiplayer Improvement: Upload files in parallel to minimize latency #13036

Open
touhidurrr opened this issue Mar 6, 2025 · 5 comments
Open

Comments

@touhidurrr
Copy link
Contributor

Ok
I added a 'copy stacktrace to clipboard' so in future errors it will be easier to debug

Also, this reminds me of something. I remember that game did not try to upload preview files when the main save file upload failed. Why are we not trying to upload these files in parallel. This should reduce next turn time in multiplayer.

Originally posted by @touhidurrr in #12997

Issue opened as to server as a reference to the discussion.

@yairm210
Copy link
Owner

yairm210 commented Mar 6, 2025

Turns out there's a comment describing why!

    // We upload the preview after the game because otherwise the following race condition will happen:
    // Current player ends turn -> Uploads Game Preview
    // Other player checks for updates -> Downloads Game Preview
    // Current player starts game upload
    // Other player sees update in preview -> Downloads game, gets old state
    // Current player finishes uploading game

So we basically have to upload the preview AFTER the game

@touhidurrr
Copy link
Contributor Author

I thought about this. But is that really an issue? If preview > main then the game simply reloads the main save file. Which resets the turn. So, i do not think we should honor this rare race condition.

@yairm210
Copy link
Owner

yairm210 commented Mar 6, 2025

On the other hand, uploading the preview is so fast that it doesn't really save us any considerable time if we parallelize it

@touhidurrr
Copy link
Contributor Author

Recently many are reporting high latency issues. If latency is even 300ms, the 2 files would take 600ms. 600 vs 300 looks like a good enough improvement for me.

@yairm210
Copy link
Owner

yairm210 commented Mar 6, 2025

File upload time is usually based on size of file, the preview is a really tiny file
But you know what, we can test this and see, if we get people reporting weird MP errors we can revert it

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

2 participants