-
Notifications
You must be signed in to change notification settings - Fork 30
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
collab #61
Comments
One issue with no-emscripten host is aync is very tricky, and downloading files pretty much requires async (although you can do oldschool XHR synchronous, it's blocking and will mess up the main thread, if the files are big.) I get around this in null0 with a zip file that represents all the assets the wasm has access to. I preload it in both hosts, so all the code works the same. For self-contained "game carts" this works best for me, but it's not exactly like it would be in plain-native. In raylib-wasm, I get around it by using Another solution is to map all the files up-front with WASI. bjorn3/browser_wasi_shim does this, so when the game-wasm asks for a file, it's already been downloaded & mapped to a file-location, and can be accessed synchronously. This is similar to what emscripten does with Also, following a naming-convention helps with both of these ways, I think. In my zip-files, I have
and it would automount in browser this could be done like const game = await zoz('main.wasm', {
fs: {
'assets/logo.png': 'https://example.com/assets/logo.png'
}
}) where everything in the fs option gets downloaded before the wasm runs. It could support zips, too, for a similar thing to null0, which might be easier for distributing your zoz-game: const game = await zoz('game.zip') This would download the zip, extract all the files and build the initial WASI fs, and then run You can use "magic bytes" to detect what kind of file it is, since both have 4-byte headers, and even combine them (initially load the zip fs, and then download all the files in On web, this can be supported with unzip.js or similar. |
Hey, I work on node-raylib and raylib-wasm, and also my own game-engine null0, which all do similar things, but with different approaches. I love what you are doing here. We should join forces!
Here are some things I worked on, that I think relate:
Here are some ideas, I have initially, of how we might be able to work together:
There are probly other things, since it seems like we are working on a lot of the same ideas.
The text was updated successfully, but these errors were encountered: