§ · FERRIS

Play

MIT Bevy WebAssembly

Ferris

A Pac-Man clone written in Rust, compiled to WebAssembly, and played in this tab.

The same game as the desktop build, running through the same engine. What the browser adds is a canvas and a download; nothing is installed, and nothing is kept when the tab closes.

Engine
Bevy
Written in
Rust
Download
32 MB

Ferris · Bevy · WebAssembly

32 MB download, on this click and not before it

Controls: W A S D keys only · Keyboard: not yet

Needs a keyboard

Ferris is driven with W A S D and there is no touch control to fall back on, so the game is not offered on a device without a keyboard rather than offered and unplayable. Everything else on this page is worth reading either way, and the desktop build is linked at the bottom.

§ 01

Controls

Four keys, and a maze that refills

Click the game to hand it the keyboard — the border lights and the line under the stage says so — then steer with W A S D. Click anywhere outside it and the keys go back to the page.

Eat every pellet, keep away from the four things chasing you, and the maze refills one level harder. Getting to level four is a real afternoon.

§ 02

Delivery

Nothing downloads until you press Play

A Bevy build is a large module, and the first version of this page started fetching it the moment the page opened — which spent a visitor's data on a game they had not asked to play yet. So the button is the trigger, the size is printed next to it, and the readout counts real bytes while they arrive.

What wasm-bindgen emits is about 55 MB, and nearly half of that is a name section of Rust symbols that no browser reads. scripts/ferris-pack.mjs drops it, checks that what is left still validates, and writes brotli and gzip copies beside the result. The server hands over whichever one your browser said it could read — about four megabytes — and the file is named after its own hash, so a second visit fetches none of it again.

This is also the only page on the site that sends its own Content-Security-Policy. Compiling WebAssembly needs 'wasm-unsafe-eval', which permits exactly that and no other route from a string to running code; every other directive is the one the rest of the site sends.

§ 03

Source

MIT licensed · Source on GitHub

It runs on the desktop too, and considerably better: a native build has none of the module to download and none of the browser between the game and the machine. The repository builds both from the same source.