Clever Quest Lab ← Labs

Particle Life

Coloured particles that attract or repel each other by a simple rule table. Edit the table and watch clusters, chasers and cell-like shapes appear.

0Particles
0FPS
0ms / step
0Avg speed

Pointer
Presets

Rule matrix

Each row is a colour reacting to the colour in each column. Row Red, column Orange = how Red particles feel towards Orange ones. Green attracts, red repels, a stronger colour means a stronger pull or push. Tap a cell to edit it.

repel attract

Selected: – 0

Settings

Favourites

    Saved worlds appear here (up to 8, kept in this browser).

    How to play

    This is a sandbox with no score. A world starts running as soon as the page loads. Pick a preset, or press New rules to roll a random world, and watch what the colours do to each other. Then open the rule matrix and change a single cell: make red stop fleeing from orange, or turn a self-attraction on, and the whole pattern changes within seconds. When you find a world you like, press Copy link to share it or Save current to keep it.

    Controls

    How the simulation works

    Every particle has a colour. For each pair of particles closer than the interaction radius rmax, the colour of the first one and the colour of the second one look up a number a between −1 and +1 in the matrix. A positive number means “I am attracted to that colour”, a negative one means “I flee from it”. With r as the distance divided by rmax and β as the repulsion core, the force that a neighbour exerts is:

    r < β force = r / β − 1 (always pushes apart, strongest at r = 0) β ≤ r < 1 force = a × (1 − |2r − 1 − β| / (1 − β)) (peaks halfway, zero at both ends) r ≥ 1 force = 0

    The short-range part is the same for every pair, so particles never collapse into one point. Beyond it, the matrix decides. Each step the forces from all neighbours are added up and the velocity is updated with friction, then the position:

    v ← v × 0.5^(dt / half-life) + (sum of forces) × dt position ← position + v × dt

    The half-life is the time friction needs to halve a velocity. A short half-life makes the world thick and slow, a long one makes it slippery and energetic. The time step is fixed, so the result does not depend on your screen’s refresh rate. To stay fast with thousands of particles, the world is cut into a grid of cells as wide as rmax, so each particle checks only nine cells. With wrapping edges the world is the surface of a doughnut.

    Why the matrix is not symmetric

    If red pulls on orange exactly as hard as orange pulls on red, the forces are equal and opposite and the system calms down: friction eats the energy until clusters sit still. In this model the two numbers are independent. When red is attracted to orange but orange is repelled by red, red chases and orange runs. Newton’s third law is broken on purpose, so energy is constantly injected and the particles keep moving. Real forces do not behave like this, so treat it as a toy.

    Emergence and “life”

    No particle knows about a cluster, a membrane or a chase. Each one only reacts to neighbours within a short distance, yet shapes appear that hold together, move, split and merge. That is emergence: large-scale patterns that exist only in the interaction of many simple parts. Calling them alive is a metaphor. There is no metabolism, reproduction or evolution here; the patterns are just stable solutions of the force rule. It builds intuition for how complexity arises from simplicity and is not a model of biology.

    Things to try

    1. Press Zero. Only the repulsion core is left, so the particles spread out evenly and the average speed falls to nearly nothing.
    2. Give one colour a self-attraction of about 0.6 and leave everything else at zero. Clumps of that colour form.
    3. Press Symmetric random a few times. Compare the calm result with Randomise, where motion keeps going.
    4. Take the Chasers preset and flip one chase around with the matrix slider.
    5. Raise the repulsion core β and watch the clusters become looser and more liquid.
    6. Switch on trails and glow with a few hundred particles to paint their paths.
    7. Find a world you like, copy the link, open it in another tab and check that it is identical.

    Frequently asked questions

    What does the seed do?

    Random rules and starting positions come from a seeded random number generator, so the same seed always gives the same matrix and the same starting layout. The link also contains the matrix itself, so edited rules are shared as well.

    Why do many random worlds look boring?

    Most random matrices end in a few static blobs or in pure noise. Interesting worlds are a small fraction, which is why the presets and the share link are useful. Keep the ones you like with Favourites.

    How many particles can my device handle?

    Most computers handle 2,000 or more comfortably. On phones the limit is lower. If the page gets slow it lowers the count for you; you can also reduce the interaction radius, which cuts the work for every particle.

    What is the difference between wrap and walls?

    With wrap, particles leaving one edge appear on the opposite edge and also feel forces across it. With walls they bounce back and the world has a real border.

    More free games