Species

Overview

This is a relatively simple simulation of multiple species fighting for survival.

Simulation World

A terrain is generated using Perlin noise. The noise values are blurred to smooth out the edges a little.

Creatures

Multiple types of creatures are created that inhabit the world. They each have properties like;
X and Y position – where the creature is in the world
Radius – how large the creature is
Direction – what direction the creature is facing
Speed – how far the creature moves each step of the simulation
Color – what color it is so creature types can easily be distinguished from one another
Sides – creatures are shown as polygons with between 3 and 8 sides
Age – how many simulation steps has the creature lived for
Maximum Age – if a creature reaches this age it dies of old age
Minimum and Maximum Breed Ages – a range of ages that the creature can reproduce

The simulation is started by creating a bunch of random creatures in the world. They all move according to their properties.

Fighting

When 2 creatures come into contact with each other they fight for survival. At this stage I have 3 possible fight methods to determine which creature wins;
1. Random – one of the creatures in the fight is randomly chosen to die
2. Attacker wins – whichever creature first moves and hits another creature kills the creature it hits
3. Strongest wins – Creature strength goes up from birth to middle age then down again as the creature ages. This is so “babies” and “elderly” creatures are not as strong in battle against middle age creatures.

Reproduction

Creatures have a chance to duplicate themselves if they are between a minimum and maximum breed age and if there is room near them for the child creature to be born into. There is an option for the child properties to be mutated slightly (or not so slightly).

Results

Here is a sample movie showing a full run that lasts until one of the species manages to kill all others. No mutations in this example.

Species is now available as a mode within Visions of Chaos.

Jason.

Primordial Particle Systems

Primordial Particle Systems

A while back I was playing with Particle Life simulations. At that time, another video I came across was the following

Click here to read the paper “How a life-like system emerges from a simple particle motion law” that describes how it works in great detail.

Primordial Particle Systems

For a simpler overview I recommend this page by Brian H that includes snippets of the source code that helped me get my version working.

Primordial Particle Systems

My even (hopefully) simpler explanation is as follows;

1. Fill the simulation space with a bunch of particles.
2. Particles have settings for radius, alpha, beta and velocity.
– radius is how far around itself each particle can sense the other particles.
– alpha is the fixed rotation amount. Each particle turns by this amount each step of the simulation.
– beta is the proportional rotation. This is the amount the particle turns depending on its neighbor particles.
– velocity is how far the particles move forward each step.
3. Each particle maintains a heading which is the direction it is facing.
4. Each of the particles move by the following steps
– Count how many neighbor particles are within the radius
– Work out how many of them are to the left and right of the particle
– Turn towards the left or right with the larger count
– Move forward

That’s all there is. From those relatively local and simple steps you can get some nice cell like and amoeba like structures emerging.

Primordial Particle Systems

More sample images in this gallery.

The following movie shows some example results created with the latest version of Visions of Chaos.

Jason.

Physarum Simulations

Physarum Polycephalum

Physarum Polycephalum aka slime mold is made up of a vast number of individual single cell organisms. These organisms have no brains or intelligence, but complex behaviors emerge when many of them are put together. Depending on their environment they move like what seems to be a much more complex entity.

Here are some great videos about slime molds with some awesome time lapse footage.

Once you have watched those you should hopefully have a better appreciation for the simple slime mold and the rest of this post will make more sense.

Here is one final video showing time lapse footage of various Physarum

Simulating Slime Molds

I have been interested in trying to simulate slime molds fror years now and my interest was once again peaked from seeing Sage Jenson‘s Physarum page here describing his simulations.

Sage was inspired by the paper Characteristics of Pattern Formation and Evolution in Approximations of Physarum Transport Networks.

He gives this simple diagram explaining the steps.

The basic explanation is a bunch of particles move over an area turning towards spots with higher concentrations of a pheromone trail. They also leave a trail as they move. These basic steps create interesting patterns and structures.

My method

Physarum Simulation

Following the principals from Sage and the paper, this is how my take on simulating Physarum works.

