Particle Life Sandbox
A particle life simulator: up to 2,000 particles of 1 to 8 species move in a flat world, and every pair closer than the interaction radius pulls or pushes according to an attraction matrix you edit cell by cell, from -1 to 1, with a short-range push that keeps particles from piling onto one point. Force scale, interaction radius, friction, timestep and wrapping or repelling edges apply the moment you change them, and brushes add or erase particles at any time and attract or repel them while it runs or steps. Layouts are scattered from a seed and stepping uses no randomness, so the same project steps the same way every time. The numerical limits are on the page: the timestep, the kinetic energy and the largest move of the last step are shown under the canvas, and a step that would move any particle farther than the interaction radius stops the run with a message naming the particle and the distance instead of letting the numbers run away. Download project saves the whole sandbox as a JSON file that Open project restores.
Your input
Result
600 particles of 3 species, world 800 by 600 with wrapped edges, step 0, paused. Teal 200, amber 200, plum 200. Kinetic energy 0.0 (model units, mass 1 per particle). Most crowded ninth of the world: bottom center, 82 particles; emptiest: top center, 56.
| moves / to | teal | amber | plum |
|---|---|---|---|
| teal | |||
| amber | |||
| plum |
- Particles
- 600
- Species
- 3
- Kinetic energy (model units)
- 0.0
- Timestep
- 0.01
- Largest move last step
- 0.00 of 80 allowed
- Step
- 0, paused
The canvas in numbers
These tables follow the simulation: they refresh a few times a second while it runs and after every step or edit.
| Species | Particles | Mean speed | Kinetic energy |
|---|---|---|---|
| 1, teal | 200 | 0.0 | 0.0 |
| 2, amber | 200 | 0.0 | 0.0 |
| 3, plum | 200 | 0.0 | 0.0 |
| rows | Left | Center | Right |
|---|---|---|---|
| Top | 58 | 56 | 61 |
| Middle | 76 | 62 | 68 |
| Bottom | 66 | 82 | 71 |
Worked cases
Click, drag or touch the canvas to use the brush. With a keyboard, Tab to the canvas, move the cursor with the arrow keys (hold Shift for 50 units a press instead of 10) and press Enter or Space: Add places 12 particles of the chosen species inside the brush radius, Erase removes every particle inside it, and Attractor or Repeller switches on at the cursor, follows the arrow keys, and goes off with Enter, Space or Escape. A held attractor or repeller acts only while the sandbox runs or steps. On a device that asks for reduced motion the sandbox opens paused.
Common questions
- What is particle life?
- An artificial-life toy in which particles of a few species follow one simple pair rule: each pair closer than a set distance pulls together or pushes apart by an amount that depends only on the two species. Here the rule is a matrix you edit. Inside the core, the first 30% of the interaction radius, every pair pushes apart, hardest at contact; beyond it the matrix value takes over, rising from 0 to its full value at 65% of the radius and back to 0 at the radius. From those local rules the particles can settle into clumps or keep chasing one another in moving groups that nobody drew.
- How do I read the attraction matrix?
- Each row is the species that moves and each column is the species it reacts to. A positive value pulls the row species toward the column species, a negative value pushes it away, and the range is -1 to 1. The matrix does not have to be symmetric: if teal is drawn to amber while amber flees teal, teal chases amber. The Chase ring preset sets that up for every species at once: with three or more species, each gets 0.6 toward the next species, -0.6 from the previous one and 0.3 toward its own kind; with two species, teal gets 0.6 toward amber, amber gets -0.6 from teal and each gets 0.3 toward its own kind.
- What do friction and timestep change?
- Friction is the share of each particle's velocity removed on every step, from 0 (none) to 1 (all of it). The timestep, from 0.001 to 0.1, sets how far one step moves the simulation on: each step adds acceleration times the timestep to the velocity, then moves each particle by velocity times the timestep. A larger timestep runs faster but is coarser, and with low friction and a strong force it can make particles overshoot.
- Why did the simulation stop with an error?
- Because a step would have moved a particle farther than the interaction radius, or produced a value that is not a finite number. At that point the model can no longer follow the pulls and pushes it is meant to show, so the step is refused, the run pauses at the last good step, and the message names the particle, the timestep and the force scale, and for a runaway how far the particle would have moved. Lower the timestep or the force scale, or raise friction, then press Step or Play.
- Does the same seed give the same result?
- Yes for everything the page decides. A layout's positions come from its seed, the Seeded random preset draws its matrix from the seed, and stepping itself uses no randomness, so the same project steps to the same positions every time. Particles you add with the brush are placed by a generator whose state is saved in the project. What the seed cannot repeat is your own hand: a stroke or a held attractor acts at whichever step you make it.
- Can I save a setup or copy the matrix?
- Download project saves a JSON file with the matrix, the rules, the seed, the brush generator's state, the step count and every particle's species, position and velocity, and Open project loads it back paused at that step. A file that is not a valid project is refused with the reason and your current sandbox stays as it was. Copy matrix copies the matrix as tab-separated rows with species names. Once you change something, this browser also keeps your latest sandbox and reopens it paused on your next visit.
- Can I use it with a keyboard or a screen reader?
- Yes. Every setting and matrix cell is a labelled field. Tab to the canvas, move the brush cursor with the arrow keys (10 units a press, 50 with Shift) and press Enter or Space: Add places 12 particles of the chosen species inside the brush radius, Erase removes every particle inside it, and Attractor or Repeller switches on at the cursor and off again with Enter, Space or Escape. Below the canvas a text summary and two tables give the particle count per species, their mean speed and energy, and how many particles sit in each ninth of the world.
- Is this a physics or chemistry simulation?
- No. The units are made up, the pulls in a pair need not be equal and opposite, and any friction above 0 drains energy on every step, so it models no real molecule, cell or material and predicts nothing about one. It is a sandbox for seeing how simple local rules can produce patterns.
An illustrative artificial-life model; no molecular, biological or physical prediction claim. Numerical limits and timestep are visible.