The initial version of my virtual ant farm is complete! You can see it on twitch here. The basic idea is that the ants are controlled using genetic algorithms and each colony is trying to outlast the other. I started wanting to do this project when I was working on my fishtank project, and I’m happy with it so far.
I’ll explain how the game works currently, but this is a work in progress, so this may be out of date in a couple weeks. The green spaces are food, and each ant is trying to go out and fetch food and bring it back to base. If they don’t get food fast enough, then they’ll die of hunger. The maximum hunger that each ant has is genetic and the game starts with each ant at 100 maximum hunger. When a new ant is born, maybe it will get lucky and have more like 120 max hunger. If it gets unlucky and is born with only 80 or so max hunger, then it will probably die off and not get to carry on its genes to an offspring. In this way, the ants will generally trend to being more fit. Each ant also has a health and max health system that works pretty much the same as hunger.
I’ve got a lot of things that I want to do on this project, but I’m probably going to move on to something else before I get all of this done. This has been a fun project, but I’d rather continue on to the next project than spend months trying to get this just right. My to do list right now:
- Make more things genetic. I want things like movement and behavior to be genetic instead of just the same for all ants.
- Twitch integration. I want people watching the stream to be able to name an ant by typing in chat. This is apparently not that hard, I just need to hook up a bot into an IRC channel.
- Graphical overhaul. This is currently on the second iteration of graphics, but it could still use some work.
- Larger board. I’ve got this streaming from a Raspberry Pi, so if I try to make the board 10 times bigger, the game would probably start to lag. Still, I’d like to be able to make the board larger if possible.
- More variation in each game. Maybe I could start with different amounts of food on the board or with the ants’ colonies starting in different places.
- Better names. Ideally, I want viewers to be able to name ants, but I could also make it so that ants are automatically named after the channel’s followers. For now, I needed to have a bank of names for the game to use, so I just used the periodic table of the elements. This ended up being more annoying than I had anticipated.
Thanks for reading! If you’ve got any ideas or questions, the best way to reach me is on twitter.