RSS Feed
◷ 10 min read - Apr 26, 2010

Introducing EvoPaint, a Digital Evolution Simulator with Painting Capabilities

EvoPaint is a playful and interactive experience of evolutionary multi-agent simulations and cellular automata. It is easy to understand and a lot of fun to use.

When you draw a picture in EvoPaint, it won't just sit there and wait for you to finish. Painting in EvoPaint is a dynamic process. Your picture may dissolve into seemingly random patterns and evolve into something you may or may not have anticipated. Colors will change, forms will be created and destroyed as you watch and interact with the evolution. For the less imaginative, I have recorded the following one-minute video.

For this video I imported a picture and let it evolve using a mix of assimilation and movement rules.

The Basics

You have some control over how your drawing is going to evolve. In EvoPaint, each pixel not only has a color, but also a rule set and an energy value associated with it. When you select a brush you can specify those attributes in addition to the color. The energy value can be modified and if it reaches zero for some reason, the pixel will be removed from the picture. The rule set consists of a list of rules which are of the form "if <condition> [and <condition>] then <action>". During the evolution, when it is time for a particular pixel to "act", the conditions of each rule starting from the top of the list are checked for this pixel. If all conditions of a rule match, the corresponding action is performed. Only the first rule that matches is executed. If none of the conditions match, no action is performed.

Conditions and actions in EvoPaint are targeted at pixels in the Moore neighborhood of the acting pixel (i.e. the 8 pixels surrounding it) and/or the pixel itself. Conditions can check for existence of pixels, their color or energy, not only for a single neighbor but they can also check for a range of neighbors (e.g. "if at least one of my neighbors is red then..."). Actions can modify color and energy of surrounding pixels in various ways. There are actions for copying, assimilation and partner-based procreation as well as direct energy and color changes and moving around, each can either reward the pixel with energy, or cost energy to perform. For example, in the smiley video above, the active rule set is roughly "if one of my neighboring pixels has a color different from mine, then mix half of my color into that pixel (assimilate), else see if I can move to the right". Note that there is neither mixing of rules nor mutation of pixels involved here but it still looks pretty cool, doesn't it?

A picture is worth a thousand words, they say. Here are a couple of screenshots to show you what EvoPaint looks like and how rules are managed and edited.

Evolution

Pixels can evolve using any of the three actions copy, assimilation or partner-based procreation and allowing for mutation (set a mutation rate greater than 0 in the options menu). If a mutation is fit for its current environment, pixels with the mutated rule set will multiply more than others, which you can immediately notice because a color suddenly "takes over" - at least for a while. You can also decide whether or not you want only the color to evolve or also rule sets. To prevent natural selection from going for the ultimate "assimilate everything with 100% of my genes at no cost"-rule, EvoPaint will allow mutation to only pick from the actions you have already used in your picture. Also, none of the action parameters are mutable with the exception of color and target.

Check out the below video of an evolution in EvoPaint (the black square that suddenly appears is me filling a selection with the "kill" rule set to make some room).

An example evolution consisting of pixel-agents using the actions copy, kill (i.e. reduce energy by 100) and partner-based procreation. Of course you don't have to use any evolutionary aspects and can still have a lot of fun. In fact, you can recreate one of my all-time favorite games with just rules: Lemmings. If you do so, I'd love to see your rule sets.

Agent Simulation and Cellular Automaton Modes

EvoPaint has two modes of operation: agent simulation mode and cellular automaton mode, as explained below.

In agent simulation mode, each pixel of an image is a rule based agent that interacts with its neighboring pixels as described above. A time-step in EvoPaint allows each pixel to act once, given it is alive. In this mode, an action of a pixel immediately affects all future decisions, even for pixels that act after the one currently acting during the same time-step. So if in any given time-step pixel A acts before pixel B and kills it. B will not act this round but stay dead. For each time frame the order in which the pixels act is randomized. The videos of the smiley, the sand, the worm and the evolution have been recorded using this mode. Agent simulation mode is the default mode in EvoPaint.

