From 1df567b15f8a4e70e57efef780a6d2b441d5933d Mon Sep 17 00:00:00 2001 From: jedarden Date: Tue, 26 May 2026 01:52:30 -0400 Subject: [PATCH] feat(engine): add zone bounds to VisibleState for bot awareness MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per plan ยง3.7, the shrinking zone is a forcing function that should force combat engagement. Previously, bots could not see the current zone state (center, radius, active) and would move away from the zone center, dying without understanding why. Changes: - Add Zone field to VisibleState (types.go) - Populate zone bounds in GetVisibleState() when zone enabled (game.go) This allows HTTP and local bots to see the zone and react strategically (e.g., move toward center to avoid zone death while engaging enemies). Test: zone bounds now appear in VisibleState JSON with correct values. Closes: bf-tfyy --- engine/game.go | 9 +++++++++ engine/types.go | 1 + 2 files changed, 10 insertions(+) diff --git a/engine/game.go b/engine/game.go index ecb7357..8240011 100644 --- a/engine/game.go +++ b/engine/game.go @@ -326,6 +326,15 @@ func (gs *GameState) GetVisibleState(playerID int) *VisibleState { } } + // Include zone bounds if enabled + if gs.Config.ZoneEnabled { + vs.Zone = &ZoneBounds{ + Center: gs.ZoneCenter, + Radius: gs.ZoneRadius, + Active: gs.ZoneActive, + } + } + return vs } diff --git a/engine/types.go b/engine/types.go index a59b74c..ad128c0 100644 --- a/engine/types.go +++ b/engine/types.go @@ -291,6 +291,7 @@ type VisibleState struct { Cores []VisibleCore `json:"cores"` Walls []Position `json:"walls"` Dead []VisibleBot `json:"dead"` + Zone *ZoneBounds `json:"zone,omitempty"` // Current zone state (nil if zone disabled) } // VisibleBot represents a bot visible to a player.