fishgame-macroquad
fishgame-macroquad copied to clipboard
Wasm modding
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.
This now compiles and runs in WASM by inlining the core_plugin. With that change I believe this code is ready for review.