AI & computer visionPrototype
FlappyAI
A neuroevolution agent that learns to play a browser game from screen pixels.
The problem
Vision-based agents are often limited by slow screen capture and input, which makes real-time control in fast games hard.
Approach
Screen frames are captured with mss, processed with OpenCV to extract the bird and obstacle positions, and fed as a small state vector to a NEAT network. Decisions are sent back to the browser through the Chrome DevTools Protocol.
[ Browser game ]
│ mss frame capture
[ OpenCV state extraction ]
│ positions, distances, velocity
[ NEAT network ]
│ flap or glide
[ Playwright / DevTools input ]Key decisions
- Playwright over the DevTools Protocol for low-latency input instead of Selenium.
- Neuroevolution needs no labelled training data and converges quickly on a task this small.
- Frames stay in memory, so there is no disk I/O in the loop.
Highlights
- End-to-end loop from capture to action fast enough for real-time play.
- A compact experiment in applying evolutionary algorithms to real-time control.
Stack
- Python
- NEAT-Python
- OpenCV
- Playwright
- mss
- NumPy