samiul@portfolio:~/projects/flyrarria$ cat README.md

04 FlyRarria

[mod] [c#] [updated 2026-09] [★ featured]

A Terraria pet whose behaviour comes from a simulated fruit-fly nervous system: all 176,422 neurons of the male CNS connectome, stepping in real time.

samiul@portfolio:~/projects/flyrarria$ cat problem.txt

Game pets run on scripted state machines. The question was whether a real connectome could drive one: map the game world onto the fly's senses and read behaviour back out of its motor neurons, with no faked activity.

samiul@portfolio:~/projects/flyrarria$ cat build.log

A tModLoader mod in C#. Each tick the world is sampled into a sensory frame (looming threats, sugar, touch, wind, light), encoded onto the fly's sensory neurons, stepped through a leaky integrate-and-fire model of the full male CNS (25.8M connections, Shiu et al. 2024 parameters), and decoded from descending and motor neurons into steering: escape, feed, groom, follow. The brain loads in about 0.7 s and steps on up to 12 threads at ~7 ms per 50 ms tick. The same C# brain is checked headlessly by a Python bench (5/5), and a neuroscope overlay draws the real brain silhouette with every spiking neuron lit.

Built with Andrew Priestley, who wrote the brain engine, connectome pipeline and neuroscope. My side: the scaffold and tModLoader build pipeline, then directional escape and food seeking, world interactions, and the bond/XP loop.

samiul@portfolio:~/projects/flyrarria$ cat highlights.txt

  • Whole male fly CNS: 176,422 neurons, 25.8M connections, in game
  • ~7 ms per 50 ms brain tick on 12 threads
  • Loom → escape, sugar → feed, touch → groom, straight from the circuit
  • Hunger scales sugar-neuron gain, so the brain decides when to eat
  • Neuroscope overlay: the real brain shape, spikes lit live
  • Headless Python bench validates behaviours against the C# engine

samiul@portfolio:~/projects/flyrarria$ cat stack.toml

# flyrarria

lang = "c# (.net 8) + python tools"

host = "tmodloader, terraria 1.4.5"

brain = "lif, male-cns v1.0 connectome"

size = "176,422 neurons / 25.8m connections"

speed = "~7 ms per 50 ms tick, 12 threads"

check = "tools/bench.py, 5/5 pass"

stack = ["C#", "tModLoader", ".NET 8", "Python"]

samiul@portfolio:~/projects/flyrarria$ git remote -v

interactive shell: try help, ls, open 04, phosphor amber

SH‑TERM  ▚  MODEL 2026