feat(engine): initialize 40% of energy nodes with energy at match start

Previously all energy nodes started empty (HasEnergy=false), requiring
10 turns (EnergyInterval) before any energy appeared. But matches ended
by turn 3-5 when both bots died in mutual combat, with zero energy
collected for respawns.

Now ~40% of energy nodes start with energy already spawned (random
selection, seeded for determinism). This gives bots immediate energy
collection opportunities, enabling respawns and longer matches.

Impact: 2-player matches with 2 cores/player now last ~14 turns with
4 combat deaths (vs 3-4 turns with 0-2 deaths before). Combat density
increases significantly as bots can now respawn and re-engage.

Closes: bf-4k0j

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
jedarden 2026-05-26 03:15:03 -04:00
parent 5aeecd2912
commit 67460e6b81

View file

@ -447,6 +447,17 @@ func (mr *MatchRunner) placeEnergyNodes(gs *GameState, numPlayers int) {
gs.AddEnergyNode(Position{Row: r, Col: c})
}
}
// Initialize ~40% of energy nodes with energy already spawned.
// This prevents immediate mutual destruction scenarios by giving bots
// energy collection opportunities from turn 0, enabling respawns.
initialEnergyRatio := 0.4
for _, en := range gs.Energy {
if mr.rng.Float64() < initialEnergyRatio {
en.HasEnergy = true
en.Tick = 0
}
}
}
// placeWalls places walls symmetrically.