Rust · WebGPU · Deterministic
Same code, same simulation, every screen.
oniq is a game engine written in Rust on WebGPU. One codebase runs natively, in the browser and on Android, and the same inputs produce the same simulation on every machine. That is what makes lockstep multiplayer and exact replays work.
Running in your browser, right now
This is the engine itself, compiled to WebAssembly: its ECS, Rapier physics, sprite renderer and MSDF text, drawing on WebGPU in a canvas on this page. The scene is ordinary oniq code; on the desktop the same build runs in a window, with run in place of run_web.
Controls Press and hold anywhere in the scene to push the bodies away.
What's in the engine
A fairly complete 2D engine on a 3D-capable foundation, with a sizeable creative toolkit. Most of it sits behind Cargo features, so a game compiles only what it uses.
-
ecs
Simulation core
An archetype ECS with deterministic iteration order, a staged scheduler, fixed-timestep time, and snapshot serialization with deltas and compression.
-
render
Rendering
A WebGPU pipeline on wgpu: sprite batching, atlases, materials, a procedural sky with weather and lighting, bloom, and WGSL effects with a CPU fallback.
-
text
Text
Font loading, MSDF glyphs, and full shaping and bidirectional layout through sigilbuzz: GSUB and GPOS, Arabic and Indic scripts, variable fonts, inline markup.
-
anim
Animation
State machines and keyframe tweening, plus Spine 4.3 skeletal animation through the pure-Rust chine runtime, with IK, path and physics constraints.
-
physics
Physics
Rapier 2D by default and Rapier 3D behind a feature, a fixed-point solver for bit-exact replicated simulation, and Salva fluids.
-
net
Networking
Lockstep and snapshot-interpolation netcode, a replay tap, compression, LAN discovery and session auth, over native QUIC, WebTransport and WebSocket.
-
audio
Audio and input
A kira-backed audio context with panning and a streaming PCM sink, Web Audio in the browser, and keyboard, pointer, touch and gamepad input.
-
script
Scripting and tools
A sandboxed Rhai runtime, scriptable dockable panels, a debug console with a command registry, and an ECS inspector driven by a derive.
-
toolkit
2D content toolkit
Brushes, tilemaps, atlas packing with 9-slice, palettes and dithering, image processing, selection masks, and bones with CCD and FABRIK IK.
Write it once. Host it anywhere.
A game is a world and an update function. AppHost runs them at a fixed 60 Hz in whatever the platform offers: a desktop window, an Android activity, or a canvas in a web page.
The showcase arena is built once by arena::build. Its desktop example calls run; this site calls run_web with the same host and the same update.
// The game: a world and a fixed-step update.
let (host, update) = arena::build()?;
// A desktop window.
host.run(update)
// An Android activity.
host.run_android(app, update)
// A canvas in a web page, on WebGPU.
host.run_web(canvas, update)
Deterministic, by design
Determinism is the throughline of the engine. The same inputs give the same simulation on every machine, which turns multiplayer and replays into a matter of sharing inputs.
A fixed 60 Hz step
The simulation advances in fixed ticks, decoupled from the display, so it runs the same at any frame rate.
Ordered by construction
Deterministic ECS iteration and generation-checked handles: no hash-order surprises between runs.
Bit-exact when it counts
A fixed-point Q32.32 math path with table-based trigonometry for physics that matches across platforms.
Netcode and replays
Lockstep and snapshot-interpolation strategies, and a replay tap that records a match's inputs to play it back exactly.
Shipping on oniq
Three deliberately different products share the engine: a creative tool, a systems-level emulator frontend, and a networked game.
-
pixel-stroke
A pixel and vector art editor with brushes, layers, bones and animation, on the desktop and the web.
-
PolyConsole
A libretro frontend for the TV, the desktop and Android, driven through oniq's runtime, input, text and audio.
-
Sqrly
A networked lockstep game: the engine's reference multiplayer title, with its client, server and shared simulation in the oniq repository.
Start with a scene.
A camera, a few entities and an update function are a running game, natively or in a browser tab.