r/raspberry_pi • u/gmnt_808 • 2h ago
Show-and-Tell My Pi 5 has been running an evolution simulation 24/7 for 11 days and streaming it live. One species took over because of my bug lol
So I had a Pi 5 (8gb) sitting in a drawer and I wanted to see if it could run a full evolution sim AND stream it to twitch at the same time, all day, without dying. Turns out yes.
What it does
3 species (hunters, fast explorers, plant eaters) living on a map with lakes, forest, desert.
every creature has ~24 genes (speed, size, fur, fat, swimming, immune type etc). babies get the genes from the parents with small random mutations
seasons, droughts, floods, diseases that spread by contact, new species that branch off
nobody controls them. rounds are 5 min, the survivors start the next round, so nothing ever resets
The Pi part:
- python + pygame, renders 1280x720 at 30fps, pipes the frames to ffmpeg -> twitch
- around 35% cpu, 55-59°C with the official active cooler
- ethernet, falls back to my phone hotspot if the network dies
- systemd service with autostart. we had 2 power cuts this week and it just came back on its own both times (I really need a small UPS tho, sd card is scaring me)
- 3000+ rounds so far, saves are only ~20mb
Funniest thing so far: the weakest species (the green plant eaters, they won 3% of rounds at the start) evolved to swim, hid in the lakes and then won 94% of the rounds. I thought evolution found the perfect animal. Nope, it was a bug in my code, a rule that kept pulling them back to their "perfect" ancestor. Fixed it and now it's a real fight again.
It's live right now if you want to look: twitch.tv/edenevolutionwars (you can type S, N or R in chat and a creature with your name joins that species, it's free, no money stuff).
Happy to answer questions about the setup, the streaming part was the hardest to get stable on the Pi.