| // --- Evolution parameters (tunable) --- | |
| struct EvoParams { | |
| float food = 0.05f; // reward scale ("food" per unit merit) | |
| float decay = 0.98f; // energy decay per step | |
| float death_th = -0.5f; // energy threshold for death/reseed | |
| float cost = 5e-4f; // FIX: Reduced metabolic cost for stability | |
| // Gravity & motion | |
| float G = 1e-2f; // gravitational constant | |
| float eps2 = 1e-1f; // softening (squared) | |
| float dt = 0.5f; // integration step | |
| float damp = 0.90f; // velocity damping | |
| // Pairing & reproduction | |
| float pair_dist = 6.0f; // FIX: Increased separation to reduce interference | |
| int offspring_per_pair = 3; | |
| int max_population = 0; // 0 = auto (cap at 1.5x current) | |
| unsigned seed = 1337u; | |
| }; | |
| /** | |
| * Orchestrates a full ecology step: | |
| * 1) Reward from gradient map (GPU) | |
| * 2) Gravity forces & motion (GPU) | |
| * 3) Energy update, growth/shrink, death marking (GPU) | |
| * 4) Pairing & reproduction (HOST) with genetic recombination + mutation | |
| * 5) Population capping and compaction (HOST) | |
| */ | |
| void fungi_ecology_step(FungiSoA& pop, | |
| const float* d_grad_map, // [H*W] (GPU pointer) | |
| const EvoParams& evo); | |