Cosmos: modeling the evolution of multicellular organisms
Hello, Habr!
A few years ago, for practical purposes, I implemented the usual Force-based graph visualizer.
I was impressed how simple iterative transformations can make subjectively complex and interesting calculations, forming non-trivial visual-kinetic models.
Over time, several ideas arose that interesting could be modeled.
Here's what happened with one of them (small objects in the frame, watch in HD):
As a basis, I took the very graph visualizer: touch .
shift + click, shift + drag, alt + click.
touch is best done in Chrome or Safari due to V8 javascript.
I started by adding inertia to the vertices of the graph, which made the behavior of the object more complex. At a certain point, the model began to be associated with something in between the model of a chemical compound and a multicellular organism: touch
Experiments grew up in the desire to ensure the interaction of many such objects according to some principles, so that it would be interesting to observe:
Later, the possibility of tearing the gluing in case of excessive load on it was added. Here is the result: touch
The next step was digestion within one organism: each gluing, each fixed length of time, takes energy from a smaller cell and transfers it to a larger one. If the energy of the smaller cell is less than a certain minimum, the cell disappears, and a new draw cell with a basic charge of energy appears in space, serving as food for organisms evolving around. A restriction was also introduced - a cell can only absorb a cell, which makes up at least 61.8% of its own energy. This ruled out the formation of freaks when huge cells attach small ones directly to themselves. Instead, now they are forced to form branched tentacles for this: touch
At this stage, there was a desire to share progress with friends, a screencast was prepared:
The next step, the project moved from the SVG prototype to the CUDA model. Obviously, more active matter began to be wanted. The transfer of the model to the GPU made it possible to use 8-16K particles instead of 250 in the browser prototype.
This is what it is today. Having CUDA 2.0 compatible devices, they can touch the model personally: touch it .
In the archive, among other things, a link to the SDK for Win7 x64, which must be installed before running exe (UPD: added another dll to the archive, should now start without the SDK). On XP 32bit also works, the link can be found here: Cuda SDK .
p - pause
s - show slidebars
r - change display mode
h - mark head cells
f - fullscreen
A little bit about future plans:
Of course, I want more cells. After optimization, the GTX 580 counts 16K cells at a frequency of 30 FPS, 8K cells at a frequency of 120FPS participate in the video.
The quadratic complexity of the algorithm is affected, since all cells affect all cells. Applying the Barnes-Hut optimization algorithm on CUDA, judging by the read scientific articles from those who have already ported this to the GPU, it has an effect only outside the threshold of 50K particles, which is outside the realtime threshold :-( However, it still seems to me In addition, the order of intercellular interactions is much more complicated than gravitational.
Theoretically, it is possible to consider simultaneously 256K particles on the same 30FPS as independent “galaxies” of 1K particles each (display on the screen as a 16x16 grid). From an evolutionary point of view, 256K particles, albeit segmented into independent galaxies, may prove to be significantly more useful than the direct interaction of 16K cells within a single galaxy. The exchange of individuals can be arranged in rounds, providing an intergalactic mortal kombat ;-)
By the same principle, you can implement a distributed version of the model, for example, in the form of a nice screensaver. Earn enthusiasts points for the time that their iron spun the space, showing them the process in the form of a splash screen. Points can be spent in the constructor of individuals who will be thrown into distributed space, mutate and evolve - the “demiurge” will be able to track the success of his population and the amount of matter controlled by his individuals in the vastness of global space.
A key role in the further development of the project should be played by a morphogenetic algorithm, which, with such modest topological capabilities (number of cells / individual), will be able to provide a species diversity of individuals.
I hope to be able to implement it.
That's all, thank you for your attention!
PS Enthusiasts who autonomously launched the model - please write - what kind of iron is and what kind of FPS is in the console (the console is in the background the second window)
UPD: Part 2: Modeling the evolution of multicellular organisms. 7 years of
UPD: project blog at Patreon
UPD: demo of the cosmic engine 2013, with soft-body physics
A few years ago, for practical purposes, I implemented the usual Force-based graph visualizer.
I was impressed how simple iterative transformations can make subjectively complex and interesting calculations, forming non-trivial visual-kinetic models.
Over time, several ideas arose that interesting could be modeled.
Here's what happened with one of them (small objects in the frame, watch in HD):
As a basis, I took the very graph visualizer: touch .
shift + click, shift + drag, alt + click.
touch is best done in Chrome or Safari due to V8 javascript.
I started by adding inertia to the vertices of the graph, which made the behavior of the object more complex. At a certain point, the model began to be associated with something in between the model of a chemical compound and a multicellular organism: touch
Experiments grew up in the desire to ensure the interaction of many such objects according to some principles, so that it would be interesting to observe:
- we consider the object as a model of the body of a multicellular organism, code name "cosmic"
- space consists of cells and sticks
- cells have their own energy, with increasing energy, size and color change
- gluing has an energy that determines its elasticity equal to the minimum of the energies of glued cells
- cosmic cells repel each other with a force proportional to the energy of the cells
- cell gluing interferes with the process of cell repulsion with a force proportional to the gluing energy
- cosmos is considered to be the head cell with the highest energy
- spacewalks seek to absorb (attach to themselves) other spacewalks
- the cosmic space absorbs another cosmic space, approaching its head cell with any own cell that has more energy than the head cell of the absorbed space
- cosmos tend to evade absorption by other cosmos
- spacecraft acceleration is formed by the sum of its cell accelerations
- each cell accelerates in the direction of all the cells that it is able to absorb, with a force proportional to its own energy
- each cell accelerates in the direction away from all cells that are capable of absorbing it, with a force proportional to its own energy
Later, the possibility of tearing the gluing in case of excessive load on it was added. Here is the result: touch
The next step was digestion within one organism: each gluing, each fixed length of time, takes energy from a smaller cell and transfers it to a larger one. If the energy of the smaller cell is less than a certain minimum, the cell disappears, and a new draw cell with a basic charge of energy appears in space, serving as food for organisms evolving around. A restriction was also introduced - a cell can only absorb a cell, which makes up at least 61.8% of its own energy. This ruled out the formation of freaks when huge cells attach small ones directly to themselves. Instead, now they are forced to form branched tentacles for this: touch
At this stage, there was a desire to share progress with friends, a screencast was prepared:
The next step, the project moved from the SVG prototype to the CUDA model. Obviously, more active matter began to be wanted. The transfer of the model to the GPU made it possible to use 8-16K particles instead of 250 in the browser prototype.
This is what it is today. Having CUDA 2.0 compatible devices, they can touch the model personally: touch it .
In the archive, among other things, a link to the SDK for Win7 x64, which must be installed before running exe (UPD: added another dll to the archive, should now start without the SDK). On XP 32bit also works, the link can be found here: Cuda SDK .
p - pause
s - show slidebars
r - change display mode
h - mark head cells
f - fullscreen
A little bit about future plans:
Of course, I want more cells. After optimization, the GTX 580 counts 16K cells at a frequency of 30 FPS, 8K cells at a frequency of 120FPS participate in the video.
The quadratic complexity of the algorithm is affected, since all cells affect all cells. Applying the Barnes-Hut optimization algorithm on CUDA, judging by the read scientific articles from those who have already ported this to the GPU, it has an effect only outside the threshold of 50K particles, which is outside the realtime threshold :-( However, it still seems to me In addition, the order of intercellular interactions is much more complicated than gravitational.
Theoretically, it is possible to consider simultaneously 256K particles on the same 30FPS as independent “galaxies” of 1K particles each (display on the screen as a 16x16 grid). From an evolutionary point of view, 256K particles, albeit segmented into independent galaxies, may prove to be significantly more useful than the direct interaction of 16K cells within a single galaxy. The exchange of individuals can be arranged in rounds, providing an intergalactic mortal kombat ;-)
By the same principle, you can implement a distributed version of the model, for example, in the form of a nice screensaver. Earn enthusiasts points for the time that their iron spun the space, showing them the process in the form of a splash screen. Points can be spent in the constructor of individuals who will be thrown into distributed space, mutate and evolve - the “demiurge” will be able to track the success of his population and the amount of matter controlled by his individuals in the vastness of global space.
A key role in the further development of the project should be played by a morphogenetic algorithm, which, with such modest topological capabilities (number of cells / individual), will be able to provide a species diversity of individuals.
I hope to be able to implement it.
That's all, thank you for your attention!
PS Enthusiasts who autonomously launched the model - please write - what kind of iron is and what kind of FPS is in the console (the console is in the background the second window)
UPD: Part 2: Modeling the evolution of multicellular organisms. 7 years of
UPD: project blog at Patreon
UPD: demo of the cosmic engine 2013, with soft-body physics