Physarum Simulation

1. Create a 2D array that tracks the pheromone trail intensity at every pixel location. Initially all spots are set to 0 intensity. I tried setting various shapes and perlin noise clouds to start, but the moving particles quickly erase any starting shapes and create their own paths so I just start with an empty space. Sage’s examples show interesting patterns and structures when starting with circles or other shapes, so I need to do some more work on start patterns.

Physarum Simulation

2. Create a list of particles with properties heading (direction/angle the particle is moving), x,y (positions), sense angle (how wide the particle looks to the left and right) and sense distance (how far in front the particle looks), turn angle (how quick the particle turns towards the sensed areas). I set the number of particles to match the image width multiplied by the image height. That seems to nicely adjust the particle count when changing image sizes.

Physarum Simulation

3. Main loop

Physarum Simulation

a) Display. For display I scale the minimum and maximum trail values to between 0 and 255 for a gray scale intensity (or to be used as an index into a color palette, but simple gray scale seems to look the best).

Physarum Simulation

b) Each particle looks at the 3 locations in front of it based on the sense angle and distance. You then work out which of the left, front and right spots have the highest concentration of the pheromone trail.

Physarum Simulation

c) Turn the particle towards the highest pheromone intensity. ie if the left spot is highest then subtract turn angle from the particle heading. If the front is highest do not make any change to the particle heading. If the right is highest add turn angle to the particle heading. You can also reverse this process so the particles turn away from the highest pheromone levels.

Physarum Simulation

d) Move the particle forwards by a specified move amount.

Physarum Simulation

e) Eat/absorb. I added a setting so that particles can absorb a bit of the pheromone trail at this point.

Physarum Simulation

f) Deposit an amount of pheromone onto the trail to increase it.

Physarum Simulation

g) Blur the trail array. This simulates the pheromones diffusing over the surface. I use this quick blur with an option for a blur radius between 1 and 5.

Physarum Simulation

h) Evaporate the trail by a small amount. This slowly decays the amount of pheromone.

Physarum Simulation

Repeat the main loop as long as necessary.

Physarum Simulation

Results

See my Physarum Simulations gallery for more images.

Here is a movie with some example results showing the simulations running. For the display the pheromone trail intensities are mapped to a gray scale palette (brighter = higher intensities).

Multiple Species Physarum Simulations

Physarum Simulation

My next idea was to have multiple Physarum types in the same area. For these cases I used 3 sets of Physarum (3 groups of particles with their own unique settings) as shown in the following settings dialog.

Physarum Simulation

Each of the pheromone trail intensities are then converted to RGB color components.

Physarum Simulation

This works but the results are just 3 separate simulations that do not interact. The idea is to have each of the particle types attract to their pheromones, but move away from the other 2 types of pheromones.

Physarum Simulation

The main change is in the pheromone detection and turn code. For the single Physarum simulation the particles look left, forward and right and then turn and move based on the location with the highest pheromone concentration. For 3 particle types they take into account their pheromone concentrations but subtract the pheromone concentrations of the other 2 types. For example if the 3 trail/pheromone arrays are called rtrail, gtrail and btrail, then the red particles pheromones are calculated by using rtrail[x,y]-gtrail[x,y]-btrail[x,y]. The highest concentration of left, forward and right is then turned and moved towards.

Physarum Simulation

More example images can be seen in my Physarum Simulations Gallery.

Here is a sample movie showing some of the multiple species results.

Physarum Image Processing

This was inspired after seeing the following video from Magic Jesus.

A bunch of Physarum particles start on the surface of an image. The particle colors are based on the image color they start on.

After this let them wander around the image area following Physarum simulation rules with a slight change. In this case rather than turning left or right based on a pheromone trail intensity, they turn towards the pixel that is closest in color to themselves.

This is my result after running Physarum simulations on three colorful paintings. The first and third are from Leonid Afremov and the second by Kandinsky (same painting as in Magic Jesus’ example movie).

