From 6a6a3788a6966f6cd6d921750bf97343391c067a Mon Sep 17 00:00:00 2001 From: jedarden Date: Sun, 24 May 2026 16:03:02 -0400 Subject: [PATCH] fix(worker): use ConfigForPlayers to get correct AttackRadius2=12 The worker was hardcoding AttackRadius2=5 in executeMatch, but engine.ConfigForPlayers sets AttackRadius2=12 for both 2-player and 3+ matches. This mismatch meant matches ran with the old attack radius instead of the improved value that supports better combat density. Now uses ConfigForPlayers which provides: - AttackRadius2: 12 (3.5 tiles) for all player counts - Proper zone parameters scaled by player count - Correct max turns scaling Grid dimensions are overridden from the pre-generated map, and SeasonID/RulesVersion are preserved from the match. Closes: bf-576s Co-Authored-By: Claude Opus 4.7 --- cmd/acb-worker/main.go | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/cmd/acb-worker/main.go b/cmd/acb-worker/main.go index 85bd692..841e3f9 100644 --- a/cmd/acb-worker/main.go +++ b/cmd/acb-worker/main.go @@ -295,18 +295,17 @@ func (w *Worker) pollAndExecute(ctx context.Context) error { // executeMatch runs a match and returns the result and replay. func (w *Worker) executeMatch(ctx context.Context, claimData *JobClaimData) (*MatchResult, *engine.Replay, error) { - // Build game config from map data - config := engine.Config{ - Rows: claimData.Map.Width, - Cols: claimData.Map.Height, - MaxTurns: 500, // Default max turns - VisionRadius2: 49, // Default vision - AttackRadius2: 5, // Default attack - SpawnCost: 3, // Default spawn cost - EnergyInterval: 10, // Default energy interval - SeasonID: claimData.Match.SeasonID, - RulesVersion: claimData.Match.RulesVersion, - } + // Build game config using ConfigForPlayers to get proper attack radius and zone parameters + numPlayers := len(claimData.Participants) + config := engine.ConfigForPlayers(numPlayers, 2) // 2 cores per player default + + // Override grid dimensions from the pre-generated map + config.Rows = claimData.Map.Width + config.Cols = claimData.Map.Height + + // Set match metadata + config.SeasonID = claimData.Match.SeasonID + config.RulesVersion = claimData.Match.RulesVersion // Create match runner runner := engine.NewMatchRunner(config,