-
Notifications
You must be signed in to change notification settings - Fork 0
World
- Dry: Element resistant to a dry climate is Xeraphin.
- Cold: Element resistant to a cold climate is Cryonel.
- Wet: Element resistant to a wet climate is Humidra.
- Hot: Element resistant to a hot climate is Ignyra.
The size of the world can be set using width and height. In pixels, the size of the world will be determined by the specified height * 10 and by the specified width * 10. The reason this is the case is that each point in the world will be of size 10px × 10px. We do this because if each point were just a unit, the colour would not be visible in the printed world, and this would mean that no climate would be visible. Also, each creature will be of size 10, so we also prevent a creature from being in multiple climates at once, and the bigger the point, the fewer calculations we have to compute for each round.
Each corner of the world will be assigned its dominant climate. Each point's climate will be determined by how far it is away from a certain corner, points around it, and some random value. With this, we aim to create a rich world where you could have a cold climate within a hot climate.
For each climate type C ∈ {hot, cold, dry, wet}:
C(x, y) = w1 * corner_influence(C, x, y)
+ w2 * neighbor_average(C, x, y)
+ w3 * random_variationWhere:
-
w1,w2, andw3are weights (e.g., 0.5, 0.4, 0.1) that balance the influence of distance, neighbourhood, and randomness. -
corner_influence(C, x, y)– A function that returns higher values for points closer to corners associated with climate C. -
neighbor_average(C, x, y)– The average value of climate C from the 8 neighbouring grid points. -
random_variation(C, x, y)– A small random value to introduce local noise.
corner_influence(C, x, y) =
max(1 - d(corner_C, (x, y)) / max_dist, 0)
Where:
-
corner_Cis the coordinate of the corner where climateCis dominant. -
d(corner_C, (x, y))is the Euclidean distance from(x, y)tocorner_C. -
max_distis the maximum distance from any point to a corner, used to normalise the result to [0, 1].
For point (x, y), take the 8 immediate surrounding points and average their value for climate C:
neighbor_average(C, x, y) = avg of C(x±1, y±1)
(With boundary checks if near the edge.)
- A random value between 0.5 and 1.0 to avoid too much noise.
A climate with a larger value will be chosen as that point's climate.
A grid representing the spread of pheromone will be drawn, where each point contains some pheromone value. There are mainly 3 different types of pheromone: Danger, Food, and Mating.
Pheromone representation for each point: [Danger: value, Food: value, Mating: value]. Where value is floating-point between 0 and 1.
Pheromone is spread by creatures when they feel certain emotions strongly. For example, when a creature is full, it will spread a food pheromone, or when a creature has a productive drive, it will spread a mating pheromone. The spread of pheromone encourages decision-making based on not just the state of the creature but the state of those around it.
In each round, pheromone values will be multiplied by 0.5 to simulate decay and avoid misleading others.
- Creature's List and their positions
- Tree's List and their positions
- Dams' List and their positions