Evagents

What is Evagents?

In the fewest words, Evagents is a Windows-platform OpenGL "natural" selection simulator. Started by Andrej Karpathy under the name Scriptbots, the program contains a world wherein agents (also called "bots", or "creatures") can interact with that world and each other, run around, eat, breed, communicate, die, and do other things, using neural nets to calculate their responses to stimuli. Each agent has a huge number of features available to them that they can use in various ways to try and survive long enough to reproduce, extending their survival solution through time. Any time a baby is born its traits are copied from its parent(s), but with chances of mutations. Thus a form of natural selection is applied to create populations of species that can best survive in the world. Competition, adaptation, and cooperation are important secondary characteristics that agents can develop, via changes to their "genome" and their mathematical brain.

Agent Features

The agents of the simulator have a variety of features that they can use to survive. In order of subjective importance they are:

  • Health: all agents have a counter, in the range (0,2], that indicate the health, or "level of success" of the agent. A value of 0 Health indicates a dead agent, no longer capable of reproduction, moving, or otherwise responding to the environment. It's "solution" to the survival problem failed.

  • Food: 3 types of "food", represented by square Cells that can be thought of representing local amounts of plant, fruit, or meat. A stomach trait determines which food sources a given agent can take from and by how much, and that intake is distributed to Health and the Reproduction counters in a ratio according to Metabolism.

  • Brains: agents are controlled by an initially randomly generated series of Damped, Recurrent, Additive, Weighted, Sigmoid-processed Boxes with a value between 0 and 1. Inputs are provided to each agent's brain from the "senses", and Outputs are taken from the last series of boxes. Each Box has a number of Connections to other boxes.

  • Movement: agents move around the world via 2 "wheels," whose speed are controlled by 4 of the the brain's outputs (forward and reverse for both left and right wheels). A Boost ability can make them move faster; a Jump ability can disengage them from attacks & the Cell layers temporarily.

  • Reproduction: agents can asexually or sexually reproduce. Without a partner, having children costs health proportional to the parent's radius. Otherwise it needs another agent to be outputting Sexual Projection nearby. Number of Babies is decided by an agent trait, and can mutate to give larger broods or just a single child.

  • Mutations: changes occur almost every time a child is born. They can be made to the agent's brain Boxes, like their connection weights, references, dampening, etc, and the agent's "physical" traits, like Radius, Metabolism, Stomach values, etc. A counter tracks the number of successful ancestors each box has been while unchanged, and when sexually reproducing, priority is given to longer-lasting boxes. Rarely, mutations also occur to live agents, providing an aging effect.

  • Hazards: agents can be injured by many dangers: Hazard/Waste on the Cell layer, old age, incompatible terrain with Lungs (Land/Water dichotomy), hostile Temperature (position on vertical axis, is symmetrical over equator), and even each other, by means of Spikes, Jaws, Collisions, and childbirth. Spikes are speed and alignment based, Jaws are proximity and alignment based, and Collisions - damaging to all participants - is overlap (speed) based.

  • Senses: agents can see, smell, and hear other agents around them, and some other things too; see the Input section on the Agents page for details.

Simulation Features

The app offers a number of features to users, with the end goal of simulating a world for a period of time, and letting the simulation develop various results of breeds of Agents in the world, each with their own, likely unique, methods of survival. In support of that, these are the features of the application as a whole:

  • Intuitive UI: Pan with left-mouse drag, select Individual agents with left-click, zoom with middle-mouse drag. Selected agents display more detailed info, and user input on the w,a,s,d keys will activate manual control. Spacebar activates a special input agents are sensitive to.

  • Audio Feedback: Supported by the IrrKlang audio engine, events and actions that happen in the world are alive with sounds and music, which also plays in an intelligent and procedural sense!

  • Configurable Settings: After the program is run at least once, a "settings.cfg" file is generated. Anything changed there will be loaded upon request or when the program is launched next. Note that it is an extremely robust file and you can enter or change as many entries as you like. You can even reformat the order or remove entire entries!

  • Saving & Loading: Like a particular simulation but don't have time right now to use CPU? Do you think you'll like to try starting with the same base species but allow it to evolve multiple different times to see what happens? You can do it with this app! I cannot promise backwards compatibility with every version update, but I will make an effort when I can.

  • Reporting: multiple times per Epoch, a "report.txt" is updated with tons of stats. The information saved here can be invaluable if you like spreadsheets and running the simulation at full speed!

  • Fast Simulation Mode, with Simulation Fidelity: The sim can be commanded to run at full (unobservable) speed, which means the program doesn't waste any time rendering the results on the screen, and unlike in the real world where quantum mechanics makes observers effect the results, the simulation will continue with high-fidelity and won't cause any loss of accuracy!

Agent Behavioral Modeling

Agents use simulated neural nets to take input values via neuron "boxes" which simply contain a value in range [0,1], where 1 represents "full activation" and 0 represents no activation. These inputs are fed through the neural network of boxes and processed with a variety of weights, biases, delays, locks, change sensitivities, and more. After the entire brain is processed, the last series of boxes are taken as the outputs. More can be redd about this process on the Wiki section about the Agent Brains

That is pretty much all that a single agent can do. Occasionally, mutations can occur while the agent is alive but they typically only adjust weights and biases very slightly. Much more meaningfully, significant mutations can occur when the agents reproduce. Connections can mutate in such ways as changing their target box, mirroring another connection's weight (making it a comparison node), or even more rarely changing it's type from a simple additive connection to a memory lock or change-sensitive connection. Other mutations also occur with agent base stats, and in combination these mutations create an imperfect clone of the mother agent, and now it's their turn to try and survive in the world!

The goal of the simulation is to get the agents to interact and react in their environment in an interesting and unique way, in theory. After simulation initialization, the slate is blank and populated with 100 random agents. It is likely none of these initial agents will survive long enough to reproduce! It will take time for the simulation to stumble randomly onto a combination of traits and brain settings that works enough to collect food from the world and reproduce. But for things like plant and fruit food, it is basically guaranteed. Those sources of food are initialized with a global concentration randomly, but they do also grow and populate the world to a maximum, filling the world with resources.

More interesting things are expected to happen once the world is filled with basic herbivores/frugivores. The simulation is built to support them indefinitely on purpose, because it is expected, as has been hypothesized with our own world, that once creatures evolve to use eyes in order to attack other creatures and feed off of them, then an arms race will develop and push evolution to it's maximum potential, possibly resulting in higher and higher levels of intelligence and unique use of the features available to the agents. Please note that as of yet, I have been unsuccessful in cultivating such a result with the simulation. Agents definitely have the capability of injuring each other or feeding off of the Meat layer of the world, but those two traits seem to be very difficult to breed together. It may be a matter of balancing, or perhaps correcting a few bugs in the program, but I am optimistic it will create at least one decent carnivore within maybe 100 simulation hours.

That's about it! If you're interesting in participating in exploring those simulation hours with me, feel free to jump to the Downloads page and get started! Or, if you have some skill with C++ or Java programming, we would love your fork on GitHub! More details can be learned from reading the Wiki Pages. Also, in each release there is a "Version History.txt" that comes with the download. Come talk with us on the Discussions page and share anything on your mind. Otherwise, enjoy some pretty pictures we've captured from the program below: