Last modification on 2019-01-28
This document gives an overview of the general mechanics behind the agents which populate Ecosim's environment. However, these details are likely to change during the course of development.
Key Terms and Concepts
|Agent||A "living" creature in the environment. An entity|
|Attribute||A characteristic of an agent which influences behaviour and/or represents it's condition|
|Confidence / Fear||How likely an agent is to approach another which is non-related|
|Energy||How "hungry" an agent is|
|Flock||A self-emerging group behaviour [See Boids]|
|Living entity||An agent with energy, which can move and consume|
|Metabolism||How quickly an agent uses energy, this has pros and cons. A higher metabolism allows faster movement, but also faster starvation|
|Mutation||Slight changes in an Offspring's static attributes, or "genes"|
|Non-living entity||An entity which was previously an agent. It cannot move or consume, but it can be consumed.|
|Related||The relationship between two entities which share similar genes|
|State||The state of an entity. Living or non-living|
When the program is ran, a number of agent groups, each with predefined static attributes shall populate the world. Since members of these groups posses the same attributes as their peers, they are considered to be related. These attributes will be represented as a has, as to allow agents to identity each other.
Attributes which are static change the way that agents interact with the world, and can be considered to be similar to genes in real living creatures. For example, if an agent has a low Confidence / Fear gene, then it is far more likely to avoid non-related agents. These attributes effect a wide range of behaviours, which can be seen in the "Agent Attribute" table below.
Agents are required to maintain an energy level. This is analogous to humans requiring food. Moving around the environment uses energy, so agents are required to eat regularly. If they do not, they will die, becoming non-living entities and food for others. In contrast, if they consume more than enough food then they are able to reproduce, this happens by the agent splitting into two copies of itself.
To keep the environment interesting and diverse, when an agent splits there is a likelihood of mutating. This means that the copy of the original agent has it's genes slightly modified. This can result in an improvement or reduction in the chances of survival.
Each agent in the world shall be represented by a data structure containing various attributes. There are two kinds of attributes associated with each agent. Dynamic attributes and static attributes
Dynamic attributes can change during the course of the simulation due to changes in the environment. static attributes, which are generated at the birth and cannot be changed. Static attributes can only be modified outside of the game via a config file, or via mutation when the agent is born.
|Hash||A representation of the static attributes of the entity||char array||N/a|
|Energy||The amount of energy an agent has left||int||0 to 255|
|State||-1: Dead (remove), 0: Dead (as food), 1: Living||int||-1 to 1|
|X||X position in the world||float||-1 to 1|
|y||Y position in the world||float||-1 to 1|
|X velocity||X velocity of the agent||float||-1 to 1|
|Y velocity||Y position in the world||float||-1 to 1|
|Static Attributes (General)|
|Confidence / Fear||The direction an agent will move towards another non-related agent (an agent with a different hash)||float||-1 to 1|
|Metabolism||How quickly an agent uses energy, a higher value allows the agent to move quicker||float||0 to 1|
|Static Attributes (Diet)|
|Living food preference||How likely an agent will attempt to consume a living entity||float||0 to 1|
|Non-living food preference||How likely an agent will attempt to consume a non-living entity||float||0 to 1|
|Static Attributes (Flocking)|
|Flock master influence||How much flocking affects an agent||float||0 to 1|
|Flock pull influence||How much pull a flock has on an entity||float||0 to 1|
|Flock proximity||The distance maintained between agents in a flock||float||0 to 1|
|Flock velocity mirroring||The amount of effect the flocks velocity has on an agent||float||0 to 1|
Agent Life Cycle
The life cycle of any agent in the simulation can be broken down into the following steps:
- The agent is born as a living entity in state 1
- The agent processes all information about the environment it has available, for example, proximity of food, or other agents
- The agent performs any of the following actions:
- Consume, either a living or non-living entity, or both, increasing the agents energy level and forcing the entity into state -1. Only if a suitable entity is within range.
- Reproduce, splitting itself into two agents, with slightly mutated static attributes. Only if the agent has enough energy
- The agent moves position based on it's static attributes and environmental information.
- The agent's energy is checked, if it is below a threshold, move to state 0
- The agent performs one of the following actions depending on which state it is in:
- State -1: The agent is completely removed from the environment
- State 0: The agent is dead, but remains in the environment as food for others as a non-living entity
- State 1: The agent survives, decrease energy and go to step 2