Skip to content

An evolutionary simulation where steering agents disguised as ants eat food and avoid rotten eggs (poison)

Notifications You must be signed in to change notification settings

thai321/survival-ants

Repository files navigation

Survival Ants

Simulation Demo

simulation

  • Survival Ants is an evolutionary simulation where steering agents disguised as ants eat food and avoid rotten eggs (poison). The concept is based on Steering Behaviors For Autonomous Characters by Craig Reynolds, and its implementation is through genetic algorithms and artificial intelligence.

  • Survival Ants Live

Technologies Used

  • Vanilla JavaScript
  • HTML5 Canvas and CSS
  • P5 JavaScript
  • JQuery
  • HTTP-SERVER

Feature & Implementation

  • Ants:

    • Attributes:
      • Each ant searches for food streeing behaviors using their antennas perception.
      • The ant seeks the closest food in their food range perception.
      • The ant has a health level, which they need to maintain in order to survive
      • The ant has a current velocity(vector) and their acceleration (vector), and it's limited by the maximum speed (number).
      • The ant has a desired velocity:
        • desired velocity = food location - the ant's location
      • The steering behaviors determines how they rotate and approach the food, and it's limited by the maximum force (number):
        • steering = desired - current velocity
    • Death:
      • The ant will die if they eat rotten eggs
      • The ant will die if their health reaches 0
      • The ant turns into food for other ants if they die
    • Clone:
      • The ant has its own DNA which is the unit that determines their food attraction levels
      • There is 0.1% chance that the ant will clone themselves. The new clones DNA is slightly different than the original.
  • Food and Rotten Eggs:

    • Food is randomly generated by a 10% chance of every draw frame
    • Rotten eggs are randomly generated by a 1% chance of every draw frame
    • The ants health levels increase after eating food
    • The ants will die if they hit the poison.
  • User interaction / Mouse functionality

    • User has the ability to drop food and feed the ants by clicking on the food and pressing or dragging on the image.
  • Debug Mode:

    • The triangle represents the ant.
    • The triangle color represents the ant health between green and red
      • green means the ant is healthy
      • red means the ant is in low health, and may die soon
    • The green circle is the ant's food range perception.
    • The green line is the ant's desired magnitute.
  • Auto-Restart:

    • The app is automatically restarted if there are no more ants.

About

An evolutionary simulation where steering agents disguised as ants eat food and avoid rotten eggs (poison)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published