fishgame-macroquad icon indicating copy to clipboard operation
fishgame-macroquad copied to clipboard

Wasm modding

Open alec-deason opened this issue 3 years ago • 2 comments

Original spec

This implements a modding system that is adequate to handle the existing weapons (along with similar things) and which should be reasonably easy to extend to more exotic weapons and items and potentially even things like AI agents.

The mods are written in WASM and hosted using https://crates.io/crates/wasm_plugin_host

This PR includes an implementation of the existing weapons in core_plugin as a rust project. It should be possible to write plugins in other examples though I haven't included any here. There is a generic example of a wasm_plugin compatible plugin written in assemblyscript that could be a starting point for a non-rust Fish Game mod: https://github.com/alec-deason/wasm_plugin/tree/main/example/example_assemblyscript_host/assemblyscript_plugin

Limitations:

This currently does not compile to the wasm target. Some additional work is needed in wasm_plugin to support WASM hosts (https://github.com/alec-deason/wasm_plugin/issues/3). Because of that I'm marking this PR as draft. I'm not currently sure what's the quickest route to getting a working WASM version of Fish Game using these changes. I'll need to look more closely at how much work getting WASM host support in wasm_plugin is, it may end up being pretty easy.

These changes are currently blocked by https://github.com/not-fl3/macroquad/pull/217 for audio support.

alec-deason avatar May 01 '21 20:05 alec-deason

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar May 01 '21 20:05 CLAassistant

This now compiles and runs in WASM by inlining the core_plugin. With that change I believe this code is ready for review.

alec-deason avatar May 05 '21 21:05 alec-deason