Evolution project Česká verze

History

In the early nineties, object programming was still in its beginnings – there was COBOL on mainframe, C on unix and the personal computers themselves were only just starting. We had already been searching for a way to make programming more effective at that time – with the main programming language COBOL being a third generation language and therefore not being very suitable for creating well-structured programs.

Consequently, object-oriented paradigm was bound to fall on fertile ground. The beginnings however were not easy. I had to write the first C + + translator myself in C, so I could test the theoretical principles in practice, the most difficult thing however was to change the way of thinking. I still remember having a list of basic OOP rules in front of me and verifying every single piece of code according to it.

The project “Evolution” dates back to a time when I started teaching the OOP. I created a simple program for teaching purposes on which I demonstrated the inheritance of classes and the division of code into classes. The program was celled “Algae”, “Amoebas” or simply “Worms”, and if the students were successful, it portrayed a simple life in a Petri dish. The static algae were evolving into multicellular slow amoebas which then continued to develop into fast and predatory worms. Of course, the emphasis then was placed on the inheritance in terms of OOP – from the basic class “algae” came a subclass “amoebas”, from which another subclass “worms” was derived.

As a teaching material, the program proved itself to be very useful because, though simple, it contained all of the important components – in addition to classes for the living creatures there was a class called “Nature” which served to manage the environment and control the “life cycle” as well as the supporting technical classes used to display graphics and process input (keyboard control).

Over the years, the basis of the program did not change – only the development environment was improving as we gradually moved from MS DOS to Windows, from MFC to .NET. Eventually, also the OOP motivation receded as the mastering of new programming tools (graphic libraries) became more important.

