This is Particles Life. This is the simulation of a small universe where a few thousand particles move freely and interact with each other.
Press the next button a few times and observe these new universes coming to life in the simulation window
While all these universes follow a small set of physical rules applied with different parameters, they produce a wide range of emergent behaviors. I made this page to explain how this type of simulation works and provide some insights to better understand how different parameters affect the outcome in a reproducible way.
This page is inspired by this tool which I have tried to reimplement from scratch without looking at the original code. You should definitely check it out because it provides a GPU-powered version of the simulation that allows to run the simulation at a much higher resolution than on this page. Reading this page first should allow you to better appreciate how truly amazing this other tool is.
This page was made to be browsed on a computer screen. The experience on mobile devices suffer from the smaller screen size.
Also the simulations run directly in your browser so their smoothness is directly linked to the processing power of your device.
This page is meant to be an interactive walkthrough. Each section introduces new concepts and invites you to click on a button to update the simulation to a new universe.
Below the simulation you'll find the three controls that govern every universe in this simulation. You can adjust them at any time while a universe is running, or use the restart buttons to apply a fresh set of particles.
Uniform spread distributes all particles randomly across the full world. Centered circle packs them into a dense cluster at the center - many universes produce cleaner structures from this starting point since interactions begin in a concentrated area before spreading out. Both buttons preserve the current attraction table and color proportions.
The attraction table is the heart of the simulation. Each cell defines the force that the column species exerts on the row species: a positive value means the row species is attracted toward the column species, a negative value means it is repelled. The table is not symmetric - red can be strongly attracted to white while white is completely indifferent to red, or even repelled by it. This asymmetry is what makes complex behaviors possible.
The sliders set the relative number of particles of each species white, red, green and blue. Setting a color to zero removes it from the universe entirely. Adjusting proportions while a simulation is running has no effect on existing particles - hit one of the restart buttons to generate a new set with the updated mix.
Let's start by making a cleaner universe.
Here we have a bunch of white particles initially spread in a circle and without any force applied to them. Notice that at the very beginning the cells in the center push each other until everyone is far enough to not overlap its neighbors. Then nothing more happens...
So let's add our first force: Repulsion!
Now every particle is repulsed by its neighbors, that makes the species covering as much space as needed to have sufficient space between each individual so that no one repulses the other.
Notice that when the population size increases, the particles don't have enough space to have zero neighbors in their attraction radius. That creates clusters where some particles get repulsed into small compact groups. Like in the first example a small universal repulsion force prevents the particles from overlaping when they get too close.
Inversely, we can make particles attract each other.
Here clusters are much bigger and more compact because particles are pulled together into groups, unlike the previous settings where they were pushed against each other into groups. Everything stabilizes once all groups have attracted all the particles in their attraction radius.
With these few examples we described all the possible forces which can exist in our universes. From now on the only parameters we will tweak are how many forces we create in the universes and to whom they apply.
To make all of this more interesting we need to add more particle species that we differentiate with their color. Click to introduce red!
To begin, particles will only actively interact with other particles of the same species. white gets attracted by white but red is repulsed by red.
We find the same white clusters forming as seen before but this time they move through masses of self repulsing red.
Now let's create inter-species attraction! Here red is attracted by white and white is attracted by red but particles don't interact with their own species. This creates filament-like structures which quickly converge into bi-color clusters: Inter-species rules can create more complex structures.
And if we combine inter-species attraction with intra-species repulsion the particles will pave the space trying to get as close as possible to their preferred color while pushing away their siblings.
Now let's add some motion here! If white is very attracted to red but red is strongly repulsed by white we create a thrusting force: When a pair of cells of different colors is close enough the chasing starts! And with enough particles we see waves of white chasing waves of red appearing. While everything looks pretty random we can still clearly see a common pattern.
You can try to restart the simulation with the "Uniform spread" button to observe that the swarm-like patterns still appear.
Let's create some order in this chaos by enabling intra-species attraction: We keep the white-red thrusting force we just created and we add clusters of self-attracting species. We end up with our simplest moving structures!
Look at these small, inefficient white-red organisms moving around their universe and gobbling each other! Since everything is strongly attracted the universe quickly stabilizes as the red-white groups get sufficiently far away from each other.
This is the very beginning of what we want to observe with this tool: Complex behaviors emerging from simple rules.
With only two species we've already seen how simple rules can produce rich behaviors. Adding a third species expands the possibility space: instead of 4 forces to tune, we now have 9. More importantly, the three-way relationships interact in ways that are harder to predict: that's where things get interesting.
The simplest 3-species universes are those where forces quickly find a balance. In the next universe red self-attracts and repels everything around it, while white and green are neutral bystanders. The result: tight red islands floating in a disorganized white-green sea.
When all three species interact with each other, the equilibrium becomes more structured. In the "layered islands" universe everyone is attracted to everyone else, but red weakly repels itself while the others don't. This imbalance causes red to spread into rings around white-green cores, creating repeated layered islands across the universe.
The equilibrium can take a long time to settle. And a balanced repartition of attraction and repulsion allows for a wider spatial repartition.
Here each species self-repels and is attracted to exactly one other in a one-directional chain: white chases red, red chases green, green chases white. Each species is simultaneously a pursuer and a prey, but the cycle is one-sided: the prey doesn't know it's being chased. The resulting tension creates a slow churning motion that takes a long time to resolve into organized territories.
This setup is interesting because sometimes it creates moving structures which completely break the equilibrium, click the button several times to observe both behaviors.
Not all configurations find a stable equilibrium. When inter-species forces conflict -a species chasing another that flees it, all while the third pulls in a different direction- the universe churns in an infinite turbulent state.
Spectacular behaviors can emerge from a fully closed cycle: white chases green, green chases red, red chases white. A classic rock-paper-scissors arrangement. No species ever wins and no equilibrium is found. Instead, the three colors form sweeping waves that rotate across the universe indefinitely.
This is fundamentally different from the chase patterns we saw with two species. There, one color always caught the other and the motion decayed. Here the 3-way cycle means the motion never decays: each pursuer that catches its prey is immediately caught from behind by its own pursuer.
Try adding some self-attraction for a color (for example using +1 for
the white-white force) and observe how
these waves become more structured patterns.
Some 3-species universes converge to surprisingly intricate structures. Here white particles strongly repel each other but are attracted to red, while green also gravitates toward red. red meanwhile pushes both white and green away. This tension resolves very slowly into a repeating mesh - each red particle surrounded at a precise distance by shells of white and green. Watch it for a while to see the structure appearing.
With four species the interaction table has 16 entries. The configurations that produce coherent behavior become rarer and harder to find by chance, but when they do emerge they tend to be more intricate than what three species systems produce. Here are some of the patterns that become possible.
The simplest stable configuration comes from a cyclic repulsion chain: white pushes red away, red pushes green, green pushes blue, blue pushes white. Nobody is attracted to anything. Starting from a central cluster, this expands into organic blobs of paired colors -red-blue regions and white-green regions- separated by empty corridors.
A small change -adding the cross-pair repulsions- makes the separating corridors much thinner. Each color now repels two others instead of one, which tightens the spacing and produces finer, more intricate strip patterns.
A different approach to separation: make one species a universal pariah. white repels all others and all others repel white, while the remaining three are neutral to each other. They cluster into mixed blobs but always leave white-free voids - and white fills those voids, producing hollow white islands enclosed by rings of the other three.
Finally, a case of natural alliances: white and green attract each other and repel red and blue, while red and blue attract each other and repel white and green. Two opposing teams slowly consolidate into larger and larger two-color blobs until the universe settles.
The most complex type of behavior in this simulation. A four-way cyclic chase - white follows blue, blue follows green, green follows red, red follows white- where each pursuer also repels the species behind it. This creates self-maintaining worm-like organisms that travel endlessly, merge when they collide, split when they grow too large, and occasionally fold into spinning rings that absorb passing worms.
A subtler variant of the same cyclic geometry, extended with a mutual attraction between green and blue. The result is not free-roaming worms but rigid crystal filaments - white-green-blue lattices with rivers of red flowing through the channels between them.
Reducing the cohesion of the worm rules produces looser structures: groups that form a single two-color stage before slipping apart and reforming elsewhere. The organisms are shorter-lived but the universe never settles.
Some configurations never settle. Here white is attracted to all three other colors while they all repel white - making white an incessant pursuer and the others its perpetual prey. The result is waves of white sweeping through incoherent masses of red, green and blue that can never outrun their pursuer.
More complex asymmetric rules produce a higher-energy version: many small low-cohesion groups constantly forming, colliding and scattering. No alliance is stable enough to persist, and the universe maintains a perpetual churn.
An interesting hybrid: blue quietly self-attracts into compact, immovable islands while the other three species are locked in a permanent chase. The blue islands act as anchors - the white-red-green turbulence flows around them, occasionally engulfing one before being pushed away again.