📜 ⬆️ ⬇️

Cosmic: 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 produce subjectively complex and interesting calculations, forming nontrivial visual-kinetic models.
')
Over time, several ideas emerged that you can model interesting things.

Here's what happened with one of them (in the frame small objects, look in HD):




I took the graph visualizer as the basis: touch .



shift + click, shift + drag, alt + click.
Touching is best done in Chrome or Safari due to V8 javascript.

I began by adding inertia to the vertices of the graph, which made the behavior of the object more complicated. At a certain point, the model became associated with something average between the model of a chemical compound and a multicellular organism: touch



The experiments grew into a desire to ensure the interaction of a multitude of such objects according to some principles, so that it would be interesting to observe this:


Later, the possibility of breaking the glue in case of excessive load on it was added. That's what happened in the end: touch



The next step was the implementation of digestion within one organism: each gluing each fixed period of time takes energy from a smaller cell and transfers it to a larger one. If the energy of the smaller cell turns out to be less than a certain minimum, the cell disappears, and a new draw cell with a basic charge of energy appears in space, which serves as food for the evolving around organisms. A restriction was also introduced - a cell can absorb only a cell that is at least 61.8% of its own energy. This eliminated the formation of freaks, when huge cells attach small cells directly to themselves. Instead, they are now 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 was to move the project from the SVG prototype to the CUDA model. Obviously, there is a desire for more active matter. Transferring the model to the GPU made it possible to use 8-16K particles instead of 250 in the browser prototype.

This is what is at the moment. Having CUDA 2.0 compatible devices can touch the model personally: touch .

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, now it should start without the SDK). On XP 32bit also works, the link can be taken here: Cuda SDK .
p - remove from pause
s - show slidebars
r - change the 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 are involved in the video.

The quadratic complexity of the algorithm affects, as all cells affect all cells. The use of the Barnes-Hut optimization algorithm on CUDA, judging by the read scientific articles from those who already transferred it to the GPU, has an effect only beyond the threshold of 50K particles, which is outside the realtime threshold :-( However, it still seems to me Moreover, the order of intercellular interactions is much more complicated than gravitational interactions.



Theoretically, it is possible to simultaneously consider 256K particles on the same 30FPS as independent “galaxies” with 1K particles each (display on the screen as a 16x16 grid). From the point of view of evolution, 256K particles, even if segmented into independent galaxies, can be much 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 pretty screensaver. To charge enthusiasts with points for the time that their iron spun the cosmos, showing them the process in the form of a splash screen. Points can be spent in the designer of individuals that will be thrown into a distributed space, mutate and evolve - the “demiurge” will be able to track the success of its population and the amount of matter controlled by its individuals in the vast 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 the species diversity of individuals.

I hope to be able to implement it.

For now, thank you for your attention!

PS Enthusiasts who autonomously launched the model - please write - what kind of hardware and which FPS is in the console (the console in the background is the second window)

UPD: dropbox removed the ability to place materials on an open link, duplicate the link to materials from the article - Ya.disk

UPD: demo engine cosmics 2013, with soft-body physics

Source: https://habr.com/ru/post/153169/


All Articles