Nature of Code: SUPER PIXEL ISLAND
![]()
I finally got around to putting up a page about my Nature of Code final project. Here it is. (You can access the applet directly here.) Please take a look, try it out, and let me know what you think!
![]()
I finally got around to putting up a page about my Nature of Code final project. Here it is. (You can access the applet directly here.) Please take a look, try it out, and let me know what you think!
![]()
Gosper Glider Gun. Click thumbnail for a larger screenshot (1024x1228)
The Life Tower is a 3D visualization of Conway's Game of Life. The current generation is drawn on top of the tower, and each successive generation is drawn underneath.
As the tower grows, it builds organic structures that are invisible in a conventional two-dimensional representation of Conway's Game of Life. This mapping of time to a spatial dimension mirrors the usual practice for representing one-dimensional cellular automata, in which successive generations are drawn in a two-dimensional field.
Download the source code (Requires LWJGL and Mark Napier's OpenGL demo code; standalone executables forthcoming). Once you have it running, press 'H' for usage instructions.
The Life Tower is a project for Mark Napier's GLArt class.
More screenshots after the jump.
Here are some (more) screenshots from my Life Tower program. Click on any of the thumbnails below to see larger (up to 4096x3072) versions.
My take on generative poetry with L-Systems (Perl with a web front-end). Works like a graphical L-System, except the "turtle" moves back and forth over a one-dimensional array of words (supplied by a source text of your choosing). Here's some example output (using Genesis 1 from the KJV):
In the heavens morning
In the heavens morning
the heavens and were
And morning were GodAnd morning were God
And morning were God
the were the called
and God called whichthe were the called
the were the called
evening the second the
it called the wereand God called which
and God called which
it called the were
the which were the
![]()
Here's my idea: an interactive environment/game for breeding flowers using genetic algorithms. "Genetic algorithm" is liberally interpreted here: the flowers' genotype is image data (32x32 pixels), and the genotype is expressed by displaying that data to the screen. Crossovers and mutations are performed as image filtering and manipulation. The flowers exist in on a virtual "island" whose properties determine how crossovers and mutations are performed.
This applet demonstrates how the flowers look, breed, and mutate (press 0-9 to increase the likelihood of the corresponding flower to produce offspring, then press the spacebar to create the next generation of flowers). Here's a mockup of what the virtual island looks like (click and drag to move around or press 'n' to generate new terrain; there aren't any flowers there yet).
Here's the basic ruleset:
The eventual goal I have in mind is to create an Animal Crossing-esque game in which points are awarded for growing flowers with particular characteristics; players could use these points to unlock new kinds of mutations or terrain, or to purchase custom flowers (e.g., a flower with Alan Alda's face on it). Each player would have his own garden, but could trade flower "seeds" online with friends. (Maybe the terrain types are not evenly distributed between players, so you have to send your seeds to a friend in order to get crossover types normally unavailable to you! A lot of possibilities here.)
My final project will be a "proof of concept" for this game/environment. I want to implement the basic ruleset in the list above in order to see if I can make it intuitive and interesting.
![]()
Tower from above. Click for larger screenshot.
EDIT: See new supersized screenshots here.
The Life Tower is a 3D visualization of Conway's Game of Life. The current generation is drawn on top of the tower, and each successive generation is drawn underneath.
Patterns in one-dimensional cellular automata are more evident when they're drawn with successive generations in a two-dimensional field. The Life Tower adds a third dimension to a 2D cellular automaton—the Game of Life—in order to see if similarly interesting patterns emerge.
Download the source code here (requires LWJGL and Mark Napier's GLMaterial library).
Click and hold the mouse to rotate the tower and move the camera up and down. Use the 'S' key to step through generations, or hit the space bar to toggle continuous calculation. The 'R' key resets. Press 'P' to use smaller flat squares instead of cubes to draw each cell (and 'C' to switch back to cubes).
Discussion and more screenshots after the jump.
This is a screenshot of an animation I did in Processing. I threw some Aphex Twin over it and made some QuickTime files, which you can download here (10MB, 320x240) and here (60MB, 640x480, high quality).
The code is really simple. I took Shiffman's flocking example and made the "boids" leave behind particles, which behave according to their own set of (non-flocking) rules. Then I reflected the whole thing down the center of the screen and alpha blended each frame on top of the last (just to make sure I was complying with all of Processing's genre conventions). Just a bit of programming fun.
My midterm project for the Nature of Code is an experiment in algorithmic cut-up techniques. The text is reimagined as a number of massive objects—words—in one-dimensional space, subject to gravitational forces. As time passes, these objects attract one another. Some find stable orbits, others get flung helplessly into the void. The text is then reconstituted, using the position of the objects in space to determine the order of the words. Click the image above or here to try out the "rough draft" of the applet.
I've been trying to think of ways to apply the concepts from the first half of the Nature of Code to text. We tend to conceive of "force" as something that operates in two or three dimensions. As a result, the textual experiments with these techniques that first come to mind are really more about the language of layout than anything else (words in two-dimensional space).
However, I wanted to do something that dealt with syntax, not layout, and syntax is a one-dimensional affair. So the applet above uses the standard mathematics of velocity, acceleration, and gravitation, but it only applies them in one-dimension. Only the X coordinate counts; the Y and Z coordinates are always set to zero. (As a way of providing feedback about a word's mass, more massive words are drawn lower. This is just a visual convenience, and doesn't affect gravitation.)
Problems and ideas for improvement:
Credit goes to Christian Croft, whose (really awesome) assignment from last week got me thinking about all of this.
I combined this week's assignment for Audio Art and the Nature of Code. I took one of Daniel's attraction examples, modified it slightly, and hooked it up to some sound synthesis patches in Max/MSP.

Click screen shot above to see the applet. All of the sound stuff was done in Max/MSP, so the applet on its own isn't very interesting.
The idea was to make the motion audible. Processing sends the X and Y coordinates of each circle to Max/MSP. Max/MSP then uses these values to generate tones. I tried a number of different patches, each of which used an oscillator at the frequency of the Y coordinate to modulate an oscillator at the frequency of the X coordinate. Some clips from these experiments are presented below. You can download the Max/MSP patches used for clips #6-#10 here (requires MaxLink).
Motion Study #1 - Amplitude Modulation (Download)
Motion Study #2 - Frequency Modulation (Download)
More samples after the jump.
Click on the image above to check out Squeaky, the lovable virtual mouse! This was my homework for week one of The Nature of Code. "Torus mode" means that when Squeaky reaches one side of the applet, he'll reappear on the opposite side (this gives him a little more leeway when he starts to sprint).
The assignment was to "find an example of real-world 'natural' motion" and mimic it using "controlled randomness." Squeaky uses two Perlin noise values to control direction and another Perlin noise value to control speed. The speed, however, is separated into three tiers: virtually still, slow, and lightning quick. I was hoping to replicate the way that rodents will stay motionless for a while, maybe wander around a bit, and then break into a run. Sort of a nervous movement.
My real-life examples of "real-world motion" were taken from Google Video and YouTube:
I'm happy with the way Squeaky moves, and I think the animation works well when he breaks into a run. Two future improvements: first, I need more frames of animation for when Squeaky is moving slowly or standing still. Second, Squeaky needs to learn how to turn when he reaches the wall, instead of trying to run through it.