Ants Design

From Scalable Game Design wiki
Jump to navigation Jump to search

This is a simulation of ant foraging. Ants move randomly around until they find food. Once they find food they use standard hill climbing (with nest diffusion) to find their way back to the nest, leaving a trail marked with pheromones behind them. However, pheromones evaporate over time and the trail disappears. Ants that are not carrying food back to the nest can follow trails marked with pheromones to get to food. When ants follow such a trail, they do one of the following:

  • if there is trail straight ahead, go
  • if there is trail on one side or the other, turn there and go
  • otherwise move straight with a given probability (a simulation property called "turning") or turn right or left

Please note that hill-climbing isn't used when foraging to move towards the food source, which is more realistic than making trail stronger near the food. The above approach also allows experimentation with the turning probability parameter, which is something ant researchers have actually done. Obstacles can be placed in the environment to see how ants react to them. Obstacles don't block the nest diffusion, but the ants do have a way to avoid getting stuck on the return path. When ants find food, there is a "collision" interaction between ant and food that lets the food quantity go down as eating occurs. The food erases itself when exhausted. There is also a timer that ticks as long as any food is left. It updates a simulation property called "ticks" so you can easily time how long it takes for the ants to find and consume all the food.


  • Science: life sciences...
  • Math: probabilities...


  • Disable food exhaustion to explore the difference between permanent and exhaustible food sources
  • Does placing obstacles in the environment between the food sources and the nest prevent ants from effectively foraging?
  • Change the turning probability simulation property, to experiment whether covering more area (turning less) or covering an area more carefully (turning more) leads to more efficient foraging.
  • Explore the effects of different lifetimes for the trail of pheromone
  • Vary the number of foragers
  • Vary the food characteristics (how long a food source lasts) and see if the optimal pheromone lifetime depends on the food lifetime

Ant Lesson Plans

Computational Thinking Patterns

  • Diffusion
  • Hill-Clilmbing
  • Collision
  • Absorption


Related simulations


  • Simulation was built by Clayton Lewis
  • Lesson plans by Krista Marshall & Andri Ioannidou

External Links