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

netplay: patch export globals and sync them #715

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JerwuQu
Copy link
Contributor

@JerwuQu JerwuQu commented Apr 28, 2024

Solves #649 and #542.

Tested with the cart from #542 (comment).

I understand if this is not the direction you wanna go and maybe something should be done differently, but it's a start at finally getting this fixed :)

@aduros
Copy link
Owner

aduros commented Jun 2, 2024

I like the idea of preprocessing the wasm to export globals, but using JSON in the serialization seems inefficient.

I wonder if we can assume that the entire globals section is a known fixed size and ordering. Then we'd only need to write the values into the saved state. I think we could also write each value as binary, the exact type also being known. What do you think?

@JerwuQu
Copy link
Contributor Author

JerwuQu commented Jun 3, 2024

Unfortunately I don't think we can get globals as binary data from JS and would have to convert it back and forth from JS types ourselves. At that point I'd guess the browser implementation of JSON isn't actually slower and is a lot less code.

I'd agree with looking into fancier solutions if we serialized this often, but to my knowledge it's only on client connections and user savestates (?)

Feel free to look into it! I'm pretty happy with the WASM patcher code but for the State-code I just made something that works :)

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

Successfully merging this pull request may close these issues.

None yet

2 participants