Thanks to visit codestin.com
Credit goes to github.com

Skip to content

LeviLovie/wasm-mods

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wasm Mods

This project is an example of how to use wasmtime as a modding system for games written in Rust. I use a wrapper around wasmtime made by DouglasDwyer.

Goals

  • Event system
  • Internal data
  • Callbacks
  • Graphics
  • Player control example

Project Structure

  • src - Game logic.
  • wit - WIT API defenitions.
  • mods - Crates with module logic compiled to WASM.
  • crates - Some packages to simplify code.
    • mod_macros - A few macros to make mod creation easier.
    • mod_manager - Abstraction for interacting with WASM packages.
    • utils - Utils for development.
    • types - Type defs shared between mods and game.

Running

Build occurs in two stages: main executable and mods. Mods are built through the build.rs file which runs build scripts inside mod directories and copies binaries into the wasm folder next to the executable.

NOTE: The build scripts are in bash format. Support for windows is planned in the future

Make sure you have rust, cargo, and wasm-tools installed on your machine.

Install wasm32-unknown-unknown build target with:

rustup target add wasm32-unknown-unknown

Run with:

RUST_LOG=info cargo run

About

Wasmtime Mods PoC

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published