Ants was created for a college course in cooperation with another classmate, Tony Hoang. It ended up being interesting enough that we decided to license it under something accessible and upload it to bitBucket. I thought it might be worthwhile to give a quick rundown of how it works.
When ants are born, they’re at their most aggressive stage in life. Young ants attempt to grow by eating corpses and anything smaller than them. When they encounter creatures that are much larger than them, they kill them by repeatedly stinging and poisoning them. Ants that die from poison turn into corpses, which can be eaten to, again, accelerate growth.
Adult ants stop trying to grow and start trying to mate – basically by running randomly into another adult. Ants are genderless, so when they mate, both parties become pregnant. How many children an ant can have is linked to what it’s size is, and ants can get pregnant multiple times.
Adult ants that are poisoned have their life constantly drained, but they can still get pregnant. However, this causes them to have stillborn children. In the short term, this is great news for other young ants, because those children can still be eaten to accelerate their growth into adults.
As mentioned before, dead ants leave corpses. If ants have been poisoned too many times, they’ll leave corpses that are similarly poisonous when eaten. All of this serves as a sort of population control. If there are too many ants on the screen, it becomes difficult for any of the parents to give birth, and the children become poisoned when they eat their children.
There are a couple of controls available for watching the simulation: the viewer can make new swarms, poison everything on screen, and also get more detailed visuals as to what’s happening in the simulation. There’s a sort of debug mode where you can view the poorly coded quad-tree sorting collisions, and select individual ants to see who they’re checking for collisions, and who they last collided with.
Maybe you think the entire thing is stupid, in which case you’ll probably want to disregard this, but for me, the ants project serves as a reminder that a whole can be greater than the sum of its parts. Nothing that’s happening in ants is all that impressive – it’s a pretty simplistic simulation. But I like that thematically, everything works together towards the overall theme of doing horrible things to horrible creatures. Earlier during the school year, my apartment got infested by winged ants, and watching this invokes similar feelings to how I felt watching them on my bathroom floor. Coding this was kind of cathartic.
I wanted the ants to work off of a grossly inefficient design – killing their parents, eating each other, having stillborn children, yet still be able to moderately thrive. In that area at least, I feel happy with how the project turned out; I’ve been throwing around ideas for other animals that could attack the ants, but honestly I’m having difficulty coming up with anything more horrible to do to them than what they already do to themselves.
Ants aren’t a priority for the studio right now, if for no other reason than that because I don’t have any idea how to monetize the simulation, but I do plan to keep the project updated. I don’t have a specified list of features I want to add, but I do want to make the ants smarter (dragging poisoned bodies around, or leaving to start new colonies), and possibly adding other colonies or species to interact with them.
If you’d like to do something with the code, it’s been released under a WTFPL license, so you can feel free to fork it for pretty much any reason. You can find it on bitBucket at http://bitbucket.org/danShumway/bugs, and I’ll try to occasionally update a version online at http://latinforimagination.com/ants