ferravex
GitHub

Start building with Ferravex

Ferravex is a small, readable Rust engine for 2D and 3D games. Everything from math and physics to rendering, audio and netcode lives in this repository, so you can follow any behavior straight to its source.

You need Rust 1.88 or newer and Python 3.11 or newer. There is nothing else to install and nothing to download: every Rust dependency is a crate in this repository (why).

Make a game in a minute

From the Ferravex checkout:

python3 -B scripts/ferravex.py new moon-garden
cd ../moon-garden
cargo run

new creates a playable game next to the checkout, and cargo run opens it in a window after a first build of a few seconds. Steer from the starting pad to the gold beacon with WASD or the arrow keys. Add --template 3d to new for the 3D starter.

The project is a standalone Cargo workspace with its own lockfile and a local ferravex dependency; generating it never edits the checkout. Pass a destination as the second argument to put it somewhere else, for example new moon-garden ~/games/moon-garden. Optional --tick-rate HZ (1 to 1000, default 60) and --window-title TITLE flags set the rule rate and the title.

Make it yours

cargo test                               # rules and doc tests, no window needed
python3 scripts/build-web.py --serve     # play it at http://127.0.0.1:8000/

The browser build needs the WebAssembly target once: rustup target add wasm32-unknown-unknown. It goes into the project's own target/web folder and nothing is deployed. The generated README lists the controls and a few first edits to try.

If something fails

Native windows need your platform's display and graphics libraries (on Linux: X11 and a working OpenGL driver). To check your tools without launching anything, run these from the checkout:

python3 -B scripts/ferravex.py doctor --profile core
python3 -B scripts/ferravex.py doctor --profile web

Platforms covers prerequisites per operating system, and template verification describes what the generator is tested against.

Play the bundled games

Want to see what the engine can do first? python3 -B scripts/ferravex.py list shows every bundled game, and python3 -B scripts/ferravex.py run neon-swarm runs one natively. To build and serve every browser game from the checkout:

python3 -B scripts/ferravex.py doctor --profile web
python3 -B scripts/ferravex.py build-web release --jobs 2
python3 -B scripts/serve-web.py --bind 127.0.0.1 --port 8000

This needs the WebAssembly target from the previous step. Open http://127.0.0.1:8000/ for the game catalog. Each game has its own route, such as /emberline/, /marble-run/ or /strike/; Courtyard lives at /owned/ and Orbit Breaker at /owned-orbit/. On this website the same games live under /play/. Load one game at a time, and click the game to give it keyboard focus, pointer lock and audio.

On Linux, native rendering needs X11/GLX and a working OpenGL driver. Windows and macOS host code exists with its own verification limits, and Courtyard and Orbit Breaker can also run headless. See Platforms and each game's README for details.

Most games share one WebGL2 runtime. Courtyard keeps its own instanced WebGL2 host, and Orbit Breaker draws a Rust framebuffer through Canvas2D. Every game host uses browser APIs directly, with no third-party libraries or CDNs.

Use Ferravex in your own project

A generated project already depends on Ferravex. To add it to an existing Rust project that sits next to this checkout:

[dependencies]
ferravex = { path = "../ferravex/crates/ferravex" }

Then start with these entry points:

Four habits keep a Ferravex game predictable:

  1. Run gameplay on fixed ticks, never on the frame rate.
  2. Hold on to button presses until a tick actually consumes them.
  3. Trigger sounds and effects from accepted game events.
  4. Let a local menu pause local play only; online matches and replays keep their own clock.

Your first simulation is a complete headless program to read next. The quickstart adds a window, input and rendering.

Where to go next

Here to play rather than build? The browser player guide covers controls, settings, screenshots and troubleshooting for every game.