Home▸Algorithms & AI▸Ant Colony Optimization: Top-Down Pheromone Field (2D)

Ant Colony Optimization — Top-Down Pheromone Field

A real top-down Ant Colony Optimization simulation: a pheromone concentration grid that ants deposit along their travelled path and that evaporates over time, with each ant probabilistically steering toward whichever nearby cells smell strongest. Watch the colony's traffic converge onto the near-shortest route between the nest and each food source as trip after trip reinforces it.

Algorithms & AI2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-ants ↗ Open standalone

This is the 2D companion to the 3D Ant Colony Pheromone Trails simulation: the same stigmergic algorithm, viewed from directly above as a live pheromone concentration field instead of a rendered diorama. A grid of cells covering the whole field tracks two pheromone quantities — one trail marking the way to food, one marking the way home — which every ant deposits as it moves and which decay exponentially over time. Ants searching for food steer probabilistically toward the strongest nearby "to food" scent; ants carrying food steer toward the strongest "to home" scent. No ant ever measures or compares distances directly, yet because a short round trip reinforces its trail more often per second than a long one, the colony's traffic reliably converges onto a near-shortest path between the nest and each food source. Add or remove food sources with a click to watch the colony re-route in real time.

⚙ Under the hood

A 2D companion to the 3D Ant Colony Pheromone Trails simulation: a real top-down Ant Colony Optimization engine with a pheromone concentration grid that ants deposit along their travelled path and that evaporates exponentially over time. Each ant probabilistically steers toward whichever forward/left/right sensor cell smells strongest, converging colony traffic onto a near-shortest route between the nest and each food source as trips accumulate. Add or remove food sources with a click and watch the average round-trip length fall in the live strip chart.

ant colony optimizationACO algorithmpheromone trailstigmergyswarm intelligenceshortest pathprobabilistic steeringcanvas 2d

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)