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 <noreply@anthropic.com>
This commit is contained in:
jedarden 2026-05-24 16:03:02 -04:00
parent b0de3006ac
commit 6a6a3788a6

View file

@ -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,