WASM as a Platform for Abstraction

I recently played around with embedding WASM in an application that needs to load arbitrary code at runtime, while simultaneously providing a sandboxed environment that keeps the user-provided code separated from the underlying runtime.

Turns out adding a WASM runtime to your application is really easy! I was expecting the process to be quite involved and require digging through loads of low-level detail, but the wasmer runtime exposes a really nice API and documentation.

Let me know if you are interested in this sort of thing and I'll keep you updated on the project's progress.

6 Likes

Very interesting. The moment I got my first WASM running in node.js I realized this has so much more potential than just being web browser run time.

I was looking at it from the point of view of delivering platform agnostic applications to servers, remote embedded systems and the like. No messing around building architecture specific binaries, all sand boxed and safe, easy to update, roll back etc.

As the Docker creator said (something like): If WASM was available when Docker was created there would have been no need to create Docker.

Checking out the various presentations on YouTube about WASM it seems many had already had this idea and are hard at work on it.

3 Likes

Very much so!

We’ve had an extensive discussion about this use case in Amethyst together with the wasmer folks:

@caelunshun got close to a proof-of-concept:

@zesterer and the Veloren team have also been investigating this avenue:

Pretty sure @repi and the folks at Embark are doing something in this space as well.

1 Like

That's really cool!

I'd like to explore this space a lot more because I think Rust has a lot to offer (both as a community and as a language), especially with projects like wasm-bindgen and wasmer pushing the limits in what we can do and leading the standardisation efforts. Unfortunately my day job doesn't involve Rust or WebAssembly, but I'll hopefully be able to help out and follow things in my spare time :slight_smile:

1 Like

I'm planning on using WebAssembly to implement plugins for the next version of my Voxels game (like Minecraft), which I'm planning on writing in Rust as a cross-platform (Linux, Windows, Android, macOS, iOS) Vulkan-based game when I have time. I've been participating in WASI to help support for totally deterministic execution (no timers, threads, or secure random when in deterministic mode) so I can use WebAssembly to calculate the next state for each block in-world and use a 3D multi-threaded version of HashLife to accelerate world simulation.
Planning on something closer to MineTest rather than Minecraft, in that Voxels will be an engine that block-based games can be built on rather than just a single game. It will still have a decently complex default game, though.

3 Likes