unrust
unrust copied to clipboard
Investigate replacing stdweb with wasm-bindgen ?
This is an exploratory issue. wasm-bindgen is making great progress and might be much faster than stdweb for passing data between Rust and js. That might be very interesting, especially for opengl buffers. https://hacks.mozilla.org/2018/04/javascript-to-rust-and-back-again-a-wasm-bindgen-tale/
Maybe we could start investigating wasm-bindgen on some lower module, like uni_pad or uni_snd
Indeed, i had this idea before, but we should figure out how following items works :
- What is the output of these lower module ? A wasm file + JS file (using wasm-bindgen) ? And how do we "link" these deliverables when the main engine ?
- If cargo do support linking wasm file directly (i don't know), how can we run the game without cargo web ?
Basically, i do not have the big picture about how JS and rust cooperate. Do you have any idea about it?
No idea so far but i'll start playing with it. In my idea, we should still have a single wasm, only replacing internal stdweb glue with wasm-bindgen. I don't now if this impacts cargo-web though.
On the other hand, if custom task is landed, we can write a custom task to build all the js glue code , html and other assets we need to run the game. But even this is not landed, we can still make a cargo sub-command to do so.
If we have a sub-command, we can go a lot of crazy stuff like preprocessing asset to an bundle, convert file format, etc. I start to think it is a very good idea. :)
A cargo unrust sub command ? This looks sexy !