Run ECP-Life in your browser — needs WebGPU, so Chrome or Edge. The code is at aprowe/ecp-life.
Particle Life
I find particle life to be a mesmerising example of emergent behaviour. If you haven't seen it, play with it at particle-life.com, or watch Tom Mohr's video that got a lot of people (me included) into it.

It's a fairly simple set of rules. Particles come in multiple hues, and each colour either attracts or repels each other colour. The interesting behaviour comes when particles disagree: A repels B, while B attracts A. This creates a chasing mechanic where pairs will propel themselves across the area.

It looks like little life forms, but that's about it. After playing with it for a while, it can be hard to find new behaviours.
A Continuous Hue
My first thought was: what if, instead of N hues, hue were a continuous interaction spectrum? The hope was that this spectrum could be tweaked at a higher level of detail and bring in more complexity than a discrete matrix. It allows for a wider range of interactions. Hues can have stronger or weaker forms of the same interaction: A attracts B, but a slightly different A attracts B slightly more.

Then, what if we generated that continuous spectrum with a CPPN? Could we run a genetic algorithm to find interesting landscapes?
I do think this experiment revealed some structures of higher complexity, but nothing too novel.
Energy Conserving
The thing that always nagged at me about particle life was the fact that it's not energy conserving. The chase mechanic means free energy for particles, and the sim explodes unless you give it a large amount of damping. This also hurts the search for self-propagating forms. If you have infinite energy, what's driving the selection? If a self-propagating pattern emerges from a simulation where energy is limited, then it's doing something to sustain itself, and we are closer to something life-like.
That free energy comes from the chase mechanic: the asymmetric interactions. Any interaction matrix can be split into a symmetric half and an antisymmetric half. The symmetric half is ordinary physics, an equal and opposite force on the pair. The antisymmetric half pushes both particles the same way, and it's the only thing in the system that does net work.

How can we limit this? This is where the continuous hue comes in. We can consider an asymmetric pair to be high in colour-based potential energy, and a symmetric pair low. Two attractive particles next to each other is the lowest potential energy it could be. All we need to do is change the particles' colour as they accelerate, to pay for the energy put into the system.
This means a chaser in classic particle life will accelerate while slowly changing colour, until it becomes an inert blob of a single colour. Since energy is conserved, we can turn the damping way down and get more nuanced interactions. A simple chaser will die; one that can keep finding ways to replenish its colour energy will sustain itself.

This mechanism also needs to work the other way around. Some of the kinetic energy that would be imparted onto a pair of particles can instead be transferred into its colour energy, which gives it a way to recharge particles. Think of it like regenerative brakes: as an inert pair comes to a stop via an external force, some of that energy goes to the colour store.
The Bonding Well
The last part of this is how we can get larger structures to form in particle life. Classic particle life has a triangle-shaped radial force. This works for interesting movement, but doesn't allow for crystal structures or larger-scale rigidity. By giving our radial force between particles a deep well, we can introduce bonding between particles.

This synergises especially well with the energy conservation, because of the energy that can be stored and transferred in bonds. Repelling pairs can be caught in a bond, storing potential energy; chasing pairs can be small units that spin, or be part of a larger unit.
Current Status
With all these changes, the input space is MASSIVE. I'm still trying to find a decent set of physics that produces consistently interesting interactions. Once I've gotten a handle on that, I would love to start digging into the interaction matrix and find sets of rules that create interesting behaviour. I'm convinced there's a set of interactions out there that will produce something more life-like than we have seen in particle life: something that has a metabolism, using high-energy colours to propel itself in just the right way so it can find more energy to stay alive.
I've built a GPU version using my crate fathom, which runs natively and in the browser from the same code. You can try it now:
- Run ECP-Life in the browser — needs WebGPU, so Chrome or Edge. Left-drag a box around a group and the camera follows its centre of mass; the wheel zooms.
- An overview of the three changes, with a live two-body demo, and the full math.
The code is on GitHub at aprowe/ecp-life.