I’m interested in electronic artificial life systems and have been writing a few little toys in C using SDL. I have other work (including plans for an Ant-hill simulator) which I’ll get online at some point.
All the code here is licensed under the MIT license.
Bacterium Fun
Written back in 2005, these little programs just randomly “grow” bacteria based on a few simple rules (the rules are different in each program). They are written in C using the SDL graphics libraries and have been tested only on Linux (RedHat and Debian) and SDL version 1.2.5.
The first is a very simple, “age and spawn” rule set. The second more advanced, with different “species”. This and the third have “death, lifespan, spawn distance” and many more variables and/or rules” The third even randomly mutates bytes within the “petri dish” memory space in order to emulate a kind of evolution.
To get these going you’ll need to compile them by hand (there is no Makefile), try:
gcc -O3 -o alife1 1.c -lSDL
or perhaps
gcc -O3 -o alife1 1.c -lSDL -lpthread
More Bacterium Fun
At some point I did more Bacterium stuff, but never put it online. It’s now online). Somebody e-mailed me regarding the other stuff and I found the new stuff on my hard disk. I wrote a nice Makefile for this one, so just untar and make (no configure script).
There are a 4 versions:
- Initial test, one colour, ethnically true.
- 3 Colours, similar rules. Note dodgy rounding causing lines in growth
- Far more complicated one. Each cell choose another cell to attack and attacks it until it is dead, then moves in a bit slow and not great results
- Far cooler. More variables, random mutations, better inheritance
Use the #define variables at the top to tweak the resolution. Actual res is double these settings, as each pixel is 2 pixels in size so things are bigger.
The black banding is cells dying then been replaced by surrounding spores. It is easier for other cells to spore into “dead” parts of the petri dish than “live” ones so you tend to see other colours flourishing during these bands.
The mutating can causes lots of cool stuff. There are a few variables that aren’t randomly set during the big bang, so would never occur “naturally”, but mutations can cause these.
Cells are a “living” pixel. Particles are just points in the “universe” (ram)
Squiks
These little pixel creatures just kinda wander around the screen, randomly spawning and randomly dying. They will eventually seek food, mates and maybe even evolve into sales consultants, or even intelligent lifeforms; but for now they are just cute to watch (a little like sales consultants actually).
You’ll need to compile them by hand, try:
gcc -O3 -o squiks squik-0.1.c -lSDL
GetALife
GetALife is my most recent Alife project. Currently its nothing more than a rewritten Squiks system, but using SDL Surfaces instead of single pixels. I have plans for it to become a collection of quite advanced (but still fun) artificial life featuring food sources, sexual reproduction and mutating code.
UPDATE: I now have a tile based environment with some virtual snails crawling across it. Once the code is a bit tidier I’ll get it online. For now, here is a screenshot.
Get A Life 2016
In 2016 I knocked up an in-browser a-life experiment using pixi.js and Matter.js. It’s available here on github and should run on any modern browser.