From 147095355c49a23684ad155efdadb28cecc80184 Mon Sep 17 00:00:00 2001 From: Natalie Date: Tue, 9 Jun 2026 22:35:51 -0700 Subject: [PATCH] =?UTF-8?q?fix(@projects/@magic-civilization):=20?= =?UTF-8?q?=F0=9F=90=9B=20adjust=20carrying=5Fcapacity=20for=20stable=20su?= =?UTF-8?q?ccession=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- .../test_worldsim_playable_path.gd | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/game/engine/tests/integration/test_worldsim_playable_path.gd b/src/game/engine/tests/integration/test_worldsim_playable_path.gd index c4f85aec..efd4930e 100644 --- a/src/game/engine/tests/integration/test_worldsim_playable_path.gd +++ b/src/game/engine/tests/integration/test_worldsim_playable_path.gd @@ -498,13 +498,18 @@ func _seed_initial_populations(fauna: RefCounted) -> void: ## A minimal Producer-diet (flora) species in the fauna-`Species` JSON shape that ## `register_species_from_json` accepts — used to drive a played-turn flora ## succession transition through the bridge (g2-07). +## `carrying_capacity` must match the size-derived `carrying_capacity_base` +## (Size::Small → 30.0). Dispersal computes its overcrowding pressure from +## `carrying_capacity` (engine.rs:668); a low value makes a seeded tile look +## massively over capacity and bleeds the population off it every tick, which +## resets `stability_ticks` and blocks the T1→T2 crossing. const FLORA_PRODUCER_JSON: String = ( '{"id":"test_succession_grass","name":"Test Grass",' + '"description":"test producer","tags":["trophic_producer"],' + '"domain":"terrestrial","trophic_level":"producer","lineage":"test",' + '"ecology_tier":1,"traits":["size_small","diet_producer","habitat_terrestrial",' + '"locomotion_sessile","thermal_cold_blooded","repro_r_strategy","social_colony"],' - + '"habitat_min":0.0,"migration_range":0,"carrying_capacity":0.5}' + + '"habitat_min":0.0,"migration_range":0,"carrying_capacity":30.0}' ) @@ -522,11 +527,11 @@ func test_flora_succession_transition_surfaces_through_bridge() -> void: var flora_id: int = int(fauna.call("register_species_from_json", FLORA_PRODUCER_JSON)) assert_gte(flora_id, 0, "producer species must register") - # Force the seeded tile to ideal habitat so tier advancement is unblocked. - # Depress the 8 surrounding tiles' habitat to ~0 so habitat-gradient dispersal - # does NOT bleed the population off the seeded tile (which would keep resetting - # its stability_ticks and prevent the T1→T2 crossing). This isolates the - # tier-advancement path the same way the crate test's single-tile grid does. + # Force the seeded tile to ideal habitat so tier advancement is unblocked, and + # depress the 8 surrounding tiles' habitat so habitat-gradient dispersal has no + # attractive neighbour to bleed into (which would keep resetting the seeded + # tile's stability_ticks). This isolates the tier-advancement path the same way + # the crate test's controlled grid does. for dc: int in range(-1, 2): for dr: int in range(-1, 2): var nd: Dictionary = grid.call("get_tile_dict", 8 + dc, 8 + dr) as Dictionary @@ -534,8 +539,8 @@ func test_flora_succession_transition_surfaces_through_bridge() -> void: continue nd["habitat_suitability"] = 1.0 if (dc == 0 and dr == 0) else 0.02 grid.call("set_tile_dict", 8 + dc, 8 + dr, nd) - # Seed a robust population (stays above the crash threshold each tick: cap is - # carrying_capacity_base[small]=30 × habitat 1.0, crash floor = 0.1·cap = 3). + # Seed at the carrying capacity (30) so the population sits at its stable + # ceiling — comfortably above the crash floor (0.1·cap = 3) every tick. fauna.call("seed_population", 8, 8, flora_id, 30.0) # 60 ticks > the 50-tick T1→T2 threshold. Drain each tick like the live loop; @@ -546,12 +551,6 @@ func test_flora_succession_transition_surfaces_through_bridge() -> void: var drained: Array = fauna.call("take_flora_transitions") as Array for tr: Dictionary in drained: all_transitions.append(tr) - if t % 10 == 0: - var dens: Dictionary = fauna.call("populated_tile_densities") as Dictionary - gut.p("tick %d: pop@(8,8)=%s cont=%s" % [ - t, str(dens.get(Vector2i(8, 8), 0.0)), - String(fauna.call("continuation_state_to_json")).substr(0, 200) - ]) assert_false( all_transitions.is_empty(),