In cellular automaton mode, a time-step similarly allows each pixel to act once, the difference being that there is no "before/after" relation between actions happening during a single time-step. Each pixel sees exactly the same environment and changes are made on the future (next time step) version of the world (called a generation in cellular automata terms). You have to make sure not to influence pixels other than the acting one, or you will get unintended side-effects (mostly patterns forming towards south-east, due to the order of processing). EvoPaint cannot currently grow cellular automata beyond the original canvas size. To use EvoPaint in cellular automaton mode, select "Cellular Automaton Mode" from the menu in the upper right corner, create a single rule set and fill the canvas with it as a background. Then paint some pixels in a color that will trigger an effect in your rule set and watch the show. Ever played Conway's Game of Life? It takes three rules to recreate it in EvoPaint. Add a few more and you will have a multi-color version. Painting cellular automata is fun because they usually end up creating fascinating, complex and symmetric patterns with little to no interaction after the initial setup. Of course if you managed to spawn a pattern called a "Spaceship" in Game of Life, you could play a game of manually defending it from (usually destructive) interactions with other patterns. Alternatively, you could just copy it to its very own universe and watch it "fly" about.

A demonstration of painting into an evolving cellular automaton (Conway's Game of Life).

Matters of Perspective

Painting in EvoPaint can reveal something about how your mind works. You can draw perceptually closed forms in EvoPaint, e.g. a square. If you paint something inside that square, it will be inside the square, right? Watch what happens in your mind when you drag the parallax painting canvas a bit (it is endless and yet contained - just like our own Universe could be). The outside will become the inside.

This video also features Conway's Game of Life in EvoPaint, only this time we paint a big square in the middle of the screen and watch what happens. You can see the gliders moving away from the center. When I move the canvas, you see them colliding near the center they escaped, challenging concepts of inside and outside, away from and towards something.

Making the pixels move to a random direction will cause your mind to associate them with with a swarm of insects, making them draw lines into random directions will give you the impression of watching them from above, making them move south they appear to be falling down. Much of the fascination with EvoPaint does not stem from the program itself but from observing your own perception while using it.

In the beginning of this video, I demonstrate how your mind associates certain behavior with the things it knows from the real world. Do these pixels moving south not look like falling sand? Towards the end of the video I went a little crazy. First, I sprinkled some fairy dust on top, then I let the pixels assimilate each other and mutate a little. Finally, I cut out a big square and converted everything to "falling sand".
Red pixels go up, white pixels come down. Suddenly, a worm appears and creeps over the parallax-canvas. Why is that? Because, in the event of a collision, red and white pixels move into different directions, creating this strange effect that looks like a worm-like entity moving towards the upper left corner of the canvas.

History of EvoPaint

The principles EvoPaint works on are to some extend inspired by Avida, a scientific petri-dish for evolving digital chemistries. Attending the Avida workshop at the ECAL'09 conference was great fun. I only wished Avida had some more user interaction. While you could interact with the organisms by injecting operations into one of your running micro-programs, it still didn't feel particularly interactive. Also, it lacked usability. I thought to myself: "it would be so cool to have some hybrid between an evolution simulator and a painting program". It was not long until I decided to scratch my itch (and, as we know, "that's how every good work of software starts").

At the Universität Klagenfurt, the final and biggest parts of receiving your bachelor's degree are the bachelor's thesis and a software project. My thesis was about integrating systems thinking, self-organization and information technology, for which I analyzed the Bittorrent protocol as an example. You can read it here (German). My software project was EvoPaint. Before I attended the ECAL'09 conference I went with a tiling, tabbed window manager for the X Window System which you would navigate using pie menus and notions of paths and workflows. However, after designing the window manager, I was short 100,000 monkeys at type writers to bring this project to life. I simply could not be bothered to actually code it (I still believe the concepts are worth exploring though). Fortunately, my supervisor Günther Fliedl is a really nice guy so I could easily drop the first project in favor of a new one.

For this new project I quickly found two fellow students to join in. The first being Augustin Malle, who designed the EvoPaint logo, created the required Software Requirements Specification document, and designed an HTML-based user guide. The second was Daniel Hölbling, who designed and implemented the command pattern used by the EvoPaint tools as well as some of the tools themselves, the most notable one being the selection tool in all its glory. He was of good general help due to his profound knowledge of software engineering best practices. Both of them did some minor work on other pars of the program, but in general you can blame me for the rest, such as the engine, GUI and overall design.

Download and Development

EvoPaint is free software (GPLv3 or later). It contains roughly 17,000 lines of code (not counting blank lines or comments).