Engine studies
Play a 3D game, then run the individual systems it takes to build one, from materials and fluids to audio and networking.

WASD to move, mouse or arrows to look, Space to jump, click or G to fire. Esc releases the mouse.
Drag left to move and right to look. Tap Jump, Fire or Link.
Explore a 3D plaza in first person, rendered by Keel in your browser.
Open Sunbreak Plaza →
Rendering
Physically based materials from mirror to matte, lit by moving coloured lights, with bloom and filmic tone mapping.

Fluids
Position-based fluid particles, simulated every frame.

Animation
Springs and tweens drive motion with physical feel.

Physics
Rigid bodies and colliders from Rapier, stepped at a fixed rate. Click to drop a ball.

UI kit
Layout, text and controls drawn by the engine itself.

Audio
Press a pad and the engine's mixer plays its note, through Web Audio in the browser.

Networking
Rollback netcode keeps two peers in sync with 120 ms of simulated latency each way.

World building
Layered noise shapes an island that rises out of the sea; the same seed builds the same world.
From Rust to the rendered frame.
See what Keel rendered, then read the lines from the Rust source used to build the scene.
Rigid bodies

let dt = w.resource::<Time>().map_or(1.0 / 60.0, |time| time.delta());
w.resource_mut::<RapierPhysics>().unwrap().step(dt).unwrap();Full Rust listing: Rigid bodies
#[cfg(any(not(target_arch = "wasm32"), feature = "web-studies"))]
fn physics(world: &mut WorldConfig) {
world
.profile(GameProfile::Playable3d)
.insert_resource(RapierPhysics::new());
// A floor, then a tower of boxes.
body(
world,
BodyType::Static,
Vec3::new(0.0, -0.5, 0.0),
ColliderShape::Cuboid {
half_extents: Vec3::new(8.0, 0.5, 8.0),
},
);
for level in 0..8 {
for x in -2..=2 {
let at = Vec3::new(x as f32 * 1.05, 0.5 + level as f32 * 1.02, 0.0);
body(
world,
BodyType::Dynamic,
at,
ColliderShape::Cuboid {
half_extents: Vec3::splat(0.5),
},
);
}
}
world.exclusive(SystemPhase::Fixed, |w: &mut EcsWorld| {
// Step the simulation, then move each mesh to its body.
let dt = w.resource::<Time>().map_or(1.0 / 60.0, |time| time.delta());
w.resource_mut::<RapierPhysics>().unwrap().step(dt).unwrap();
for entity in w.entities_with::<Body>() {
let state = w
.resource::<RapierPhysics>()
.unwrap()
.body_state(entity)
.unwrap();
let mut transform = w.get_mut::<Transform3d>(entity).unwrap();
transform.translation = state.translation;
transform.rotation = state.rotation;
}
});
}Particles

emitter.tick(dt);
// Swirl: every particle turns around the vertical axis as it rises.
for p in emitter.particles.iter_mut() {
let (x, z) = (p.pos[0], p.pos[2]);
p.pos[0] = x * 0.995 - z * 0.05;
p.pos[2] = z * 0.995 + x * 0.05;Full Rust listing: Particles
#[cfg(any(not(target_arch = "wasm32"), feature = "web-studies"))]
fn vfx(world: &mut WorldConfig) {
let sparks = EmitterDesc {
rate: 220.0,
speed: 2.4.into(),
life: 2.2.into(),
size: 0.09.into(),
gravity: [0.0, 1.6, 0.0],
drag: 0.6,
shape: SpawnShape::Ring {
radius: 0.6,
tube: 0.08,
},
color: Srgba::rgb(1.0, 0.55, 0.2).into(),
color_end: Some(Srgba::rgb(0.3, 0.8, 1.0)),
size_end: 0.0,
..EmitterDesc::default()
};
world
.profile(GameProfile::Playable3d)
.insert_resource(ParticleEmitter::new(sparks))
.exclusive(SystemPhase::Fixed, |w: &mut EcsWorld| {
let dt = w
.resource::<Time>()
.map_or(1.0 / 60.0, |time| time.delta_f32());
let mut emitter = w.resource_mut::<ParticleEmitter>().unwrap();
emitter.tick(dt);
// Swirl: every particle turns around the vertical axis as it rises.
for p in emitter.particles.iter_mut() {
let (x, z) = (p.pos[0], p.pos[2]);
p.pos[0] = x * 0.995 - z * 0.05;
p.pos[2] = z * 0.995 + x * 0.05;
}
});
}Build your next game, app and site on Keel.
Keel Engine is source-available under the Business Source License 1.1. Commercial licences are agreed per licensee.