feat(grid): Replace real-time CTF with turn-based grid system

Replace continuous free-form movement with discrete 20x50 grid-based
gameplay featuring asymmetric movement mechanics:

- Blue/Red teams with 3 units each
- Zone-based movement: orthogonal (4 dir) in offense, diagonal (8 dir) in defense
- Alternating turns with click-to-select, click-to-move input
- Fog of war: 3-cell Chebyshev vision radius per unit
- Defense speed nerf: skip every 4th move in own zone
- AI opponent that chases flag carriers and advances toward enemy flag
- Collision resolution: defender wins in their zone, lower ID wins in neutral

Implements all 3 phases from the plan:
- Phase 1: Playable grid with hot-seat two-player
- Phase 2: Fog of war + defense speed nerf
- Phase 3: AI opponent

Deleted obsolete files: Flag.cs, Unit.cs, RouteDrawer.cs, SimpleAI.cs, Visibility.cs

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
John Lamb
2026-02-07 17:05:44 -06:00
parent 0de174eb1a
commit e4ac24f989
17 changed files with 1658 additions and 1092 deletions

View File

@@ -0,0 +1,103 @@
# Asymmetric Grid CTF Board
**Date:** 2026-02-04
**Status:** Ready for planning
## What We're Building
A turn-based capture-the-flag game on a 20x50 grid with asymmetric movement mechanics. Each team has 3 pieces that move differently depending on which zone they're in:
- **Offensive zone (enemy territory):** Orthogonal movement only (Manhattan distance)
- **Defensive zone (home territory):** Diagonal movement only (Chebyshev distance)
- **Neutral zone (center):** Both teams move orthogonally (on offense)
The board is mirrored: Team A's defensive zone is Team B's offensive zone, and vice versa.
### Core Mechanics
1. **Simultaneous turns:** Both teams plan moves secretly, then execute at the same time
2. **Fog of war:** Each piece sees 3 cells in any direction; the rest is hidden
3. **Collision resolution:** Defender wins ties (piece in their defensive zone captures invader)
4. **Defense speed nerf:** Defensive movement is 75% speed (skip every 4th move in defense zone)
5. **Victory condition:** Capture enemy flag from their base and return it to your base
## Why This Approach
### Pure Grid Replacement over Hybrid
The PDF's game theory analysis is fundamentally about discrete move counts (Manhattan vs Chebyshev distance). Free-form movement with grid constraints would:
- Complicate collision detection
- Make fog of war harder to compute
- Obscure the strategic depth the grid creates
A clean grid system directly implements the analyzed mechanics.
### Simultaneous Turns over Turn-Based
Simultaneous planning creates the "mixed-strategy game" described in the PDF. If turns were sequential, the reactive player always has perfect information. Simultaneous moves mean:
- Offense can commit to a direction without the defense knowing
- Both teams must predict opponent behavior
- Creates bluffing and misdirection opportunities
### Visible Grid
Players need to understand their movement options. The orthogonal green squares and diagonal red squares from the PDF communicate which directions are legal at a glance.
## Key Decisions
| Decision | Choice | Rationale |
|----------|--------|-----------|
| Board size | 20x50 | Wide enough for 3 pieces per side with meaningful positioning |
| Zone proportions | 20x20 defense, 10x10 neutral, 20x20 defense | Small neutral = more defensive play per user request |
| Movement per turn | 1 cell | Matches PDF analysis; multi-cell would change game theory |
| Vision radius | 3 cells | Creates meaningful information asymmetry without total blindness |
| Defense speed | 75% (3 moves per 4 turns) | PDF analysis shows this creates balanced mixed-strategy game |
| Collision rule | Defender wins | Rewards positioning in your territory |
| Flag location | Back of defensive zone | Classic CTF setup |
## Open Questions
1. **How to visualize fog of war?** Options: darken hidden cells, hide them entirely, show "last known" positions
2. **What happens to flag carrier if tagged?** Drop flag? Flag returns to base?
3. **Respawn mechanics?** Where do tagged pieces respawn? How long until they can act?
4. **Turn timer?** Unlimited planning time or forced time limit?
5. **AI opponent?** Should we build AI for single-player, or multiplayer-only initially?
## Grid Visual Reference
The PDF shows a pattern where:
- Green squares form an orthogonal grid (offense paths)
- Red diagonal lines overlay, creating larger diamond-shaped cells (defense paths)
- The two grids intersect, meaning some cells are reachable by both movement types
For implementation, we need to define:
- Cell size in world units
- How to render the dual-grid overlay
- Visual distinction between zones (Team A defense, neutral, Team B defense)
## Technical Considerations
### Current Architecture Impact
The existing `Game.cs`, `Unit.cs`, and `RouteDrawer.cs` will need significant changes:
- Replace `RouteDrawer` path drawing with click-to-select, click-to-move
- Replace continuous movement in `Unit.cs` with discrete grid steps
- Add turn manager for simultaneous move resolution
- Add fog of war system (current `Visibility.cs` is radius-based, needs grid conversion)
### New Components Needed
1. **GridBoard** - Manages 20x50 cell array, zone definitions, visual rendering
2. **TurnManager** - Handles move planning phase, simultaneous execution, turn counting
3. **GridMovement** - Validates moves based on zone type, handles defense speed nerf
4. **FogOfWar** - Computes visible cells per team, hides/reveals pieces
5. **CollisionResolver** - Determines outcomes when pieces occupy same cell
## Next Steps
Run `/workflows:plan` to create implementation plan addressing:
1. Grid data structure and rendering
2. Turn system and move planning UI
3. Zone-based movement validation
4. Fog of war implementation
5. Collision and capture mechanics