Project 01PlayPython · panda3d · PyTorch (MPS)
Six small flies, each running a sub-circuit of the MaleCNS connectome as a spiking network. One big fly you drive with the arrow keys. A timer, four fruit patches, and a single rule: get them to eat. Their escape and feeding are the circuit's own behaviour, measured in calibration, not scripted.
3D chase camera. Left: every neuron group of the selected fly with its firing rate. Right: one LED row per fly, and a 200 ms spike raster of the selected fly.
This is the same circuit the small flies run on, ported from the game's brain.py and decoder.py to JavaScript and stepped on one thread of your browser. Stimulate a group and watch what reaches the descending neurons; silence one and watch a behaviour disappear. The little fly on the right moves according to the decoded descending-neuron output, exactly as the game decodes it.
Things to try
Shepherd mode: get the six flies to eat all four fruit patches (20 units of food) before the three-minute timer runs out. You have two tools, both of which go through the flies' real circuits.
Within about two units of food, odour shuts down walking and drives MN9, so the fly stops on the patch and eats. That stop-when-you-smell-food behaviour is the circuit's own.

--renderer pygame). LC4 and LPLC2 stimulated: DNp01 at 210 Hz, the fly jumps.
| Stimulus (calibration) | DNp01 L / R | DNp09 | MDN | MN9 | active cells |
|---|---|---|---|---|---|
| rest | 0 / 0 | 0 | 0 | 0 | 0.00% |
| loom (both sides) | 325 / 310 Hz | 0 | 0 | 0 | 0.83% |
| LC4 right only | 175 / 310 Hz | 0 | 0 | 0 | 0.30% |
| stimulate DNp09 | 0 / 0 | 97.5 Hz | 0 | 0 | 0.03% |
| stimulate MDN | 0 / 0 | 0 | 106 Hz | 0 | 0.03% |
| food odour (ORN_DM1) | 0 / 0 | 0 | 0 | 92.5 Hz | 1.85% |
| taste (LB3c) | 0 / 0 | 0 | 0 | 32.5 Hz | 0.14% |
From processed/calibration.json. Rates are mean per-neuron firing over a 50 ms window; "active" is the fraction of the 10,203 cells spiking per step.
Odour does not steer the flies toward food through this circuit (it drives MN9 and suppresses walking instead), which is why the player has to bring them there. The brains run at 0.3× biological speed relative to the wall clock in the game (10 ms of brain per 33 ms frame); the browser port above runs at 1× by default. There is no plasticity. Synapse counts are used as weights with a predicted transmitter sign; that is a structural proxy, not measured physiology. "Wander" is the one scripted behaviour: after two seconds of brain silence a fly drifts slowly so it does not look dead.
Needs the MaleCNS v1.0 flat files (about 1.1 GB, from Janelia) in data/flat-connectome/, Python 3.12 and a GPU-capable torch (MPS or CUDA; CPU works but slower).
cd projects/flyworld-game
python -m venv .venv && .venv/bin/pip install torch numpy pyarrow panda3d==1.10.16 pygame-ce pytest
.venv/bin/python scripts/extract_circuits.py --verify # builds processed/circuit_npc.npz (shipped)
.venv/bin/python scripts/calibrate.py # writes processed/calibration.json (shipped)
.venv/bin/python -m flyworld.game # 3D chase camera
.venv/bin/python -m flyworld.game --renderer pygame # top-down view
.venv/bin/python -m flyworld.game --headless --script "focus 2; isolate; stim DNp09; run 150; assert rate DNp09 >= 50; report"
The extracted circuit, calibration and group tables are included in the repository, so the game runs without the raw download; only re-extraction needs it. The verification ledger is in GATES.md: eight gates from environment to scripted behaviour, each with its check command and recorded evidence.