These would look great on a large wall in a modern art gallery. Playing slowly enough so you could just notice the changing colors (like clouds moving slow enough you don’t notice they change until you look away and back again). The exhibits with those dark rooms you enter and read the little white plaque with a blurb on what it is all about. “The slow interplay of colors represents the human condition and the struggles of how humans still cannot find a peaceful equilibrium of coexistence with themselves and the planet.”

Availability

Both single and multiple species Physarum Simulations and Physarum Pixel Flow are now included with the latest version of Visions of Chaos.

Jason.

Automatic Color Palette Creation

Fractint MAP format palette files

Going back 30 years, Fractint was a fractal generation program for DOS based systems. For its time it was the fractal program of choice for enthusiasts.

Fractint used a simple text format for its color palettes. These *.MAP files were text files with each color’s RGB values separated by spaces each on a new line. So, for example if you wanted the first color in your palette to be blue the first line would be “0 0 255”.

When I first started creating Visions of Chaos I adopted the format. The most common map files had 256 colors (you could have palettes with other color counts but I only use 256 color palettes).

The rest of this post covers the palette creation methods that have been included with Visions of Chaos. Although I use these methods specifically to create 256 color MAP files the principles could be applied to any number of colors for different sized palettes.

If you are just looking for a Fractint color palette collection, scroll down to the end of this post and grab the archive provided.

Smoothly blending colors

Visions of Chaos Color Palette Editor

This is probably the first and most obvious method to use. Take a small number of base colors (I allow up to 16) and blend them into a palette.

How you get the colors to blend can be;

1. User selects them from the standard color picker dialog.
2. User can use eye dropper functionality to pick them out of a photo.
3. Set them at random.
4. Use the color wheel. Allows selection of complmentary colors, tetrads, and other color theory based colors.

Visions of Chaos Color Palette Editor

5. Extract colors from an image. See this previous blog post explaining how that works.

Visions of Chaos Color Palette Editor

Once you have the colors there are numerous ways you can blend them;

1. Smooth blend. Smoothly interpolate the colors.

Visions of Chaos Color Palette Editor

2. Fade out blend. Fade each of the colors to black.

Visions of Chaos Color Palette Editor

3. Fade in blend. Fade each of the colors from black.

Visions of Chaos Color Palette Editor

4. Neon blend. Fade from black to the colors then back to black.

Visions of Chaos Color Palette Editor

5. Stripe blend. Alternate each color for the duration of the palette.

Visions of Chaos Color Palette Editor

Using curves to create palettes

The idea here is to use various mathematical functions to generate curves for the RGB components of the palette. The following is a list of the various methods I use so far.

Sine. Each RGB color component is its own sine wave. Randomize the wave amplitude, frequency and period.

Visions of Chaos Color Palette Editor

Multiple Sine. Add multiple sine waves together for each RGB component and then scale down to between 0 and 255.

Visions of Chaos Color Palette Editor

IQ. Idea from Inigo Quilez.

Visions of Chaos Color Palette Editor

Perlin. Use repeating noise loops as in this coding train video. Map the resulting noise values to each RGB channel. Using a looping noise function is best because it means the palette wraps around smoothly and using it for fractal zooms does not show a sharp break when the palette ends and restarts. I have only implemented this method over the last few days (at the time of writing this post), but so far it gives some really unique color palettes.

Visions of Chaos Color Palette Editor

Here are some examples palettes created using Perlin noise. Click to see the full sized image.

Visions of Chaos Color Palette Editor

Simplex. Same as Perlin, but uses Simplex noise.

Visions of Chaos Color Palette Editor

Simplex + Perlin. Create each RGB value by adding Simplex noise to Perlin noise.

Visions of Chaos Color Palette Editor

Here are some examples of Simplex and Simplex + Perlin palettes. Click for full size.

Visions of Chaos Color Palette Editor

Multiple Perlin – Add/subtract multiple Perlin Noise curves into RGB amounts.

Visions of Chaos Color Palette Editor

