Stigmergy
Coordination written into the environment. Agents leave traces or reshape material; later agents read those changes and alter their paths in turn. Routes and ridges can form without anyone holding a colony map, while decay and diffusion keep the past from freezing into permanence
The idea
Coordination written into the environment. Agents leave traces or reshape material; later agents read those changes and alter their paths in turn. Routes and ridges can form without anyone holding a colony map, while decay and diffusion keep the past from freezing into permanence.
Science and concept
Pierre-Paul Grassé introduced the term stigmergy while studying termite construction. The core idea is that one action leaves a modification in the environment, and that modification becomes a stimulus for subsequent action. Coordination can therefore occur without direct messaging between the agents performing the coordinated work.
A compact causal loop is
action → environmental trace → altered local stimulus → later action.
The environment is not passive background. It stores information in a form that can outlive the agent that produced it.
Theraulaz and Bonabeau later distinguished quantitative stigmergy, where the intensity or quantity of a stimulus changes the probability of an otherwise similar action, from qualitative stigmergy, where different environmental configurations elicit different kinds of action. Pheromone reinforcement is the clearest quantitative example; staged nest construction can involve qualitative changes in what should be built next.
AL.Floys primarily demonstrates quantitative feedback. In foraging mode, each agent carries only position, heading and a Boolean state: searching or carrying food. It samples scalar fields ahead-left, ahead and ahead-right, turns toward the strongest signal, moves, and deposits another signal at its new location.
There are two main trail fields:
- Home signal, deposited while an agent is searching outward.
- Food signal, deposited while an agent is carrying food home.
A searching agent follows the food signal and also senses nearby food amount directly. A carrying agent follows the home signal and receives an additional direct directional bias toward the nest. The state switch at food pickup reverses which field it follows and which field it deposits.
This creates a two-way route without any agent storing the route itself. Outbound searchers leave information useful to returning agents; returning agents leave information useful to future searchers.
The model should nevertheless not be described as purely stigmergic. Three additional mechanisms help the route form:
- searching agents directly sense the local food-amount field;
- carrying agents receive an explicit vector bias toward the nest;
- reset seeds a home halo, weak food-trail hints and optional silent warmup steps.
The emergent corridor is therefore produced by field feedback plus designed orientation and bootstrap signals. The broad principle remains stigmergic, but implementation truth requires naming the supplements.
Positive feedback explains route amplification. Suppose one path is used slightly more often because of chance or geometry. More agents deposit signal there. The stronger field attracts still more agents, who reinforce it further. Small initial differences can become colony-scale route preference.
Positive feedback alone would create permanent lock-in and saturated fields. The engine therefore includes two counter-processes.
Diffusion spreads signal into nearby grid cells through a blended 3×3 box blur. This makes a trail perceptible as a corridor rather than a one-cell wire, but excessive diffusion removes directional contrast.
Decay multiplies the field by a retention factor after each blur. The current parameter named pheromoneDecay is semantically a per-step retention multiplier. A value of 0.995 preserves more signal than 0.885; increasing it makes memory longer, not decay faster.
This is a public-contract problem. The current simple label Field decay invites the opposite interpretation. It should be renamed Field retention or transformed so the slider exposes a true decay rate such as (1-r).
The combination of reinforcement and forgetting produces adaptive memory. A trail persists long enough to recruit others but eventually weakens when no longer used. Blocking a route can redirect traffic because unused signal fades while alternative paths receive new deposits.
The familiar shortest-path effect arises from feedback and travel time. If two routes connect nest and food and agents move at similar speed, the shorter route can be completed more often per unit time. It therefore receives reinforcement more frequently and may come to dominate.
This is not a mathematical shortest-path solver with a guarantee. Random initial placement, direct food sensing, nest attraction, toroidal geometry, field diffusion and stochastic turning all affect the outcome. The preset Shortest Path should be explained as self-organised route competition that often favours a shorter corridor, not as proof of optimality.
The 1989 Argentine-ant experiment by Goss and colleagues is a canonical biological reference. Ants initially faced equal branches around an obstacle; one branch was later made shorter. Collective trail reinforcement led the colony to reorganise toward the shortcut. The result demonstrated that decentralised local recruitment can produce adaptive route selection.
AL.Floys makes adaptation directly testable because the visitor can paint obstacles into an established trail. Agents do not receive a global notice that the route is closed. Local collisions turn them away, new exploratory paths receive deposits, and old signal decays.
The world is toroidal. Agents and fields wrap across opposite edges. This removes hard outer walls, but it also means a path crossing the screen boundary may be locally short in the simulated topology. “Shortest” must always be interpreted in the wrapped world, not on the visible rectangle as a conventional sheet.
The Wander mode removes initial food sites but retains a nest, home signal and nest-directed return dynamics. Agents explore and leave fields without a fixed foraging task. Visitors can later paint food. It is useful for seeing exploration and trace formation before route competition becomes dominant.
The Construction mode returns to the concept’s termite origins but through a deliberately abstract mechanism. Agents move across a smooth random substrate and sense two fields: existing material and a transient build signal. They deposit build signal at their location, with deposit strength modulated by substrate. When local build signal exceeds a threshold, the engine converts part of it into persistent material.
A simplified local rule is
Compact form: B( x)>T \quad\Rightarrow\quad M( x)\leftarrow M( x)+\Delta M, \qquad B( x)\leftarrow 0.38 B( x),
where (B) is build signal, (T) the threshold and (M) material. Material then slowly erodes and diffuses.
The ridges are therefore not assembled pellet by pellet by anatomically realistic termites. They are thresholded scalar-field accretions guided by existing material and substrate heterogeneity. The scientific value is the general mechanism: transient local activity can become a persistent environmental structure that biases future activity.
Construction does not begin from a blank plate. Reset seeds material nuclei and curved ridge scars, then runs silent warmup steps. This makes the mode readable immediately but means the first visible ridges were not all generated during the visitor’s observed run. The report should treat them as bootstrap conditions, not spontaneous first-frame emergence.
This distinction between transient and persistent environmental state is fundamental. Pheromone-like fields fade quickly. Material fades slowly. A shared environment can therefore support multiple timescales of collective memory.
The engine’s visual trail persistence is separate again. It controls how long prior canvas drawings remain visible. It does not alter home or food signal. Because both controls concern “trails,” the UI should label them unambiguously:
- Field retention — dynamic memory used by agents.
- Display trail hold — visual persistence used by the renderer.
The system also illustrates distributed information compression. No stored object says “this is the best route.” Instead, the scalar field integrates many recent journeys into a local gradient. The colony-level history is compressed into something each agent can sample with three sensors.
That environmental memory is robust but lossy. It does not preserve who travelled, why they travelled or an exact chronology. It stores only local signal intensity after diffusion and decay. Stigmergic coordination often works precisely because the environment retains the operationally relevant residue rather than a complete record.
History
Grassé coined stigmergy in 1959 while analysing how termites reconstruct a nest. The puzzle was that individuals appeared to work independently while the colony produced coordinated structures. Grassé proposed that work already performed altered the local stimulus for subsequent work.
The idea initially belonged to social-insect ethology, especially construction. Later research extended it to trail recruitment, sorting, collective choice and artificial systems.
In 1989, Simon Goss, Serge Aron, Jean-Louis Deneubourg and Jacques Pasteels reported self-organised shortcuts in the Argentine ant. Their experiment showed that pheromone-mediated route choice could reorganise when path geometry changed. It remains one of the clearest empirical demonstrations of positive feedback, environmental memory and adaptive route selection.
During the 1990s, Eric Bonabeau, Guy Theraulaz, Deneubourg and collaborators developed a wider theory of self-organisation in social insects. Their work emphasised amplification, multiple interactions, positive feedback, negative feedback and fluctuations rather than a hidden colony controller.
Theraulaz and Bonabeau’s 1999 “A Brief History of Stigmergy” consolidated the concept and distinguished quantitative from qualitative forms. It also clarified that stigmergy is a class of mechanisms mediating animal–animal interaction through environmental consequences.
Computer science translated the same principles into optimisation. Marco Dorigo and colleagues’ ant-system algorithms used artificial pheromone reinforcement to construct solutions to combinatorial problems. This lineage is relevant but should not replace the biological origin. ecospheres.ai models mobile agents and spatial fields, not a general-purpose optimiser.
The correct historical sequence is:
termite construction and environmental stimulus → ant trail experiments and self-organisation → general stigmergic theory → algorithmic adaptation
AL.Floys combines the first two biological motifs—construction and foraging—inside one deliberately synthetic field system.
What this simulates
| Aspect | Current implementation |
|---|---|
| Entities / field | Mobile point agents plus raster fields for home signal, food signal, food amount, food-site mask, obstacles, substrate, build signal and material. |
| Agent state | Position, heading and a Boolean carrying state. No individual route memory or identity-dependent policy. |
| Sensing | Three forward-offset samples—left, centre and right—of the relevant scalar fields. |
| Foraging update | Searchers follow food signal and local food; carriers follow home signal plus explicit nest direction; pickup/delivery toggles carrying state. |
| Field update | 3×3 toroidal blur blended with current value, followed by multiplicative retention. |
| Construction update | Agents sense material/build fields, deposit build signal, threshold it into persistent material, then material erodes and diffuses. |
| Initial conditions | Seeded nest and food sites; home halo and food hints; construction nuclei and ridge scars; optional silent warmup. |
| Boundary conditions | Toroidal for agent movement, sensors and fields. |
| Randomness | Seeded layout, heading, turn noise, spawning and obstacle response. |
| Resource dynamics | Food is locally drained on pickup; optional respawn can refill depleted food sites. |
| Rendering interpretation | Field colour, glow, agent marks, nest/food overlays and canvas trail hold. Canvas persistence is not sensed by agents. |
| Public simple controls | Mode, Agents, Agent speed, Field decay and Trail hold. |
| Public tools | Spawn, Force, Brush and Erase, with mode-specific brush targets. |
| Known semantic issue | Field decay is actually a retention factor: a higher value produces slower decay and longer memory. |
The most truthful one-line description is: agents coordinate through diffusing, fading and sometimes materialising environmental traces.
What to look for
Trail amplification — chance becomes collective preference
Several faint routes may leave the nest at first. One corridor receives slightly more traffic, becomes stronger and attracts still more agents. A population-level decision emerges from recursive reinforcement.
Route competition — alternatives suppress one another indirectly
Agents are not voting. A stronger route captures more traffic, leaving less deposition on alternatives. The winner changes the information landscape that future agents perceive.
Shortcut adaptation — the field can revise its own history
Paint an obstacle across a dominant path. Agents scatter locally, exploratory routes form, and the unused blocked segment fades. Memory is persistent enough to coordinate but temporary enough to be replaced.
State-dependent deposition — one body participates in two information flows
A searching agent deposits home signal; after pickup, the same agent follows home signal and deposits food signal. Behaviour changes through a one-bit internal state rather than a global role assignment.
Depletion and abandonment — reward maintains the signal
When a food site is exhausted and respawn is off, successful return traffic falls. Without continued reinforcement, its trail decays and the colony shifts elsewhere.
Diffusion versus discrimination — a corridor can become too vague
Some diffusion makes a robust navigable gradient. Excessive diffusion spreads signal until left, centre and right sensors see similar values, weakening directional information.
Environmental memory — the route exists outside the agents
Erase or remove many agents while leaving fields intact. New agents can still enter the old corridor. The operational memory is in the environment, not in individual travellers.
Construction threshold — repeated weak action becomes durable structure
In Mound Seeds, build signal accumulates until it crosses a threshold and becomes material. The visible ridge marks a change of timescale from transient activity to longer-lived environmental modification.
Erosion and repair — persistence is negotiated
Material slowly fades. Continued traffic can reinforce a ridge; abandoned structures erode. Construction is maintained by activity rather than guaranteed permanence.
How to explore
First 30 seconds
- Load Shortest Path.
- Identify the nest, two food sources, searching agents and carrying agents.
- Follow one route until you can see a dominant corridor rather than isolated trajectories.
- Open Steer, choose Brush, select Obstacle, and draw a narrow barrier across the strongest trail.
- Stop drawing. Watch local deflection, the search for alternatives and the delayed fading of the blocked corridor.
- Use Erase lightly on one part of the old signal field and compare immediate deletion with natural decay.
- Load Mound Seeds to see the same environmental-coordination principle produce persistent material instead of a commuting path.
Three experiments
| Experiment | Question | Do | Watch for | Why it matters |
|---|---|---|---|---|
| Memory and rerouting | Can a decentralised system revise an established route? | Shortest Path → paint an obstacle across the dominant corridor → wait without further intervention. | Local congestion, exploration, alternative reinforcement and decay of the abandoned trail. | Demonstrates adaptive environmental memory without global replanning. |
| Retention window | What happens when the environment remembers too little or too much? | Hold preset and population fixed → move the current Field decay value low, then high. Note that higher currently means greater retention. | Fragmented weak trails at low retention; persistent, possibly stale or saturated fields at high retention. | Reveals the balance between coordination and adaptability—and exposes the label inversion. |
| Trace versus structure | How can the same principle coordinate movement and construction? | Compare Shortest Path with Mound Seeds. In construction, brush Build signal in one area and leave another untouched. | Transient route fields versus thresholded persistent ridges. | Connects ant-trail and termite-construction meanings of stigmergy. |
A fourth experiment is to load Wander Colony, observe unconstrained exploration, then paint a new food patch. The visitor can watch a task-specific route emerge from a previously diffuse trace field.
Parameters that teach
| Parameter | What it really controls | Increase it | Decrease it | What to watch |
|---|---|---|---|---|
| Mode | Selects forage, food-free wander or construction; structural. | Not scalar. | Not scalar. | Different environmental traces and goals under one coordination principle. |
| Agents | Population contributing to and sampling the fields; structural. | Faster deposition, denser traffic and possible saturation. | Slower collective signal and more stochastic route formation. | Time to consensus and congestion. |
| Agent speed | World-space movement per second. | Faster route traversal and reinforcement cycles. | Slower, easier-to-follow individuals. | Path competition timescale; not intelligence. |
| Field decay (current label) | Actually a multiplicative field-retention factor. | Longer memory and slower decay. | Shorter memory and faster forgetting. | Rename to Field retention or invert the value. |
| Deposit (advanced) | Signal added per passage. | Faster reinforcement and saturation. | Weaker, noisier corridors. | Positive-feedback gain. |
| Diffusion (advanced) | Spatial spreading of field each step. | Broader, smoother gradients. | Sharper but more fragile trails. | Corridor width versus directional contrast. |
| Sensor distance (advanced) | Forward offset of field samples. | Longer-range anticipation. | More local reaction. | Corner cutting, oscillation and obstacle response. |
| Sensor angle (advanced) | Angular separation of left/right sensors. | Wider search cone. | Narrower forward focus. | Turning stability and branch choice. |
| Sensor gain (advanced) | Strength of steering response to field differences. | More decisive field following. | More wandering/noise influence. | Lock-in versus exploration. |
| Turn noise (advanced) | Random heading perturbation. | More exploration and route discovery. | More deterministic following. | Ability to escape stale corridors. |
| Food sites / pile (forage; reset-bound) | Number and initial amount of resource patches. | More alternatives or longer-lived reward. | Fewer choices or quicker depletion. | Competition and trail abandonment. |
| Nest pull (advanced) | Direct orientation bias toward nest for carriers. | More reliable return independent of field. | Greater reliance on home signal. | This is non-stigmergic assistance. |
| Food respawn (advanced; reset-bound) | Whether depleted sites refill. | Sustains long-run commuting. | Allows genuine site exhaustion. | Persistent versus disappearing routes. |
| Build deposit (construction) | Transient build signal added by agents. | Faster threshold crossing. | Slower accretion. | Nucleation and ridge growth. |
| Build threshold (construction) | Signal required to convert activity into material. | Rarer, more selective materialisation. | Easier widespread accretion. | Sparse ridges versus blanket growth. |
| Erosion (construction) | Loss rate of persistent material. | Faster forgetting of structure. | Longer-lived ridges. | Maintenance and repair. |
| Trail hold (visual) | Persistence of previous canvas drawings. | Longer visible motion traces. | Cleaner current field. | It must not be confused with dynamic field retention. |
The scientifically strongest simple control is environmental memory, but the current label must be corrected before it can serve as a clean teaching instrument.
Presets as experiments
Wander Colony
No initial food sources. It isolates exploration, nest-related movement and field formation. The colony still has a nest and home-trail dynamics, so “wander” does not mean unconstrained Brownian motion.
Shortest Path
The best introduction. Two food sources and strong feedback make route competition legible. Use “shortest-path tendency” or “shortcut reinforcement,” not guaranteed optimisation.
Forked Forage
More food clusters create competing recruitment fronts. It is useful for watching a distributed system divide traffic among alternatives and later abandon depleted sites.
Pheromone Storm
High diffusion, faster forgetting and dense population produce luminous abstract fields. It is a limit case for showing that more signal activity can reduce route clarity.
Mound Seeds
Construction mode with preseeded nuclei, ridge scars and warmup. It is the best entry to Grassé’s original construction context, provided the bootstrap conditions are disclosed.
Night Colony
A presentation-focused foraging regime with long visual trail hold and strong glow. It is useful for legibility but should not be treated as a new behavioural model.
Recommended learning order: Shortest Path → Wander Colony → Forked Forage → Mound Seeds → Pheromone Storm → Night Colony.
Interactions
- Spawn truly adds agents around the pointer, up to the engine cap. New agents begin not carrying food.
- Force rotates nearby agents toward or away from the pointer. It changes headings but does not directly alter signal fields.
- Brush is mode- and target-dependent:
- forage/wander: add food, home signal, obstacle or food signal;
- construction: add build signal, substrate, obstacle or material.
- Erase attenuates all local scalar fields, reduces food and construction material, probabilistically clears obstacles, and removes agents in the pointer radius.
- Obstacle painting changes the environment, making it the most conceptually faithful intervention for a stigmergic experiment.
- Painting pheromone or build signal is an external injection of environmental information, not an action performed by the simulated colony.
The interface is unusually powerful here because the visitor can intervene at three levels: population, agent heading and shared environment.
What this does not mean
The agents are not anatomically or cognitively realistic ants or termites. They have no vision model, body, collision geometry, fatigue, age, communication repertoire, learning, social role or individual route memory.
The fields are abstract scalar signals, not calibrated chemical concentrations. Diffusion is a local box blur; decay is multiplicative retention; deposition units are arbitrary.
Foraging is not purely indirect. Searchers directly sense food amount, carriers receive a nest vector, and reset seeds trail hints and warmup dynamics.
A dominant trail is not guaranteed to be the mathematical shortest path. It is an outcome of stochastic exploration, reinforcement, direct biases, toroidal distance and field parameters.
Construction is not a mechanistic termite-building model. Agents deposit a build signal; thresholded cells become material. There are no pellets, gravity, structural mechanics, humidity, airflow or termite morphology.
The visible canvas trail is not necessarily the field agents sense. Dynamic fields and renderer persistence are separate layers.
Initial patterns are not wholly unseeded. Foraging begins with field hints; construction begins with nuclei and ridge scars; warmup hides early transients.
The strong conclusion remains:
A population can coordinate through local environmental traces without any agent representing the collective plan.
Why it belongs
Stigmergy contributes the environment as shared memory and communication medium. Flock coordinates through direct neighbour observation. Stigmergy lets agents separated in time influence one another through traces. It also introduces a bridge from behaviour to architecture: repeated transient actions can become a persistent world that channels the next generation of action.
Sources
Foundational and primary sources
- Pierre-Paul Grassé, “La reconstruction du nid et les coordinations interindividuelles chez Bellicositermes natalensis et Cubitermes sp. La théorie de la stigmergie,” Insectes Sociaux 6, 41–80 (1959). DOI: 10.1007/BF02223791.
- Simon Goss, Serge Aron, Jean-Louis Deneubourg and Jacques M. Pasteels, “Self-Organized Shortcuts in the Argentine Ant,” Naturwissenschaften 76, 579–581 (1989). DOI: 10.1007/BF00462870.
- Eric Bonabeau, Guy Theraulaz, Jean-Louis Deneubourg, Serge Aron and Scott Camazine, “Self-Organization in Social Insects,” Trends in Ecology & Evolution 12, 188–193 (1997). DOI: 10.1016/S0169-5347(97)01048-3.
- Guy Theraulaz and Eric Bonabeau, “A Brief History of Stigmergy,” Artificial Life 5, 97–116 (1999). DOI: 10.1162/106454699568700.
- Marco Dorigo, Vittorio Maniezzo and Alberto Colorni, “Ant System: Optimization by a Colony of Cooperating Agents,” IEEE Transactions on Systems, Man, and Cybernetics, Part B 26, 29–41 (1996). DOI: 10.1109/3477.484436.
Modern scientific context
- Scott Camazine et al., Self-Organization in Biological Systems (Princeton University Press, 2001). Broad synthesis of amplification, feedback and decentralised collective behaviour.
- David Sumpter, Collective Animal Behavior (Princeton University Press, 2010). Useful modern framework for individual rules and group-level outcomes.