See what's going on with flipcode!




 


Submitted by , posted on 22 March 2002



Image Description, by


I wrote this program quite recently. I was procrastinating while writing my resume (for GDC 2002), and was reading an article by Karl Sims, when Ash leaned over my shoulder and told me that I should do somthing like that. I denied that I could do it, but after a bit of convincing on his part I decided to give it a try. Suprisingly enough, I succeded. Its not quite as cool as what Karl Sims did, but its getting there.

Editor's Note: You can download this IOTD's demo here: iotd-03-22-2002_colorspace.zip (136k)

When you start it up you will see six images (each of which is proceduraly generated). Click on one and that is used as the 'parent' for the new generation and will appear in the top left corner. Each of its 'children' (the other images now displayed) will be some random mutation off of the 'parent'.

The picture included is what I got after about 50 generations of selecting for complexity and asthetics. I'm not including source code because I wrote this thing overnight, and the code is fugly. But I'll try to quickly explain the process that I'm using here.

Each picture is procedurally generated. For any x and y passed in it returns back a color. The color is generated from 3 floats (rounded off and confined to between 0 and 255), each of which is generated seperatly (this is why the colors tend to be fairly primary in nature, I'm going to change this in the next version I do). The generation process is done by a serries of nodes. Each node has pointers to a fixed number of other nodes (depending on the type of node it is). It gets floats from these 'child' nodes and generates a new float based on that to its parent node. I've been carefull with my deleting and copying of nodes, such that there are no memory leaks or multiple pointers to the same node. The most important node types are the end nodes (ones that have no 'child' nodes, including ones that return the x or y coordinate passed into them) and root nodes which are at the top of the set of nodes, and just return the number their child gives them (they're important because they never mutate).

The mutation happens as follows. First, there is a chance that a root node (and thus all of its children) will be cloned and stuck in one of the other color chanels. Then the mutator works its way down one of the node paths, stoping at random location, and replacing the node it finds with a new node. The new child nodes may be clones of the previous nodes children, or may just be new end nodes. Repeat this process several times.

If you have any questions or comments feel free to e-mail me at kalev@soma-studios.com. Also, please vist my demopage at soma-studios.com/kalev_demos.html



[prev]
Image of the Day Gallery
www.flipcode.com

[next]


 


Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
Please read our Terms, Conditions, and Privacy information.