{{ Project | Genesaver |
curator = Sam Stafford |
\
path = //guest/sam_stafford/genesaver/ |
\
download = //guest/sam_stafford/genesaver/bin.ntx86/ |
\
language = C/C++ |
\
license = GPL }}
Genesaver is a small virtual ecosystem in the form of a screensaver. The "creatures" are steered around the screen by simple neural nets. Successful creatures produce offspring that inherit modified versions of their parent's behavior, so that increasingly intelligent behavior evolves over time.
Save , right-click, and Install. On older versions of Windows, save directly in your C:\Windows\System32 folder.
The "Configure" option will open Notepad with the Genesaver.cfg configuration file. Edit options as desired, save, and exit. The options you are most likely to want to modify are:
Red preys on green. Green preys on blue. Blue preys on red. The grey dots are plants, which spawn at a constant rate.
When a creature collides with something it can eat, it takes a "bite" out of it, reducing the prey's energy by some amount and increasing its own energy by a fraction of that amount. Individual creatures may be more adapted to eating either plants or other creatures; this is visible by the color of the creature's tail, with black tails indicating herbivores (able to take big bites out of plants) and white tails indicating carnivores (able to take big bites out of creatures). This is on a sliding scale, so some creatures may be omnivores (gray tails) and be able to take medium bites out of either.
Creatures continually burn energy, and they burn it more quickly as they move. When a creature runs out of energy, it dies and vanishes from the world. If a creature reaches 200% of its starting energy, it reproduces asexually, putting half of its energy into a new creature with a modified version of its own genome. If two creatures of the same color are at 150% of their starting energy and they collide, they reproduce sexually, producing an offspring with a mixture of genes from both parents; when this happens their tails flash yellow.
When carnivores of a particular color are overpopulated relative to their prey population, all creatures of that color will begin damaging each other as they compete for food and try to restore equilibrium; when this happens their tails flash purple.
Each creature's behavior is guided by a simple neural net. Most of the input neurons provide information about nearby creatures/objects of different colors; others provide information about the creature's own energy level and whether it's currently overpopulated.
The input values are fed to two levels of intermediate neurons through a series of weighted connections before reaching the output neurons, which control the creature's movement.
The "chase" camera mode (press C to cycle camera modes when the screensaver is running) shows a view of a single creature that includes its neural net:
![](Genesaver braincam.jpg "Genesaver braincam.jpg")
In the above screenshot of a green carnivore chasing blue prey, input neuron A has a positive (blue) value because the creature's left eye sees something blue. This signal feeds through intermediate neurons C and D and results in a positive value for output neuron F, which makes the creature turn left.
Input neuron B's value reflects the creature's current energy, and is connected to output neuron E, which controls forward motion; hence this creature will move forward in search of more prey while its energy is high, and might slow or stop in order to conserve energy when it's low.
Creature behavior is not in any way "hard-coded" into Genesaver; the first time you run the screensaver, every creature's synapses are randomized, but they will evolve over time.
Each creature has its own unique genotype, which determine its:
Synaptic connections determine a creature's responses to its environment. An individual creature's neural net will not change over its lifetime; hence individual creatures do not learn.
When a creature reproduces, the offspring receives a copy of its genotype, with a small percentage of the genes modified randomly. Since creature behavior is genetic, a "family" of creatures will "learn" over multiple generations as certain genes connect neurons to produce behaviors that lead to reproductive success.
When Genesaver exits, it will save all of the current creatures to a file called Genes.txt so that they can be restored the next time the screensaver starts.
I wrote Genesaver as a hobby project while I was a student at Cal; it's the oldest app I've written that I continue to use today. I had just taken an introductory graphics course, which inspired me to use OpenGL to make a simple screensaver, but I had not yet done any user interface work, everything I knew about neural nets and genetic algorithms had come from my own casual reading, and C++ still seemed like a strange foreign language. The inelegance of both the code and the interface is a testament to the author's inexperience.
It's my favorite screensaver ever.
{{ License | GPL | 2008 | Sam Stafford }}
{{ RecentChanges | //guest/sam_stafford/genesaver/src/ }}
<Category:Screensavers>
{{ Project | Genesaver | ` curator = Sam Stafford |`\ ` path = //guest/sam_stafford/genesaver/ |`\ ` download = //guest/sam_stafford/genesaver/bin.ntx86/ |`\ ` language = C/C++ |`\ ` license = GPL }}` ### About This Project Genesaver is a small virtual ecosystem in the form of a screensaver. The "creatures" are steered around the screen by simple neural nets. Successful creatures produce offspring that inherit modified versions of their parent's behavior, so that increasingly intelligent behavior evolves over time. #### Installation and Configuration (Windows) Save , right-click, and Install. On older versions of Windows, save directly in your C:\\Windows\\System32 folder. The "Configure" option will open Notepad with the **Genesaver.cfg** configuration file. Edit options as desired, save, and exit. The options you are most likely to want to modify are: - **plantgrow** - higher values will support a higher creature population, which will also increase CPU load - **crtrscale** - smaller values make creatures smaller, effectively making the world larger - **zoomprcnt** - you may want to increase this if you decrease the creature size - **blurtrail** - this is pretty, but may not work well on all OpenGL implementations #### The Genesaver Ecosystem Red preys on green. Green preys on blue. Blue preys on red. The grey dots are plants, which spawn at a constant rate. ![](Genesaver.jpg "Genesaver.jpg") When a creature collides with something it can eat, it takes a "bite" out of it, reducing the prey's energy by some amount and increasing its own energy by a fraction of that amount. Individual creatures may be more adapted to eating either plants or other creatures; this is visible by the color of the creature's tail, with black tails indicating herbivores (able to take big bites out of plants) and white tails indicating carnivores (able to take big bites out of creatures). This is on a sliding scale, so some creatures may be omnivores (gray tails) and be able to take medium bites out of either. Creatures continually burn energy, and they burn it more quickly as they move. When a creature runs out of energy, it dies and vanishes from the world. If a creature reaches 200% of its starting energy, it reproduces asexually, putting half of its energy into a new creature with a modified version of its own genome. If two creatures of the same color are at 150% of their starting energy and they collide, they reproduce sexually, producing an offspring with a mixture of genes from both parents; when this happens their tails flash yellow. When carnivores of a particular color are overpopulated relative to their prey population, all creatures of that color will begin damaging each other as they compete for food and try to restore equilibrium; when this happens their tails flash purple. #### Creature Behavior Each creature's behavior is guided by a simple neural net. Most of the input neurons provide information about nearby creatures/objects of different colors; others provide information about the creature's own energy level and whether it's currently overpopulated. The input values are fed to two levels of intermediate neurons through a series of weighted connections before reaching the output neurons, which control the creature's movement. The "chase" camera mode (press C to cycle camera modes when the screensaver is running) shows a view of a single creature that includes its neural net: ![](Genesaver braincam.jpg "Genesaver braincam.jpg") In the above screenshot of a green carnivore chasing blue prey, input neuron A has a positive (blue) value because the creature's left eye sees something blue. This signal feeds through intermediate neurons C and D and results in a positive value for output neuron F, which makes the creature turn left. Input neuron B's value reflects the creature's current energy, and is connected to output neuron E, which controls forward motion; hence this creature will move forward in search of more prey while its energy is high, and might slow or stop in order to conserve energy when it's low. Creature behavior is not in any way "hard-coded" into Genesaver; the first time you run the screensaver, every creature's synapses are randomized, but they will evolve over time. #### Creature Genetics Each creature has its own unique genotype, which determine its: - Color - Diet - Synapses Synaptic connections determine a creature's responses to its environment. An individual creature's neural net will not change over its lifetime; hence individual creatures do not learn. When a creature reproduces, the offspring receives a copy of its genotype, with a small percentage of the genes modified randomly. Since creature behavior is genetic, a "family" of creatures will "learn" over multiple generations as certain genes connect neurons to produce behaviors that lead to reproductive success. When Genesaver exits, it will save all of the current creatures to a file called **Genes.txt** so that they can be restored the next time the screensaver starts. #### History I wrote Genesaver as a hobby project while I was a student at Cal; it's the oldest app I've written that I continue to use today. I had just taken an introductory graphics course, which inspired me to use OpenGL to make a simple screensaver, but I had not yet done any user interface work, everything I knew about neural nets and genetic algorithms had come from my own casual reading, and C++ still seemed like a strange foreign language. The inelegance of both the code and the interface is a testament to the author's inexperience. It's my favorite screensaver ever. {{ License | GPL | 2008 | Sam Stafford }} {{ RecentChanges | //guest/sam\_stafford/genesaver/src/ }} <Category:Screensavers>
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 13792 | Lester Cheung | Archive of wiki.workshop.perforce.com in raw (mediawiki) and markdown formats. |