Complex Behaviour from Simple Rules: 3 Simulations

0 Просмотры
Издатель
A small display of some of the surprisingly intricate patterns and behaviours that can arise from relatively simple rules. More information about each of the simulations below.

These simulations were made in Unity, and coded with C# and HLSL. The code for the first two simulations is currently in early access to patrons of the channel. If you'd like to support my work, you can find it here:
They will be available to everyone sometime around mid-May. The slime mould simulation is from a previous video, so you can find the code for that over here:

---- 1. Reaction-Diffusion ----
This is a simulation of two chemicals (A and B). Both diffuse over time (A faster than B).
The simulation space is initially filled with A, and just a small region has some of chemical B. Over time, more A is gradually added (controlled by a parameter called feedRate), while B is gradually removed (controlled by the parameter removeRate). Finally, there's a reaction that takes place: when one particle of chemical A is in the presence of two particles of chemical B, it will be converted into B.

One could simulate the individual particles of both chemicals, but more common (and the approach I went with as well) is to just store a value for the concentrations of both chemicals at each pixel. The probability of an A particle coming into contact with two B particles can be determined by the equation: probablityOfReaction = concentrationA * concentrationB * concentrationB. Here is the tutorial I followed when creating my implementation:

The colours in the simulation are mainly based on the concentrations of the two chemicals, but to spice things up I also added some colouring based on how fast the concentrations are changing at each point.


---- 2. Multiple Neighbourhood Cellular Automata ----
This is a technique developed by someone who goes by Slackermanz online (you can find many awesome examples under that name on Twitter).

In this simulation, the state of each pixel (called a cell) is initially randomized between 0 and 1. On every frame, the state of each cell is updated based on the states of all the cells inside various "neighbourhoods" around it. These neighboughhoods are ring-shaped, with each ring defined by a min and max radius, along with two min/max values called 'alive' and 'dead'. Once all the states inside a ring have been added up, the sum is compared to the ring's alive and dead ranges, and depending on which range the sum falls into, the cell's state increases or decreases by some small amount (if the sum is inside neither range, the state remains the same).

This already gives interesting results, but there are some more nuances that can be added. For example, instead of the rings directly affecting the cell's state, they can contribute to several 'potential' states, and whichever of these is most different from the cell's current state becomes the new state.

My implementation is based on Slackermanz code, which you can find here:
Slackermanz also has a YouTube channel here:


---- 3. Slime Mould Simulation ----
In this simulation we have a lot lot of particles, each of which leaves a trail behind itself as it moves. These trails diffuse and evaporate over time. Each particle also has three circular sensors arranged in an arc in front it. These are used to detect the intensity of the trail, and the particle turns towards whichever detects the highest intensity. Some randomness is added to the turning as well.

The idea for this comes from this paper:
I also have a video exploring it in some more depth:

Music:
Beneath the Stars by Joshua Spacht
Nowhere I Can Go by The Stolen Orchestra
The Art of Loneliness by Anbr
Selfless by Eleven Tales
Life by Anbr

Chapters:
00:00 Reaction-Diffusion Simulation
02:50 Multi-Neighbourhood Cellular Automata
07:23 Slime Mould Simulation
Категория
Комедии
Комментариев нет.
Яндекс.Метрика