How ianwes92/fly-brain-plays-pokemon works
Fly Brain Plays Pokémon is a Raspberry Pi–hosted FlyWire brain simulation that plays FireRed live, accepts Twitch control and training, and publishes live visualization and operational/science reporting. The main path runs from the game frame through sensory input and connectome simulation to motor output, while chat can steer or teach the fly. The OBS PC presents the Pi’s feeds and monitors the stream. Several subsystem links reflect README descriptions or SOURCE INDEX references; unsampled implementation details are not inferred.
Main entry points: playview.py Play window · twitch.py Twitch control · engine.py Neuron engine · relay.py HTTP relay
Components 27
Brain simulation
- FlyWire connectome
pi/flybrain/connectome.py - Neuron engine
pi/flybrain/engine.py - Motor effectors
pi/flybrain/effectors.py - Learning and reward
pi/flybrain/learning.py - Mood state
pi/flybrain/mood.py - Scent sensing
pi/flybrain/nose.py - Live brain visualization
pi/flybrain/viz.py
Game and interaction
- FireRed emulator
pi/flybrain/game.py - Sensory mapping
pi/flybrain/game.py - Play window
pi/flybrain/playview.py
Live services
- Twitch control
pi/flybrain/twitch.py - HTTP relay
pi/flybrain/relay.py - Pi live panel
pi/flybrain/panel.py - Run lifecycle
pi/play/run_clock.py - Discord updates
pi/play/discord_poster.py - YouTube promotion
pi/play/youtube_promo.py
Streaming PC
- Run reports
obs-pc/run_report.py - OBS control panel
obs-pc/flypanel.py - OBS connection
obs-pc/obsws.py
Science
- Behavior experiments
pi/data/experiments - Independent recomputes
science
Other components
- Viewers
- Twitch chat
- Twitch service
- Discord service
- YouTube service
- OBS
Connections 30
- FireRed emulator → Sensory mapping: provides frames
pi/flybrain/game.py - Sensory mapping → Neuron engine: feeds inputs
pi/flybrain/game.py - FlyWire connectome → Neuron engine: wires neurons
pi/flybrain/engine.py - Neuron engine → Motor effectors: drives neurons
- Motor effectors → FireRed emulator: presses buttons
- Twitch chat → Twitch control: sends commands
- Twitch control → FireRed emulator: steers game
pi/flybrain/game.py - Twitch control → Learning and reward: teaches fly
- Play window → FireRed emulator: renders game
pi/flybrain/playview.py - Play window → Live brain visualization: renders activity
pi/flybrain/playview.py - Neuron engine → Live brain visualization: supplies spikes
pi/flybrain/viz.py - Play window → Mood state: reads state
pi/flybrain/playview.py - Play window → Scent sensing: reads state
pi/flybrain/playview.py - Play window → Learning and reward: reads lessons
pi/flybrain/playview.py - HTTP relay → Play window: serves live feeds
- HTTP relay → Pi live panel: serves panel
pi/flybrain/relay.py - Pi live panel → Twitch control: uses channel data
pi/flybrain/panel.py - Run lifecycle → Play window: defines run window
pi/flybrain/playview.py - Discord updates → Discord service: posts updates
pi/play/discord_poster.py - YouTube promotion → YouTube service: promotes stream
pi/play/youtube_promo.py - Behavior experiments → Independent recomputes: results checked by
- Viewers → Twitch control: watches stream
- Viewers → Twitch chat: steers and trains
- OBS control panel → HTTP relay: checks health
obs-pc/flypanel.py - OBS control panel → OBS connection: controls OBS
obs-pc/flypanel.py - OBS control panel → Run reports: uses run data
obs-pc/run_report.py - OBS → HTTP relay: composes Pi feeds
- OBS → Live brain visualization: shows brain layer
- OBS connection → OBS: sends websocket calls
obs-pc/obsws.py - Twitch control → Twitch service: uses API