This projects demonstrates the use of an Entity-Component-System for the implementation of an individual-based model (IBM). We use Java and the ECS library [Artemis-odb](https://github.com/junkdog/artemis-odb) to build a simple model.
This projects demonstrates the use of an Entity-Component-System for the implementation of an individual-based model (IBM). We use Java and the ECS library [Artemis-odb](https://github.com/junkdog/artemis-odb) to build a grassing model.
## Components
The model description is structured following the ODD protocol (Grimm et al. 2006, 2010) to demonstrate the good fit between ECS and ODD.
<imgtitle="Screenshot of the model"src="https://git.ufz.de/oesa/ecs-tutorial/uploads/aca134ea4e37bada52effa167172d51a/image.png"alt="Screenshot of the model"width="400">
*Screenshot of the model*
## What is an ECS?
## Purpose
The purpose of this model is to demonstrate the use of Entity-Component-Systems for individual-based models (IBMs).
## Entities, state variables and scales
In an ECS, all entities are generic, but characterized by the components they possess. Comonents contain an entity's state variables.
In this grassing model, the only entities are grassers. All grassers possess the components `Position`, `Heading` and `Energy`. Behaviour of grassers is governed by the components `IsGrassing` or `IsSearching`, which each grasser possess one of.
Component `Position` contains continuous coordinates in a two-dimensional world.
Processes in the model are grass growth, grasser metabolism, grasser reproduction and the two grasser behaviours grassing and searching. Processes are executed in the given order.
Grassers grass on the grass, and grass regrows. Grassers have a metabolism consuming their energy. When energy drops to zero, a grasser dies. Grassers reproduce stochastically.
Grassers have two different behaviours: grassing and searching. Behaviour changes based grass availability.
## Initialization
The model is initialized with `NUM_GRASSERS` grassers. All grassers start with the grassing behaviour.