Random Walk. Random curve for each RGB component between index 0 and 127. Reverse for the rest of the palette. Each step the RGB is changed by +random(5)-2 to randomly go up and/or down.

Visions of Chaos Color Palette Editor

Terrain Fault. Take 2 random points between 0 and 255. Between the points randomly raise or lower by a small amount. Repeat this a number of times.

Visions of Chaos Color Palette Editor

HSL to RGB. Random HSL curves converted to RGB.

Visions of Chaos Color Palette Editor

RGB. Random curves for each RGB component. Use various easing functions to tween curve control points.

Visions of Chaos Color Palette Editor

YUV to RGB. Random YUV curves converted to RGB.

Visions of Chaos Color Palette Editor

Combine palettes. Take 2 previously created palettes and combine their RGB components by addition, subtraction or multiplication.

Visions of Chaos Color Palette Editor

Multiple RGB. Combine multiple RGB curves.

Visions of Chaos Color Palette Editor

Multiple YUV to RGB. Combine multiple YUV to RGB curves.

Visions of Chaos Color Palette Editor

Modify an existing palette

Once you have palette files, you can also use various techniques to modify them;

1. Increase or decrease the individual RGB channel amounts
2. Brightness
3. Contrast
4. Increase or decrease the individual YUV channel amounts
5. Wrap. Take the existing palette, halve it, then add the flipped half to itself. This is useful when you want a non repeating palette to wrap around.

Visions of Chaos Color Palette Editor

Visions of Chaos Color Palette Editor

6. Double. If you have a palette that is too smooth/sparse for the current fractal image, doubling can add more lines/gradients to the palette.

Visions of Chaos Color Palette Editor

Visions of Chaos Color Palette Editor

7. Blur. Just like a blur function in image processing. Averages out the palette values with neighbor colors.
8. Sharpen. Just like a sharpen function in image processing.
9. Shift RGB. R->G,G->B,B->R.

Visions of Chaos Color Palette Editor

Visions of Chaos Color Palette Editor

Visions of Chaos Color Palette Editor

10. Invert. R=255-R, G=255-G, B=255-B.
11. Reverse. Flip the order of the palette colors.
12. Histogram equalize palette. Like the auto-levels in Photoshop. My method tends to make the results slightly too bright. Needs fixing when I get a chance.

Visions of Chaos Color Palette Editor

Visions of Chaos Color Palette Editor

13. Matrix multiplication. Take a 3×3 matrix and multiply the 1×3 RGB components by the matrix to get new RGB amounts.

Visions of Chaos Color Palette Editor

Any other ideas?

If you know of any other ways to generate palettes, or have an idea for ways to create new unique color palettes, let me know.

Availability

The color palette editor shown in this post is included with Visions of Chaos.

Just give me the palettes!

If you are using another program that uses Fractint palette files you can download the 3371 color palettes I include with Visions of Chaos here. Some created by me, others found on various Internet sites over the years, some converted from gradient packs. No copyright on them so do with them as you wish.

If you do have any other sets of MAP palettes you would like to share, send me an email. You can never have enough colors when creating fractal images.

Jason.

2018 In Review

Another year gone. Over the past year Visions of Chaos has had many new features added, bugs fixed and loads of smaller enhancements. In this blog I managed to cover and experiment with a wide variety of topics over the last 12 months.

Post Summary

Here is a list of posts I added to this blog in 2018;


More Adventures With 3D Gravity
Updated simulation code for 3D gravity.


MergeLife Cellular Automata
Yet another CA explored this year.


Cellular Automata Explained Part 1
Trying to explain CAs from the ground up for newbies. Idea is to expand this into a series.

1D CA


Mandelbrot Foam
A new variety of fractal from Fractal Forums.


Clusters And Particles
Awesome emergence.


Extended Neighborhood 1D Cellular Automata
Inspired by a Reddit post this time.

Extended Neighborhood Cellular Automaton


3D Multiphase Smoothed-Particle Hydrodynamics
3D fluids.


Hybrid Fractals
Quick explanation for hybrid fractals. An area with huge potential for exploration and experimentation.


