The brain
The ghost flies with a part of a real fruit fly brain. The data comes from FlyWire, a map of every neuron and synapse in the brain of one adult female Drosophila melanogaster. Release v783 has 139,255 neurons and 54,492,922 synapses.
The game uses 2,198 of those neurons and the 31,272 connections between them:
- 857 visual neurons that respond to looming objects, small targets and approaching edges (cell types LPLC2, LC4, LPLC1, LC6, LC11 and LC16).
- 16 VS cells that sense vertical self-motion.
- 768 neurons that receive from the visual neurons and send to descending neurons.
- 557 descending neurons, which carry commands from the brain to the wings and legs.
What is real and what is not
These parts come directly from FlyWire and do not change:
- Which neuron connects to which.
- The number of synapses in each connection. The game keeps a connection only if it has five synapses or more.
- The sign of each connection. The game uses the predicted neurotransmitter of the sending neuron: acetylcholine excites, GABA and glutamate inhibit. Connections from dopamine, serotonin and octopamine neurons are not used.
These parts are a model, not biology:
- Each neuron is a simple rate unit, not a spiking cell.
- The inputs to each neuron are divided by their total, so that neurons with many inputs do not saturate. The relative strength of the inputs to one neuron stays the same.
- The eye is simplified. Each visual neuron watches one horizontal band of the screen. The band comes from the position of the neuron in the brain, which is only an approximation of where it looks. Neurons on the right side watch the pipes. Neurons on the left side watch the ground and the sky.
- The fly learns only a small set of numbers: input gains, biases, one time constant, and one weight for each descending neuron. These weights turn the activity of the descending neurons into a flap.
How the ghost learns
A coach flies with the fly during practice. The coach sees only what the fly sees, and it says when a flap is due. The fly records the activity of its 557 descending neurons and fits new weights to match the coach.
When you open the game, the ghost starts as a hatchling with very little practice. It practises in the background while the page is open, about once every three seconds. After every six practice flights, it tries a new set of weights. The ghost keeps the new weights only if they beat the old ones by at least one pipe on the same fresh courses. Your browser saves its progress.
A fully trained ghost flies a median of 303 pipes on 300-pipe courses. A small amount of random noise in each match lets you win sometimes.
Credits and licence
Brain data: the FlyWire Consortium, release v783.
- Dorkenwald, S. et al. Neuronal wiring diagram of an adult brain. Nature (2024).
- Schlegel, P. et al. Whole-brain annotation and multi-connectome cell typing of Drosophila. Nature (2024).
- Eckstein, N. et al. Neurotransmitter classification from electron microscopy images at synaptic sites in Drosophila melanogaster. Cell (2024).
FlyWire publishes its data under the CC BY-NC 4.0 licence. This game is free and non-commercial. The game changes the data as this page describes: it selects a subcircuit, removes weak and modulatory connections, and scales the inputs to each neuron.
Music: Paul Nevin.