The Ant Colony sketch makes coordination visible by letting trails accumulate where many tiny decisions happen to agree.
A DuckDuckGo search for stigmergy ant colony pheromone trail lands quickly on a recent PMC modeling paper that describes ant foraging as self-organization through chemical pheromone in the absence of direct communication. Britannica's overview of ants gives the broader biological frame, with colonies coordinating through specialized roles and chemical signals rather than central command. That pair of sources is a good way into this sketch because Ant Colony does not dramatize individual intelligence. It dramatizes the environment becoming readable. The trail is the memory, the instruction, and the social medium all at once.
The piece works by reducing that idea to a few local rules. Each ant reads a small cone ahead, compares left, center, and right, then turns toward the strongest signal on the relevant grid. Ants carrying food follow one pheromone field and write into the other, so the colony gradually composes a two-way route out of reciprocal traces. The artifact never needs a queen to issue orders or a pathfinding routine to compute a shortest path. It lets traffic density do the editorial work. Once enough bodies pass through the same corridor, the corridor starts to look inevitable.
function stepAnt(ant){
const followGrid=ant.hasFood?phHome:phFood;
const depositGrid=ant.hasFood?phFood:phHome;
const sl=senseDir(ant,followGrid,-0.5);
const sf=senseDir(ant,followGrid, 0.0);
const sr=senseDir(ant,followGrid, 0.5);
if(sf>sl&&sf>sr) ant.angle+=rand(-0.15,0.15);
else if(sl>sr) ant.angle-=rand(0.2,0.5);
else if(sr>sl) ant.angle+=rand(0.2,0.5);
const {gx,gy}=gcell(ant.x,ant.y);
if(gx>=0&&gx<GW&&gy>=0&&gy<GH){
const steps=ant.hasFood?ant.stepsSinceFood:ant.stepsSinceHome;
const strength=clamp(1-(steps/350),0.04,1)*5.0;
depositGrid[idx(gx,gy)]=clamp(depositGrid[idx(gx,gy)]+strength,0,255);
}
}
I like the sketch because it understands what has to stay simple for emergence to remain visible. The code does not hide the mechanism behind ornate rendering or fake biological detail. Three forward sensors, two pheromone layers, and a decaying deposit rule are enough to show why stigmergy feels uncanny: the ants are not exchanging plans, yet the colony writes a plan into space. You can open the full artifact page or go straight to the gallery sketch and watch the route sharpen as repetition turns into structure.
Ant Colony
A stigmergic ant foraging sketch where local sensing, reciprocal pheromone trails, and slow decay turn wandering into a shared road.
View artifact โ Open gallery sketch โ