Multiple Rules Cellular Automata
From a YouTube comment idea.

Multiple Rules Cellular Automaton


Searching For Pleasing Looking Flame Fractals
My attempts at trying to make software smart enough to detect good looking flames.

Flame Fractal Mutator Dialog


Stochastic Cellular Automata
Introducing randomness into CAs.


Spring Pendulum
Extending double and triple pendulums but using springs for their segments.


More Explorations With Multiple Neighborhood Cellular Automata
More experiments with these awesome CA.

Multiple Neighborhoods Cellular Automaton


Rock Paper Scissors Cellular Automata
RPS and variations in CA form.

RPS Image Cellular Automaton


Multiple Neighborhoods Cellular Automata
Fantastic new CA.


Stacked Generations Display For 2D Cellular Automata
These turned out very nice.

History Dependent Cellular Automaton


History Dependant Cellular Automata
A new (old/rediscovered) CA method.


Alternating Neighborhoods Cellular Automata
A new CA from an idea I had one day.

Alternating Neighborhoods Cellular Automaton


Zhang Cellular Automata
A Twitter post inspires another new mode.

Zhang Cellular Automaton


Two Steps Back Cellular Automata
Another new CA (for me) from a Twitter post.

Two Steps Back Cellular Automaton


Indexed Totalistic Cellular Automata
A new CA thanks to a Twitter post.

Indexed Totalistic Cellular Automaton


Line Based 3D Strange Attractors
A group of strange attractors that are plotted from a series of joined points rather than a point cloud.


2D Accretor Cellular Automata
Experiments with a 2D version of the Accretor CAs.

2D Accretor Cellular Automaton


Variations of Ant Automata
Trying a new variation of Langton’s Ant. Nothing too spectacular.

Ant Automaton


Accretor Cellular Automata
Interesting structures from a new CA thanks to a Dutch artist.

Accretor Cellular Automaton


The Stepping Stone Cellular Automaton
An interesting CA from the C64 days of 1980.

Stepping Stone Cellular Automaton


Blog

I have tried to include more useful information as this blog has gone on over the years to hopefully help others, but mainly blogging is most helpful to me. There is an old adage saying that if you cannot explain something clearly then you do not understand it well enough. Writing blog posts has helped me clarify many topics in my mind.

Another big advantage of blogging is that you get contacted by like minded people. Many of the interests I have blogged about have been greatly enhanced by someone emailing me a new idea or fix for an issue I am having.

I really do recommend that everyone blog. Everyone has a “something” they are good at or knowledgeable about. Share that knowledge. You may be surprised how much you benefit from the process.

Looking Forward

I have no intentions of stopping development on Visions of Chaos any time soon. I still have loads of ideas for new features. That also means this blog will continue to grow for the foreseeable future. Onward to 2019 and beyond.

Jason.

Clusters and Particle Life

This is another great example of emergence. Complex behavior results from many individual particles following simple rules.

Jeffrey Ventrella explains his Clusters here.

Here is another particle based life model

I learned about Clusters when Code Parade posted the following video explaining his version of Clusters he calls Particle Life.

The source code to Particle Life was generously shared here so I had a go at converting the code and playing with these myself.

Results

Here are some of my results.

Extension Into 3D

Once I had the 2D version working, extending into 3D was the next step. These movie parts use the same settings as in the 2D movie above.

Availability

Both the 2D and 3D Particle Life are now included with Visions of Chaos.

Jason.

Spring Pendulums

In the past I have done some explorations with double, triple and quadruple pendulums.

Thanks to √Čtienne Jacob‘s twitter post here and the source code he generously shared I was able to have a go at spring pendulums.

Spring pendulums are similar to the previous double, triple and quadruple pendulums, but the fixed length pendulum arms are replaced with springs. This leads to more complex plots.

Here are some examples of a double, triple and quadruple spring pendulum.

To make the plots a little clearer, here they are again with only the pendulum end points being traced.

Spring pendulums are now included with the latest version of Visions of Chaos.

Jason.