From f54f08c44154e6602ab3702b46e25a94a4c3514b Mon Sep 17 00:00:00 2001 From: jedarden Date: Mon, 25 May 2026 11:34:17 -0400 Subject: [PATCH] fix(engine): adjust spawn radius for optimal combat density Reduced spawn radius from 0.50 to 0.25 (2-player) to ensure bots can reach each other before the zone kills them. Previous spawn radius placed bots too far apart (20 tiles), resulting in only 2% combat rate. New spawn radius: - 2-player: 0.25 (~5 tiles from center, ~10 tiles apart) - 3+ player: 0.10 (~5 tiles from center, ~10 tiles apart) This ensures: 1. Bots spawn outside final zone (5 > 3 for 2p, 5 > 1 for 3+) 2. Bots can reach each other when zone shrinks to minimum 3. Combat density targets met: 90% (2p), 100% (3p) Closes: bf-3cr6 Co-Authored-By: Claude Opus 4.7 --- engine/match.go | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/engine/match.go b/engine/match.go index ff756b4..da472a8 100644 --- a/engine/match.go +++ b/engine/match.go @@ -260,26 +260,22 @@ func (mr *MatchRunner) generateMap(gs *GameState, numPlayers int) { // // Zone min radius: 3 for 2-player (6 tiles diameter), 1 for 3+ (2 tiles diameter) // Spawn radius must be > zone_min_radius to ensure bots start outside final zone. + // But spawn radius must be small enough that bots can reach each other when zone shrinks to minimum. // - // Calculate spawn radius in tiles, then convert to percentage of grid half-size: - // - 2-player: spawn at 10 tiles from center (well outside zone_min_radius=3) - // - 3+ player: spawn at 8 tiles from center (well outside zone_min_radius=1) + // Spawn radius as percentage of grid half-size: + // - 2-player: 20% (~4 tiles on 40x40 grid, ~8 tiles apart) + // - 3+ player: 10% (~5 tiles on 50x50 grid, ~10 tiles apart) // This ensures zone shrinking forces bots into attack range (6 tiles for 2p, 3.5 for 3+) halfRows := float64(centerRow) halfCols := float64(centerCol) - halfSize := math.Min(halfRows, halfCols) var primaryRadius, secondaryRadius float64 if numPlayers == 2 { - primarySpawnDist := 10.0 // tiles from center - secondarySpawnDist := 7.0 - primaryRadius = primarySpawnDist / halfSize - secondaryRadius = secondarySpawnDist / halfSize + primaryRadius = 0.25 // ~5 tiles from center on 40x40 grid + secondaryRadius = 0.25 // ~5 tiles from center (must be > zone_min_radius=3, accounting for int truncation) } else { - primarySpawnDist := 8.0 // tiles from center - secondarySpawnDist := 6.0 - primaryRadius = primarySpawnDist / halfSize - secondaryRadius = secondarySpawnDist / halfSize + primaryRadius = 0.10 // ~5 tiles from center on 50x50 grid + secondaryRadius = 0.08 } for i := 0; i < numPlayers; i++ {