The next big step was taken in the spring of 2012, when at my son’s request, I implemented XNA version of the program, which was supposed to be an exposition on one of his “bio” events (http://bio.mimo.cz/amebio/). The main part then was being played by the audiovisual side of things (the worms learned how to emit sounds through MIDI interface) but people that came into contact with the program were more enticed by the principle of “life on a computer” itself.

At that time, I decided to get rid of the aged principle of “pseudoevolution”, where an object from a lower class can sometimes create an object from a higher class (an alga evolving into amoeba). Instead of that there is only one class, whose evolution depends on random mutations of parameters (DNA).

Due to its original purpose, a screen was hanging in woods for several days with the running program on it, which gave us the rare opportunity of observing the evolution for a long period of time that was by far the longest from any previous experiences. As it turned out, once in every few hours the evolution changed in some completely unpredictable way, we can even say that it was impossible to determine from the initial parameter values how the civilisation will turn out in the end.

This turned our attention from the visual side of the program to the principle itself – how is it possible that a relatively simple algorithm gives us a different result every time? Even with setting the same initial parameter value of the pseudorandom generator every time, after a few minutes the evolution was developing differently.

Theoretically, this was to be expected. The program is basically a system with a nonlinear multiple feedback – behaviour of such systems is described by the mathematical Theory of Chaos. In short, even the smallest variation of the original conditions causes large changes in the system’s overall behaviour (see for instance http://cires.colorado.edu/~doug/extinct/fd1.pdf or any link to terms „feedback and chaos theory“).

On the top of that, the program’s behaviour is not only influenced by its initial conditions (DNA code of the organisms’ progenitor and the parameters defining nature). The distance the creatures cover per time unit depends on current CPU utilization. The program even considers the speed of the computer to be one of the parameters of the environment – when the FPS decreases under the set level, the procreation of the organisms slows down.

Nowadays

However, only a small group of enthusiasts was able to actually run the XNA version of the program. Because of that I transferred it to the HTML5/JavaScript platform – it was actually a welcomed opportunity for me to practice this technology. Of course, as a result the performance decreased because interpreted JavaScript can’t measure up with a game engine. On the other hand, you can now run the application in any modern browser on PC, tablet or mobile phone (more or less – the browser versions vary a lot, especially the mobile ones can have some problems).

You can start the Evolution itself here: www.neurodot.com/Evolution/evol.htm?key=spa_default_set

The set of parameters you want to use is stated as a key.

When the program is running, you can even pull out a list of the most important values from the upper side of the screen by either clicking your mouse or touching a finger to it.

How to play God

Even though the running program strongly resembles an aquarium and has the same undeniable calming effect, the main fun lies in the play with the initial parameters.

For example my personal goal is to find such a combination of initial parameter values, so that life begins at the most elementary level (single-celled, slow creatures) and only over time do the random DNA mutations and natural selection create other kinds of organisms, such as multi-cellular fast predators.

It is not as easy as it looks - if the conditions do not allow a sustainable life, the population dies out and life will start all over again, with a single cell of the original DNA. Incidentally, I advise you to set a non-zero initial value of pseudorandom generator (seed) in your first attempts, so that the course of a repeated development will be approximately the same (the very same course, especially during a longer time period, is impossible to reach).

You can also begin on some higher level - for example start with greater speed and multiple cells (see spa_test1)

To edit the parameters use this program: www.neurodot.com/Evolution/evolutionEdit.htm

A simple registration is necessary (login and a password), so that we won’t mess with each other’s files. You don’t have to write down your email but it happens to be useful when you forget your password.

Parameter files and pictures (sprites) are divided into personal and public ones. The personal ones will be visible only to you personally, the public once will be visible to everybody and free for them to copy. You can edit only your own files.

The editor is (hopefully) quite intuitive, so there is no Help to be found.

You can start the program right out of the editor (a Test button in the upper right corner of the page), so that you can test your set of parameters.

Parameter description - nature

Sun

Position (x,y) and temperature of the Sun. All energy comes from the Sun. The amount of energy that a organism receives depends on the Sun’s temperature and decreases with square of the distance from the Sun.

The ability to use the solar energy depends on the DNA parameter „Chlorophyll“.

Seed

The initial value of the pseudorandom generator. At the zero value, a random initial value is generated (it is derived from the current time).

Min_FPS

The minimum number of frames per second. If the number of displayed frames falls below this limit, i.e. if the current machine performance does not match the size of the population, the birth rate decreases.

Render_type

The way a single cell is displayed. It is possible to use these values:

“circle“ - a coloured ring
„fill“ - a shaded circle
„sprite“ - a specified picture

The value "circle" is appropriate for testing – shows hunting creatures in yellow colour.

Sprite_key

The key of a picture that is to be used as a sprite. The key is derived from the name of the owner and the name of the image (see image editing).

The program generates different colour options for one picture. However, only the grey colours are being coloured, the other remain unchanged.

Min_age

Affects the mutation of the DNA parameter "Max_age", which defines the length of life of a creature. It is ensured that during the mutations, the new DNA value is not created smaller than this overall limit.

When the creatures die too young, they don’t have enough time to create offspring and therefore their DNA branch dies out.

Max_age

Affects the mutation of the DNA parameter "Max_age", which defines the length of life of a creature. It is ensured that during the mutations, the new DNA value is not created larger than this overall limit.

When the creatures live for too long, there is a very small population change which limits the opportunity of new creatures with mutated DNA to form.

Min_speed

Affects the mutation of the "Base_speed" parameter, which determines creature's normal speed (the speed is given in pixels per second). It is ensured that during the mutations, the new DNA value is not created smaller than this overall limit.

When the creatures are too slow, they’re not able to catch much and it’s visually absolutely boring.

Max_speed

Affects the mutation of the "Base_speed" parameter, which determines creature's normal speed (the speed is given in pixels per second). It is ensured that during the mutations, the new DNA value is not created larger than this overall limit.

When the creatures are too fast, their movement looks unnatural.

Ovula_size

Affects the mutation of the "Ovula_size" parameter, which determines creature's size at the moment of formation. It is ensured that during the mutations, the new DNA value is not created smaller than this overall limit.

The maximal size is not being set for it is determined by the size of the sprite.

Visibility

The maximal distance at which the creatures see their prey.

When you set this distance longer than the diagonal of the screen, the creatures tend to move along the diagonal after a longer time (because this is the direction where most of the potential prey is and as a result where the majority of the hunters are as well).

Mut._rate

Specifies how often the mutations occur during a DNA gene copying, for example 0.1 means that every tenth copying is a mutating one.

Mut._extent

Determines the extent of a mutation (if it comes to it), for example 0.1 means that the copied gene will vary by up to + / - 10 percent.

Element_A
Element_B
Element_C

The amount of reserves of elements A, B, C in nature.

Limited resources serve as a regulation - when a creature does not have the amount of elements necessary, it cannot be born. After death the creature decays (the elements return to nature).

The parameter description – the DNA code of the progenitor

All of the parameters can become a subject to random mutations during the DNA code copying. The frequency and extent of this mutation is influenced by certain parameters of nature.

For some parameters the permitted extent is also determined (more for technical reasons than anything else).

Ovula_size

The size of a just formed organism.

Mustn’t be smaller than the corresponding nature parameter and larger than the sprite size.

Max_size

The maximal size a creature can reach (it is the size of one cell).

Mustn’t be larger than the sprite size.

Adult_age

Adult age (in seconds).
One of the necessary conditions for fertility.

Max_age

The maximal age a creature can reach.

Mustn’t be smaller than the corresponding nature parameter.
In practice, the maximum age is usually smaller – the organism can die of hunger (runs out of energy) or can get eaten by other.

Max_segments

The maximal length of multicellular creatures.

Max_energy

The maximal energy – when reached, the organism ceases to be hungry and stops hunting. The zero value means, the creature hunt all the time.

The energy is absolutely essential. The organism needs it to grow, to move and to ovule. If the organism is pregnant, the gained energy is being divided in between said organism and its embryo.

The energy is being obtained from the Sun or by hunting.
If absolutely necessary, the creature can digest its energy supplies (its size decreases and its energy level increases).

Fer._energy

The energy needed to ovule.

Only adult and strong enough organisms are fertile, that is very important for the natural selection.

Base_energy

Base energy level - the mother has to feed the embryo till it reaches this energy level, the embryo can then be born. If the energy of a creature falls under this level, it dies of hunger.

Consumption

The basic consumption – the energy changes by this amount in a one step of growth, multiple of this energy that is dependent on time and speed is consumed when moving.

Chlorophyll

The ability to obtain energy from light - the amount of light hitting the creature is multiplied by this value.

Base_speed

Base speed.

Determines how fast a creature changes position. If the creature moves minimally (just floates), it consumes minimum energy but doesn’t catch anything ...
It is given in pixels per second.

Grow_incr

The increment of growth. By this amount increases a creature its size in one step, if it has enough energy to do so.

If the energy falls under the base energy, the creature will get smaller (lose weight) and its energy will increase by the same amount. The creature grows only up to the max_size (then it is just "getting fat", i.e. its supply of energy gets bigger without the creature actually growing).

Acceleration

Acceleration.

Determines what acceleration a creature can develop while on the hunt. The normal movement speed is multiplied by this acceleration (note that the energy is consumed adequately to the result speed).

Decay_decr

Determines how fast a creature decays after it dies.

The value 0.01 means that it will keep shrinking by one-hundredth of the size it had at the time of death.
It's just a visual effect. (A creature that is caught will disappear faster).

Element_A
Element_B
Element_C

Number of basic elements needed for an organism.

The maximal amount in nature is limited.

Enzyme_A
Enzyme_B
Enzyme_C

The amount of enzymes a creature needs to digest the elements.

Specifies how much a prey is edible - if a creature has an appropriate amount of enzyme for at least one element in its prey, the prey is edible for it.

Enzymes are not consumed, just as the amount of elements in an organism does not change during its life.

Whether the creature is edible for another or not can therefore be changed only by a mutation. By eating the prey, the predator gains only energy, the elements return to nature. In the beginning the amount of enzymes is smaller than the amount of the basic elements, i.e. the creatures are not able to digest other creatures (they only acquire energy from the sun).

snapshot