1
0
mirror of https://github.com/osmarks/ewo3.git synced 2026-03-15 06:49:44 +00:00
This commit is contained in:
osmarks
2026-03-06 09:25:35 +00:00
parent ce725c0530
commit 599107f2ed
3 changed files with 11 additions and 10 deletions

View File

@@ -292,7 +292,7 @@ fn game_state_from_saved(saved: SavedGame) -> Result<GameState> {
const PLANT_TICK_DELAY: u64 = 128;
const FIELD_DECAY_DELAY: u64 = 100;
const PLANT_GROWTH_SCALE: f32 = 0.01;
const SOIL_NUTRIENT_CONSUMPTION_RATE: f32 = 0.05;
const SOIL_NUTRIENT_CONSUMPTION_RATE: f32 = 0.07;
const SOIL_NUTRIENT_FIXATION_RATE: f32 = 0.0002;
const WATER_CONSUMPTION_RATE: f32 = 0.03;
const PLANT_IDLE_WATER_CONSUMPTION_OFFSET: f32 = 0.05;
@@ -316,7 +316,7 @@ async fn game_tick(state: &mut GameState) -> Result<()> {
buffer.apply(state);
if state.ticks % FIELD_DECAY_DELAY == 0 {
state.dynamic_soil_nutrients.for_each_mut(|nutrients| *nutrients *= 0.999);
state.dynamic_soil_nutrients.for_each_mut(|nutrients| *nutrients *= 0.9999);
} else if state.ticks % FIELD_DECAY_DELAY == 1 {
state.dynamic_groundwater.for_each_mut(|water| *water *= 0.999);
} else if state.ticks % FIELD_DECAY_DELAY == 2 {

View File

@@ -67,10 +67,10 @@ impl Genome {
- self.nutrient_addition_rate() * 0.16 // nutrient enrichment has a growth tradeoff
- self.water_tolerance * 0.08
- self.temperature_tolerance * 0.07
- self.salt_tolerance.max(0.0) * 0.15;
- self.salt_tolerance.max(0.0) * 0.05;
let water_tolerance_coefficient = 15.0 * (1.0 + (-self.water_tolerance).exp());
let temperature_tolerance_coefficient = 12.0 * (1.0 + (-self.temperature_tolerance).exp());
let water_tolerance_coefficient = 13.0 * (1.0 + (-self.water_tolerance).exp());
let temperature_tolerance_coefficient = 3.0 * (1.0 + (-self.temperature_tolerance).exp());
let salt_tolerance_coefficient = 8.0 * (-self.salt_tolerance).exp();
base
@@ -106,10 +106,10 @@ impl Genome {
};
let (nutrient_addition_rate, optimal_water_level, optimal_temperature, reproductive_size_fraction_param, salt_tolerance, max_size) = match crop_type {
CropType::Grass => (-10.0, 0.0, 0.0, -1.0, 0.0, 1.0),
CropType::EucalyptusTree => (-10.0, 1.0, 0.7, 1.0, 0.1, 5.0),
CropType::Grass => (-10.0,-1.0, 0.0, -1.0, 0.0, 1.0),
CropType::EucalyptusTree => (-10.0, 1.0, 0.5, 1.0, 0.1, 5.0),
CropType::BushTomato => (-10.0, 0.0, 1.0, -0.3, 0.2, 1.5),
CropType::GoldenWattleTree => ( 2.0, 0.5, 0.7, 0.5, 0.4, 3.0),
CropType::GoldenWattleTree => ( 2.0, 0.5, 0.5, 0.5, 0.4, 3.0),
};

View File

@@ -350,6 +350,7 @@ const NUTRIENT_NOISE_SCALE: f32 = 0.0015;
// As a handwave, define soil nutrients to be partly randomized and partly based on water.
// This kind of sort of makes sense because nitrogen is partly fixed by plants, which would have grown in water-having areas.
// Update: they covaried way too much so reducing this.
pub fn soil_nutrients(groundwater: &Map<f32>) -> Map<f32> {
let mut soil_nutrients = Map::<f32>::from_fn(|d| {
let c = to_cubic(d);
@@ -357,7 +358,7 @@ pub fn soil_nutrients(groundwater: &Map<f32>) -> Map<f32> {
10.0 + c.x as f32 * NUTRIENT_NOISE_SCALE,
c.y as f32 * NUTRIENT_NOISE_SCALE,
c.z as f32 * NUTRIENT_NOISE_SCALE
]) + groundwater[d]
]) + groundwater[d] * 0.3
}, groundwater.radius);
percentilize(&mut soil_nutrients, |x| x.powf(0.4));
soil_nutrients
@@ -465,7 +466,7 @@ pub fn simulate_air(heightmap: &Map<f32>, sea: &HashSet<Coord>, scan_dir: CoordV
normalize(&mut rain_map, |x| x.powf(0.5));
let rain_map = smooth(&rain_map, 3);
normalize(&mut temperature_map, |x| x);
percentilize(&mut temperature_map, |x| x); // TODO do this more cleanly
(rain_map, temperature_map, atmo_humidity)
}