Inspiration

In a god game, you're supposed to be the god. But you're really a mouse cursor. We wanted the god to be you: your calm, your focus, your stress, your face. Mind over Chicken is a god game you play with your brain. You wear a Muse EEG headset and sit in front of a webcam, and a tiny civilisation lives or dies by your state of mind.

What it does

You guide one people from the Stone Age to the stars, on a seamless wrap-around world:

  • Stone Age: blink to throw lightning. You light the fire, hunt giant chickens and start forest fires. Hold your focus to keep the flame alive.
  • Industry: a market of 38 trader agents swings with your stress. Stay calm and it steadies; panic and it crashes.
  • Space Age: build the rocket. Then zoom out to a galaxy whose worlds were born from your thoughts. Raid, bombard or invade them.

Your first seconds of play are a calibration window: they seed your civilisation's personality. Rival peoples share your planet, each run by its own simulation with AI war councils. They trade, raid and go to war, and your calm literally keeps the peace. You pick the world size (Small to Huge) and the difficulty (Easy to Hard). No headset? An emulator lets anyone play with the keyboard.

How we built it

  • Rust compiled to WebAssembly for everything heavy:
    • a WebGL 3D renderer;
    • the civilisation simulation;
    • the galaxy and its space war;
    • torus terrain generation. A thin JavaScript shell glues it together, and a Python bridge streams the Muse over a WebSocket.
  • Brain signals. Band powers become features relative to your own resting baseline $b$, through the logistic $\sigma$:

$$ \text{calm} = \sigma\big(4.5(\ln\tfrac{\alpha}{\beta} - b_1 - 0.45)\big), \qquad \text{focus} = \sigma\big(4.5(\ln\tfrac{\beta}{\alpha+\theta} - b_2 - 0.4)\big) $$

$$ \text{stress} = \max\big(\text{agitation},\ \text{anger}_{\text{face}},\ 0.15(1-\text{calm})\big) $$

A personal softmax classifier learns your brain as you play. It's blended in only once it beats chance on held-out data.

  • Your face. MediaPipe blendshapes become joy, surprise and anger, each normalised against your resting face.
  • Calibration becomes personality:

$$ \text{friendliness} = 0.55\,\bar c + 0.35\,\bar j + 0.1(1-\bar a), \qquad \text{aggressiveness} = 0.5\,\bar s + 0.35\,\bar a + 0.15\,\bar\phi $$

  • A seamless world. Every tile maps onto a 4D Clifford torus, so the noise has no edges:

$$ P(x,y) = \tfrac{1}{2\pi}\big(W\cos\tfrac{2\pi x}{W},\ W\sin\tfrac{2\pi x}{W},\ H\cos\tfrac{2\pi y}{H},\ H\sin\tfrac{2\pi y}{H}\big) $$

  • Rivals that feel your mood. Each rival's tension toward a neighbour grows with your agitation and anger, and falls with your calm:

$$ \dot T = 0.04\big(\text{aggression} + \text{hunger} + \text{border} + \text{grudge} + M - 0.8\,\text{friendliness} - 0.25\big),\quad M = 0.7\,\text{agitation} + 0.6\,\text{anger} - 0.75\,\text{calm} $$

Their war councils are PPO policies (116 observations, 7 action heads). We trained them with self-play in Python, then compiled them into the Rust runtime.

  • Space war. Fleets fight shields, defences and garrisons with $\pm 15\%$ luck. A coalition forms against anyone holding over 42% of the galaxy's strength.

We built it as a team with a fleet of AI coding agents in parallel. GitHub issues, a live workboard and pull requests kept everyone in sync.

Built to scale

  • Rust and WebAssembly keep the heavy work fast enough that the world grows with your machine. The home world goes from Small to Huge (480×270 up to 1,280×720 tiles), with up to 12 rival peoples.
  • Rivals step at 5 Hz with smooth movement in between, at about 0.3–0.4 ms per step even on the Huge map. The 3D view only draws the trees and buildings near the camera.
  • Face and hand tracking run in background workers, one per model, so they never stall the game. The game takes a camera frame the moment the camera has one, so hands can track at up to 60 Hz and the face at 30 Hz.
  • Everything is modular: each era, the civilisation simulation, the galaxy war and the brain model are separate Rust crates behind a thin JavaScript shell. Adding a new era, a new input (another headset, eye tracking) or a new AI council means adding one module.

What's next

  • WebGPU. Move the WebGL renderer and the civilisation simulation onto WebGPU compute shaders. That would let thousands of agents, the terrain and the war councils run on the GPU, with bigger worlds and more rival civilisations at the same frame rate.
  • More minds, more players. The brain model is personal and learns as you play, so the same pipeline can take other headsets, or several players sharing one galaxy.
  • More worlds. The galaxy, its worlds and their AI councils already run from shared Rust simulations, so adding planets, eras and rival species is a matter of content, not new engine work.

Challenges we ran into

  • EEG is noisy and personal. On a Muse, "gamma" is mostly jaw tension, and blinks pollute every band. Absolute thresholds failed, so everything became relative to the player's own baseline. Blink frames are kept out of training.
  • Facial expressions aren't equal. A full smile scores 0.9, but a surprised face barely reaches 0.3. So each emotion got its own range, and surprise became a one-off event rather than a level.
  • Two simulations, one truth. The JavaScript eras and the Rust simulations drifted apart. We moved the authority to Rust step by step and mirrored the HUD.
  • Many rival peoples, one frame budget. Rivals step at 5 Hz with interpolated movement, at about 0.3–0.4 ms per step even on the Huge map.
  • Merging dozens of parallel pull requests. Compiled .wasm files can't be merged, so every integration rebuilt them from the merged sources.

What we learned

  • Brain–computer interaction works best as gentle, continuous influence, not a button. Calm that slowly keeps the peace feels magical; a "think to click" control feels broken.
  • Designing for an emulator first made the game playable and testable by everyone, headset or not.
  • Rust and WebAssembly let us run a whole civilisation simulation, a galaxy war and trained RL policies in the browser, with frame budget to spare.
Share this project:

Updates

Submission history