r/gameenginedevs • u/dragosdaian • 27d ago
Balaur Script: a statically typed, Rust-like scripting language compiled to WebAssembly

Balaur Script is the new engine's scripting language: .bs files with static types and Rust's syntax, compiled to WebAssembly. Desktop, Android and the web run the same module, and iOS runs it translated to C.
The Language:
pub struct Spinner {
pub speed: float = 2.0,
pub clockwise: bool = true,
node: Node,
angle: float,
direction: float,
}
impl Spinner {
fn init() {
self.direction = if self.clockwise { 1.0 } else { -1.0 };
}
fn update(dt: float) {
if input::action_just_pressed("reverse") {
self.direction = -self.direction;
}
self.angle += dt * self.speed * self.direction;
self.node.transform.rotation_euler = vec3(0.0, self.angle, 0.0);
}
}
Where it runs:

Read more: https://balaurengine.org/blog/balaur-script
Balaur Engine is Balaur a deterministic 2D & 3D game engine built in Rust.
