--- title: Fly Brain Sim emoji: 🪰 colorFrom: green colorTo: gray sdk: static pinned: false --- # Fly Brain Sim A fly in a 2D arena whose brain is a spiking simulation of the FlyWire v783 whole-brain connectome (138,639 neurons, 54.5M synapses). It runs entirely in your browser: the connectome (~37 MB) is downloaded once and simulated locally in a Web Worker. Simplified: brain only, no nerve cord (steering is a body reflex), pain is touch + heat input, synaptic gain scaled to 0.34 of the published value. Credits: FlyWire connectome and annotations (Dorkenwald et al. 2024; Schlegel et al. 2024; Matsliah et al. 2024). Neuron model and connectivity table after Shiu et al. 2024 (MIT, github.com/philshiu/Drosophila_brain_model). ## What is real, what is not - Brain: the FlyWire v783 connectome (138,639 neurons) as a spiking network. Smell, taste, touch, heat, looming, male song/contact and body-state signals go into real neurons; behavior is read from real descending neurons and the real mating-hub (pC1), vaginal-plate (DNp13) and egg-laying (oviDN) neurons. - Learning: dopamine-gated depression of the real Kenyon cell -> MBON synapses. Reward (eating) drives the PAM dopamine neurons, pain drives the PPL1 dopamine neurons. After a few pairings with a lamp she approaches (reward) or avoids (danger) it. The lamp's colour is cosmetic: in this simulation every strong input recruits nearly the same Kenyon cells, so learning generalises across cues. - Not from the brain: muscles/steering (the scan has no nerve cord), ovaries and development, and the egg-laying input (SMP550 is driven directly). - Saves: progress (including the learned memory) is stored in your browser only. ## Interface - Start page with a rotating point cloud of the real neurons (positions from the scan), then the simulation. - Spawn dock (food, lamp with colour swatches, poison, flame, zap, spider, male fly, glass, wall). - Saves menu: autosave, three named slots, export/import as a file, forget learned memory. ## Time scale and realism One fly-day = 120 s at life cycle x1 (buttons: x3, x10, x30). Processes that take minutes or longer in a real fly run on that clock; walking (about 0.7 cm/s), reflexes and neurons run in real time. | What | Real fly (25 C) | Here | | --- | --- | --- | | Starvation (fed to empty) | ~1.5-3 days | 2.2 fly-days resting, faster when walking | | Egg to adult | ~9-10 days (1 + 4 + 4) | 9 fly-days (1 + 4 + 4) | | One egg through oogenesis (stage 1-14) | ~3 days | 2.8 days unmated, 1.8 days mated | | Ovarioles | ~15-20 per ovary | 16 per ovary | | Copulation | ~20 min | 20 fly-min (floored at 2.5 s so it stays visible) | | Courtship before copulation | 1-4 min | 25-90 s (compressed) | | Sperm stored per mating | a few hundred | 400 (max 600), used ~1 per egg | | Sex-peptide post-mating refusal | about a week | 7 fly-days | | Adult lifespan | median ~40-50 days | Gompertz mortality, median ~49 fly-days | | Memory | fades over hours to days | fades with a ~1 fly-day time constant | Not modelled: flight, sleep, grooming, day/night, temperature, other females' own behaviour (newly emerged females only wander).