voxel_engine
This repository contains the public modding API for the Octo voxel game engine. The modding API can be used to develop new games for the engine, in the form of WASM plugins. The following functionality is available:
- Adjusting the camera position
- Drawing in-game GUIs using
egui
- Reading user input, including mouse movements, key presses, and controller inputs
This crate is early in development, and breaking changes may occur at any time. This crate is not guaranteed to follow semantic versioning.
Getting started
The following is an abridged tutorial demonstrating how to compile/load a WASM plugin into the voxel engine. A complete example plugin can be found in the example_mod
directory.
First, initialize a Rust project:
cargo new my_mod --lib
Next, add the following lines to the Cargo.toml
:
[]
= [ "cdylib" ] # Indicate that cargo should generate a .wasm file
[]
= { = "0.1" } # Provides access to engine APIs
= { = "0.1" } # Allows for creating WASM plugins
Then, create an example WingsSystem
and export it. This will cause the engine to load the system:
use *;
use *;
use *;
// The game client will load all systems listed in brackets.
instantiate_systems!;
/// A system that will print out the frame
/// time each frame.
Next, build the WASM mod with Cargo:
cargo build --target wasm32-wasip1
The resultant WASM binary will be located under target/wasm32-wasip1/release
. This file can be selected and loaded into the voxel engine.