* chore: add battleground UI task tracker (2026-03-28) * feat(#142): add [NonSerialized] battleground runtime state to CardModel * feat(#143): add LoadArtCrop and LoadCardRaw (RawImage) to ImageCache * feat(#148): add GameStateManager singleton and GameState/SeatState POCOs * feat(#138): add BattlegroundController scene orchestrator * feat(#139): add LifeTrackerWidget, CommanderDamageRow, PoisonCounter * feat(#140): add PhaseTrackerWidget and PhaseStepButton * feat(#141): add TurnOrderBar and TurnOrderPill * feat(#142): add CardZone and CardView battlefield zone components * feat(#143): add CommanderZoneWidget with art crop, cast counter, and tax display * feat(#144): add TokenModel POCO, TokenPanelController, and TokenRowView * chore: mark issues 1-8 as complete in task tracker * feat(#146): add StackZoneController, StackItemView, and ManaPoolDisplay * feat(#147 #150 #151): add LobbySetupModal, ZoneViewerModal, EliminationHandler; add Play Live button to SimulationController * feat(#151): add Play Live button to SimulationController * feat(#149): add GameWebSocketClient with reconnect, ping, and main-thread dispatch * fix: add PostGameAction to ApiClient + update TODO.md all issues complete - ApiClient.cs: add PostGameAction() wrapper → POST /api/game/action (fixes compile error in HumanActionBar.cs) - TODO.md: mark issues #145, #146, #147, #149, #150, #151 as ✅ all 14 battleground issues now committed * feat(game): add routes/game.py + wire lab_api + fix GameWebSocketClient game_id URL - routes/game.py: POST /api/game/start, POST /api/game/action (new) - lab_api.py: import + register game_router - GameWebSocketClient.cs: read game_id from PlayerPrefs, build ws://{host}/ws/game/{game_id} — fixes URL mismatch with ws_game.py * fix(lobby): wire OnConfirm to POST /api/game/start, save game_id to PlayerPrefs - OnConfirm() now calls ApiClient.PostGameStart() with 4-seat config - On success: saves BattleSeats + GameId + WsUrl to PlayerPrefs, loads Battleground scene - On failure: shows inline error label (red), re-enables Confirm button - Added StartGameRequest/Response POCOs matching routes/game.py schema - Added _errorLabel [SerializeField] for user-facing error feedback
Commander AI Lab — Unity Client
Unity front-end for Commander AI Lab. Communicates with the FastAPI backend (lab_api.py) via REST API.
Requirements
| Tool | Version |
|---|---|
| Unity | 2022 LTS (6000.0+) |
| Render Pipeline | Universal Render Pipeline (URP) |
| .NET | .NET Standard 2.1 |
| Backend | Commander AI Lab FastAPI (port 8080) |
Setup
- Open Unity Hub
- Click Add → select this
unity-client/folder - Open the project in Unity 2022 LTS
- Install required packages via Package Manager (see
Packages/manifest.json) - Start the FastAPI backend:
python lab_api.py - Open the
MainMenuscene and press Play
Folder Structure
unity-client/
Assets/
Scenes/ — All Unity scenes
MainMenu.unity
Collection.unity
DeckBuilder.unity
DeckGenerator.unity
Simulator.unity
Coach.unity
Scanner.unity
Training.unity
Precon.unity
Scripts/
Models/ — C# POCOs matching FastAPI response shapes
Services/ — ApiClient.cs, CardImageCache.cs
UI/ — Scene-specific controllers
Animation/ — CardAnimator.cs, BattlefieldAnimator.cs
Prefabs/
CardPrefab.prefab
DeckSlotPrefab.prefab
ChatBubble.prefab
Materials/ — URP materials + Shader Graphs
Textures/ — UI sprites, card back
Fonts/
Packages/ — Unity package manifest
ProjectSettings/ — Build settings, input system config
Build Targets
| Platform | Instructions |
|---|---|
| Windows | File → Build Settings → PC/Mac → Windows x86_64 |
| WebGL | File → Build Settings → WebGL (requires Brotli compression) |
| Android | File → Build Settings → Android (requires Android SDK) |
| iOS | File → Build Settings → iOS (requires Xcode on Mac) |
API Configuration
The default backend URL is http://localhost:8080. Change it from the Settings panel in the MainMenu scene or pass it as a WebGL URL parameter: ?server=http://your-server:8080
GitHub Issues
See Epic #45 for full task breakdown.