Problem Statement

Scientists have mapped every neuron and synapse in an adult fruit fly's brain: about 165,000 neurons and 10 million connections. That wiring diagram is public, but almost nobody outside a lab can explore it. It is also not a working brain. The diagram says what is connected to what, but not how strong each synapse is or when the animal should act. Existing fly simulators either run the wiring as it is, or train a controller with reinforcement learning, and they are hard for students and the public to open. As a result, the question "what does the wiring leave open, and can a search fill it in?" stays out of reach for most people, and it is hard to learn how brains and AI relate without something to play with.

Solution Overview

Fly Dungeon puts the real fruit-fly connectome into a 3D browser game. You pick a fly (fruit fly, house fly or gnat), spend stat points, and send a group of flies into a dungeon. They must find a golden key and reach the exit while avoiding spiders, slimes, a chasing bird, spike traps and a giant fly swatter, and eating honey to stay alive.

Every fly runs its own live copy of a slice of the real connectome: 6,484 neurons and 193,169 connections. A looming enemy fires the real shadow detectors and then the escape neurons, the smell of the key and exit fires the approach neurons, and taste fires the feeding neuron. The wiring is the same in every fly. The eight numbers it does not specify (synapse strength scaling, sensory gains, decision thresholds, speed) are evolved: when a fly dies, the next one hatches from the best brains so far, slightly mutated, so each fly is smarter than the last. A learning curve shows it happening.

It works as proof of concept too. After about 2,000 simulated flies, evolved brains got roughly twice as far through dungeons they had never seen as random brains (mean progress to the exit 0.50 vs 0.28 at level 3, 0.51 vs 0.24 at level 5, 0.49 vs 0.20 at level 7). A proof screen lets anyone check that the brain really comes from the published connectome. No account, server or API key is needed.

Key Features

  • 3D main menu with a fly that follows your mouse, and a fly chooser with a turntable. The big 3D fly changes when you pick a type or spend stat points (bigger eyes, longer legs, faster wings).
  • Multiple flies at once, each with its own connectome brain. Select any fly (Q or a click) to see its real firing neurons, its brain activity and its evolved genes live.
  • Evolution as the game loop: dying flies are replaced by mutated copies of the best brains, with a learning curve and a hatch counter. Brains carry over to harder dungeons.
  • Take control of a fly (P). Its real brain still dashes away from enemies and eats honey for you.
  • Brain switches: cut the shadow detectors (LC4, LPLC2) or the taste relay (GNG117) in every fly and watch what the wiring really does.
  • Minimap, full map (M), pause menu (Esc), free camera (hold right mouse + WASD).
  • Proof screen: source repository and commit, SHA-256 hashes of the source files, a 3D cloud of the real neurons at their real positions, real neuron names and FlyEM ids, and real synapse counts recomputed from the raw data. python tools/verify_source.py rebuilds every shipped synapse weight and prints ALL CHECKS PASSED only on an exact match.
  • Extra modes: a 3D colony, a solo 3D Fly Pilot, and a puzzle lab where you repair a damaged fly brain, with hints from a small neural network trained from scratch.
  • Honest by design: the brain is a rate model on a pathway slice (it agrees with the full connectome at r = 0.994). The body and the path through the dungeon are supplied by the game, like in other embodied fly simulators. The brain decides whether to flee, push on or eat.

Technologies Used

  • JavaScript (ES modules) and three.js for the 3D menu, dungeon and models (toon shading with outlines), plus HTML5 Canvas for the minimap and charts. No frameworks and no build step.
  • Python (NumPy, SciPy) for tracing pathways through the full connectome, picking the 6,484-neuron slice, and training the hint network from scratch.
  • Node.js for headless evolution runs, benchmarks and tests.
  • Data: the FlyEM male-CNS connectome v1.0 (CC-BY 4.0), packaged by the open Lulzx/fly-brain project.
  • Machine learning: a neuron-level rate network on real signed connectivity, neuroevolution (tournament selection, Gaussian mutation, an archive of the best brains), and a small MLP trained in NumPy.
  • Art and fonts: Block Land by VEXED (CC0) for brick, key and honey, Chewy and Fredoka fonts (open licences). Flies and enemies are 3D models built in code.
  • Deployed as a static site (Netlify). No API is used.

Target Users

  • Players who like dungeon and survival games and enjoy watching a swarm of AI flies learn.
  • Students and curious people who want to see a real brain wiring diagram and the idea of AI learning, without a neuroscience background.
  • Computational-neuroscience and AI-for-science groups looking for a small, inspectable sandbox for what a connectome leaves open.
Share this project:

Updates

Submission history