Skip to content

Add WASM module to generate seed data on the fly#1

Open
babit56 wants to merge 4 commits into
FireIsGood:mainfrom
babit56:main
Open

Add WASM module to generate seed data on the fly#1
babit56 wants to merge 4 commits into
FireIsGood:mainfrom
babit56:main

Conversation

@babit56

@babit56 babit56 commented Jan 1, 2026

Copy link
Copy Markdown

Add WASM module based on the rnssp lib for generating runs. Only adds the rust code and necessary stuff to load the WASM module, some UI is still needed. I added a proof of concept in seed-select.svelte of how the module could be used.
Generating on the fly is quick enough that the seed searcher could probably directly use the wasm output to display a seed (and thus support any seed, any unlock, any player count without hassle)

The two options have slightly different output due to wasm reasons(tm), see rnssp_wasm/src/lib.rs for some comments on that. In short, one option uses IDs instead of strings for referring to areas, which requires some minor refactoring in JS. Since both options are roughly equally fast I guess the one not requiring refactoring is better.

Performance

It seems like the majority of the runtime is just simulating the seeds, not converting/moving data between wasm/js, so it seems it doesn't matter how that part is done.
Both examples I left in reset_seed_data() for replacing seed data run in about the same time, ~40s on a 7y old Thinkpad. I assume it could take up to a couple minutes on an even worse machine.
40s is still enough that firefox asks user to kill the process, so a warning or a mitigation for that is probably needed. I don't know web stuff tho. Maybe run wasm in webworker or async...?

Building wasm

Install wasm-pack. Build code with it.

cargo install wasm-pack
cd rnssp_wasm/
wasm-pack build

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.

1 participant