CONNECTING...

Documentation

Everything you need to build games for Emberware

Developer Book

The complete Emberware developer documentation, hosted as an mdBook.

Open Full Documentation

Common Patterns

Minimal Game

#![no_std]
#![no_main]

use core::panic::PanicInfo;

#[panic_handler]
fn panic(_: &PanicInfo) -> ! {
    core::arch::wasm32::unreachable()
}

#[link(wasm_import_module = "env")]
extern "C" {
    fn draw_rect(x: f32, y: f32, w: f32, h: f32, c: u32);
}

#[no_mangle]
pub extern "C" fn init() {}

#[no_mangle]
pub extern "C" fn update() {}

#[no_mangle]
pub extern "C" fn render() {
    unsafe { draw_rect(100.0, 100.0, 50.0, 50.0, 0xFF6B6BFF); }
}

Rollback-Safe State

// All game state in static variables
static mut PLAYER_X: f32 = 100.0;
static mut PLAYER_Y: f32 = 200.0;
static mut SCORE: u32 = 0;

#[no_mangle]
pub extern "C" fn update() {
    unsafe {
        // Read input for both players
        let p1_move = left_stick_x(0);
        let p2_move = left_stick_x(1);

        // Deterministic updates
        PLAYER_X += p1_move * 5.0;
    }
}

// Multiplayer just works!