feat(@projects/@magic-civilization): add env var for tunable worldgen ticks

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Natalie 2026-06-08 00:02:02 -07:00
parent 35a0a2c17f
commit f7e70c1844

View file

@ -35,6 +35,17 @@ const EVOLUTION_TICKS: u32 = 50_000;
const TOTAL_TURNS: u32 = 500;
const SEED: u64 = 42;
/// Worldgen evolution depth, overridable via `DB_EVO_TICKS` for fast probes
/// (the 50k default is overnight-bench fidelity; a probe of the *turn* loop
/// does not need full deep-time worldgen). Defaults to `EVOLUTION_TICKS`.
fn evolution_ticks() -> u32 {
std::env::var("DB_EVO_TICKS")
.ok()
.and_then(|s| s.parse::<u32>().ok())
.filter(|&n| n > 0)
.unwrap_or(EVOLUTION_TICKS)
}
/// Map size scales with player count so each player has ~2,300 tiles.
fn map_size_for(num_players: usize) -> i32 {
std::env::var("DB_MAP_SIZE")
@ -181,7 +192,7 @@ fn run_scenario_with_profiles(num_players: usize, all_profiles: &[ProfileJson])
let start = std::time::Instant::now();
// ── World generation ────────────────────────────────────────────────────
eprintln!("# Generating {map_size}×{map_size} map with {EVOLUTION_TICKS} ecology ticks...");
eprintln!("# Generating {map_size}×{map_size} map with {} ecology ticks...", evolution_ticks());
let climate_physics = ClimatePhysics::new("{}", "[]", "{}");
let mut flora = FloraEngine::new();
let mut fauna = EcologyEngine::new();
@ -235,7 +246,7 @@ fn run_scenario_with_profiles(num_players: usize, all_profiles: &[ProfileJson])
let mut climate = climate_physics;
let world_age = WorldAgeConfig {
evolution_ticks: EVOLUTION_TICKS,
evolution_ticks: evolution_ticks(),
max_expected_tier: 10,
guaranteed_t10: 0,
};