Early development · v0.0.6

Rust-like mods
for Bevy games

Oxeon is a scripting language with Rust’s syntax and ownership model. Mods compile to WebAssembly, run in a sandbox, and use Bevy’s own ECS and reflection, so a mod looks just like Bevy code.

mods/regen.ox
// Regenerate health over time.
// Health and Regen are the game's own components.
fn regen(
    time: Res<Time>,
    mut q: Query<(&mut Health, &Regen)>,
) {
    for (mut hp, regen) in &mut q {
        hp.0 += regen.per_sec * time.delta_secs();
    }
}

pub fn plugin(app: &mut App) {
    app.add_systems(Update, regen);
}

Why Oxeon

Modding should feel like writing the game itself, without letting a mod take the game down.

  • Rust you already know

    Type- and borrow-checked

    A strict subset of Rust: ownership, borrowing, traits, generics, enums, pattern matching and ?. A mod that sticks to the core also compiles as a native Bevy plugin.

  • Sandboxed by default

    Fuel limits work

    Each mod runs in its own WebAssembly instance with a fuel budget. It can only touch what the game grants it, and a mod that traps is disabled while the game keeps running.

  • Bevy-native

    Mods run in Bevy

    Mods use Bevy’s own ECS and reflection. Bindings come from the game’s type registry, so mods see its real components and resources, fully type-checked.

  • Hot reload

    Reload works

    Edit a mod while the game runs: it recompiles on save, and a version with errors leaves the last good one running. Carrying mod state across reloads comes next.

  • Fast to compile, fast to run

    In progress

    Oxeon compiles to WebAssembly, and Wasmtime turns it into native code. Compile time and runtime speed get equal priority. A mod compiles in a few milliseconds.

  • Editor support

    In progress

    A language server and a VS Code extension: go to definition, completion, rename, hover, inlay hints, quick fixes and formatting, plus type and borrow errors as you type, inferred types and completion after . from the type checker.

How it works

Your game stays native Rust. Oxeon adds a compiler and a sandbox between the mod and your world. This is the design; the roadmap shows which parts exist today.

  1. 1.ox sourceLoaded as a Bevy asset
  2. 2Oxeon compilerParses, type-checks and borrow-checks
  3. 3WebAssemblyRun by Wasmtime, or by the browser’s engine in a web build
  4. 4SandboxFuel limits and granted capabilities only
  5. 5Bevy WorldMod systems run in your schedules

Get started

Add the plugin to your Bevy app, then drop .ox files into your assets folder.

Oxeon is in early development. Mods run today, with a first slice of the language: numbers, structs, enums, match, generics, closures, Option and Result with ?, and methods. Their systems use your resources, messages and Querys with filters, Commands, and components and resources of their own, and they can log with info! and use rand. Traits, strings and collections come next. The guide lists exactly what works, and the examples show mods that run today.

Editor support

The Oxeon extension for VS Code (v0.0.8, preview) brings highlighting, type errors as you type, go to definition, completion, rename, hover with types and docs, inlay hints, quick fixes, and formatting on save. Builds for Linux, Windows and macOS include the language server, so there’s nothing else to install.

Terminal
$ cargo add oxeon
src/main.rs
use bevy::prelude::*;
use oxeon::prelude::*;

#[derive(Component, Reflect)]
#[reflect(Component)]
struct Health(f32);

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugins(OxeonPlugin::default())
        .expose_to_mods::<Health>()
        .add_systems(Startup, load_mods)
        .run();
}

fn load_mods(mut commands: Commands, assets: Res<AssetServer>) {
    commands.spawn(OxeonMod(assets.load("mods/regen.ox")));
}

Roadmap

Oxeon is built in the open. Here’s where it stands.

  1. FoundationsWorkspace, lexer, sandboxed runtime, Bevy asset loading
  2. ParserThe full Rust subset, with error recovery
  3. Editor toolingLanguage server and VS Code extension
  4. SemanticsName resolution, type checking with generics, closures and traits, MIR and the borrow checker done; lifetimes in signatures and associated types next
  5. Code generationStructs, enums, match, generics, closures, traits and dyn Trait, Option, Result, Vec and Box and operators on your own types compile; strings and SIMD next
  6. Bevy bridgeMods run in Bevy with generated bindings, Commands, resources, messages, their own components and resources, logging and the game’s Transform; a browser runtime for web builds; more schedules and parallel systems next
  7. Mod featuresHot reload, async, sandboxed macros

Full roadmap on GitHub →