-
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.
- Vanilla JavaScript
- HTML5 Canvas and CSS
- P5 JavaScript
- JQuery
- HTTP-SERVER
-
Ants:Attributes:- Each ant searches for food
streeing behaviorsusing their antennasperception. - The ant
seeksthe closest food in their food rangeperception. - The ant has a health level, which they need to maintain in order to survive
- The ant has a
current velocity(vector)and theiracceleration(vector), and it's limited by themaximum speed(number). - The ant has a
desiredvelocity:- desired velocity = food location - the ant's location
- The
steering behaviorsdetermines how they rotate and approach the food, and it's limited by themaximum force(number):steering=desired-current velocity
- Each ant searches for food
- 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
DNAwhich is the unit that determines theirfood attractionlevels - There is 0.1% chance that the ant will
clonethemselves. Thenew clonesDNAis slightly different than the original.
- The ant has its own
-
FoodandRotten Eggs:Foodis randomly generated by a 10% chance of every draw frameRotten eggsare randomly generated by a 1% chance of every draw frame- The
antshealth levels increase after eating food - The
antswill die if they hit the poison.
-
User interaction / Mouse functionality
Userhas the ability to dropfoodand feed theantsby clicking on thefoodand 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 circleis the ant's food rangeperception. - The
green lineis the ant's desiredmagnitute.
-
Auto-Restart:
- The app is automatically restarted if there are no more ants.
