From 5fb08192e14e968f7154a44b595170d9fa68c7aa Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 23 Nov 2025 12:29:45 +0000 Subject: [PATCH] Add Sprint Planning for EPIC-02: Tier 1 Economy - Comprehensive sprint plan for Epic 2 (26 SP, 6 stories) - Detailed breakdown across 3 weeks (Week 3-5) - Story-by-story implementation guide - Dependencies, risks, and mitigation strategies - Daily task breakdown for each week - Success criteria and acceptance tests - Integration points with other epics --- docs/sprint-planning-epic-2.md | 730 +++++++++++++++++++++++++++++++++ 1 file changed, 730 insertions(+) create mode 100644 docs/sprint-planning-epic-2.md diff --git a/docs/sprint-planning-epic-2.md b/docs/sprint-planning-epic-2.md new file mode 100644 index 0000000..676c169 --- /dev/null +++ b/docs/sprint-planning-epic-2.md @@ -0,0 +1,730 @@ +# Sprint Planning - EPIC-02: Tier 1 Economy + +**Epic Owner:** Economy Systems +**Priority:** P1 (High - Required for Progression) +**Total Stories:** 6 +**Total Story Points:** 26 SP +**Sprint Duration:** 2-3 tygodnie (Week 3-5) +**Dependencies:** EPIC-01 (Core Gameplay Loop) +**Date:** 2025-11-23 +**Status:** Planning + +--- + +## 📋 Executive Summary + +Epic 2 wprowadza fundamentalny system ekonomiczny gry, który umożliwia graczom: +- Budowanie 5 typów budynków (Lumbermill, Mine, Smelter, Workshop, Market) +- Handel 7 zasobami (Wood, Ore, Bars, Tools, Stone, Clay, Bricks) +- Kupowanie i sprzedawanie na NPC Market po stałych cenach +- Umieszczanie budynków na siatce + +**Epic Success Criteria:** +- ✅ 5 typów budynków dostępnych do budowy +- ✅ 7 zasobów do handlu +- ✅ NPC Market z funkcją buy/sell +- ✅ Ekonomiczna równowaga zwalidowana (gracz może zarobić 1000 złota w 30 minut) + +--- + +## 🎯 Sprint Breakdown + +### Sprint 2 - Week 3 (Definicje + Core Economy) +**SP Allocation:** 10 SP +**Focus:** Fundamenty systemu ekonomicznego + +| Story ID | Story Name | SP | Priority | Status | +|----------|------------|-----|----------|---------| +| STORY-02.1 | Building Definitions - 5 Tier 1 Types | 3 | P1 | Backlog | +| STORY-02.2 | Resource Definitions - 7 Tier 1 Resources | 2 | P1 | Backlog | +| STORY-02.3 | NPC Market - Buy/Sell UI | 5 | P1 | Backlog | + +**Week 3 Goals:** +- [ ] 5 typów budynków zdefiniowanych w kodzie +- [ ] 7 zasobów z cenami rynkowymi +- [ ] UI dla NPC Market (buy/sell tabs) + +--- + +### Sprint 2 - Week 4 (Market Transactions + Validation) +**SP Allocation:** 10 SP +**Focus:** Funkcjonalność handlu + +| Story ID | Story Name | SP | Priority | Status | +|----------|------------|-----|----------|---------| +| STORY-02.4 | Use Case - Market Transaction | 5 | P1 | Backlog | +| STORY-02.5 | Building Placement System (Part 1) | 5 | P1 | Backlog | + +**Week 4 Goals:** +- [ ] Market transactions działają (buy/sell) +- [ ] Początek systemu placement (ghost sprite + validation) + +--- + +### Sprint 3 - Week 5 (Placement + Balance) +**SP Allocation:** 6 SP +**Focus:** Dokończenie placement + walidacja ekonomii + +| Story ID | Story Name | SP | Priority | Status | +|----------|------------|-----|----------|---------| +| STORY-02.5 | Building Placement System (Part 2) | 3 | P1 | Backlog | +| STORY-02.6 | Economic Balance Validation | 3 | P2 | Backlog | + +**Week 5 Goals:** +- [ ] Pełny system placement (10 building limit, gold deduction) +- [ ] Testy ekonomiczne przechodzą (1000g w 30 min) + +--- + +## 📖 Detailed Story Breakdown + +### STORY-02.1: Building Definitions - 5 Tier 1 Types +**Story Points:** 3 SP +**Priority:** P1 +**Sprint:** Week 3 +**Dependencies:** STORY-01.2 (Resource & PlayerEconomy) + +**Description:** +Stworzenie klasy BuildingDefinition oraz definicji 5 typów budynków Tier 1. + +**Acceptance Criteria:** +- [ ] BuildingDefinition class utworzona +- [ ] 5 typów budynków: Lumbermill, Mine, Smelter, Workshop, Market +- [ ] Każdy budynek ma: displayName, description, constructionCost, productionConfig, upgradeConfig +- [ ] Produkcja zbalansowana (1 Wood/min = 1 Ore/min = 0.5 Bars/min) +- [ ] Koszty budowy: 100g (Lumbermill/Mine), 200g (Smelter/Workshop), 500g (Market) +- [ ] 15 unit testów walidujących wszystkie definicje + +**Technical Implementation:** +```dart +class BuildingDefinitions { + static final Map tier1 = { + BuildingType.lumbermill: BuildingDefinition(...), + BuildingType.mine: BuildingDefinition(...), + BuildingType.smelter: BuildingDefinition(...), + BuildingType.workshop: BuildingDefinition(...), + BuildingType.market: BuildingDefinition(...), + }; +} +``` + +**Definition of Done:** +- 5 definicji budynków utworzonych +- Wszystkie koszty zbalansowane +- 15 unit testów przechodzi + +**Estimated Hours:** 12-15h (configuration + validation + testing) + +--- + +### STORY-02.2: Resource Definitions - 7 Tier 1 Resources +**Story Points:** 2 SP +**Priority:** P1 +**Sprint:** Week 3 +**Dependencies:** STORY-02.1 + +**Description:** +Stworzenie definicji 7 zasobów Tier 1 z cenami bazowymi i validacją arbitrażu. + +**Acceptance Criteria:** +- [ ] ResourceDefinition class utworzona +- [ ] 7 zasobów: Wood, Ore, Bars, Tools, Stone, Clay, Bricks +- [ ] Każdy zasób ma: id, displayName, description, iconPath, baseMarketPrice +- [ ] Ceny rynkowe: Wood 5g, Ore 7g, Bars 15g, Tools 30g, Stone 3g, Clay 4g, Bricks 12g +- [ ] Walidacja braku pętli arbitrażowych (buying + crafting < selling) + +**Economic Balance Check:** +- Wood (5g) + Ore (7g) = 12g input → Bars sprzedają się za 15g = **+3g profit** ✅ + +**Definition of Done:** +- 7 definicji zasobów utworzonych +- Brak pętli arbitrażowych (unit test) +- Wszystkie ikony utworzone (32×32px PNG) + +**Estimated Hours:** 8-10h (configuration + icons + testing) + +--- + +### STORY-02.3: NPC Market - Buy/Sell UI +**Story Points:** 5 SP +**Priority:** P1 +**Sprint:** Week 4 +**Dependencies:** STORY-02.2 + +**Description:** +Stworzenie ekranu NPC Market z interfejsem buy/sell dla wszystkich zasobów. + +**Acceptance Criteria:** +- [ ] Market screen z zakładkami BUY i SELL +- [ ] BUY tab: lista 7 zasobów z cenami buy (basePrice × 1.2) +- [ ] SELL tab: lista 7 zasobów z cenami sell (basePrice × 0.8) +- [ ] Slider do wyboru ilości (1-100) +- [ ] Przycisk "Buy" / "Sell" (disabled jeśli brak złota/zasobów) +- [ ] Potwierdzenie transakcji z aktualizacją złota/zasobów +- [ ] Haptic feedback przy udanej transakcji + +**UI Design:** +``` +┌─────────────────────────────────┐ +│ NPC Market [×] Close │ +├─────────────────────────────────┤ +│ [BUY] [SELL] │ +├─────────────────────────────────┤ +│ SELL Tab: │ +│ ┌─────────────────────────────┐ │ +│ │ Wood You have: 50 │ │ +│ │ 📦 Sell price: 4 gold │ │ +│ │ ●─────○────── Qty: 10 │ │ +│ │ Total: 40 gold │ │ +│ │ [Sell Wood] │ │ +│ └─────────────────────────────┘ │ +└─────────────────────────────────┘ +``` + +**Definition of Done:** +- Market screen działa (buy/sell) +- Złoto/zasoby aktualizują się natychmiast +- Haptic feedback przy transakcji +- 20 widget testów (disabled states, slider validation) + +**Estimated Hours:** 20-25h (UI + state management + testing) + +--- + +### STORY-02.4: Use Case - Market Transaction +**Story Points:** 5 SP +**Priority:** P1 +**Sprint:** Week 4 +**Dependencies:** STORY-02.3 + +**Description:** +Implementacja MarketTransactionUseCase z logiką buy/sell i walidacją. + +**Acceptance Criteria:** +- [ ] MarketTransactionUseCase utworzony +- [ ] Metoda: `buyResource(economy, resourceId, quantity)` → Result +- [ ] Metoda: `sellResource(economy, resourceId, quantity)` → Result +- [ ] Buy price: basePrice × 1.2 (20% markup) +- [ ] Sell price: basePrice × 0.8 (20% discount) +- [ ] Walidacja: Insufficient gold → error +- [ ] Walidacja: Insufficient resources → error +- [ ] 100% test coverage (30 unit testów) + +**Business Logic:** +```dart +class MarketTransactionUseCase { + Result buyResource( + PlayerEconomy economy, + String resourceId, + int quantity, + ) { + final resource = ResourceDefinitions.tier1[resourceId]!; + final buyPrice = resource.baseMarketPrice * 1.2; + final totalCost = (buyPrice * quantity).toInt(); + + if (!economy.canAfford(totalCost)) { + return Failure(TransactionError.insufficientGold); + } + + final updatedEconomy = economy + .deductGold(totalCost) + .addResource(resourceId, quantity); + + return Success(updatedEconomy); + } + + // sellResource implementation... +} +``` + +**Tests:** +- ✅ Buy Wood: 10 Wood × 6g = 60g deducted +- ✅ Sell Wood: 10 Wood × 4g = 40g added +- ✅ Buy with insufficient gold → error +- ✅ Sell with insufficient resources → error + +**Definition of Done:** +- 30 unit testów przechodzi +- Wszystkie edge cases obsłużone +- Brak błędów zaokrągleń + +**Estimated Hours:** 20-25h (validation logic + comprehensive testing) + +--- + +### STORY-02.5: Building Placement System +**Story Points:** 8 SP +**Priority:** P1 +**Sprint:** Week 4-5 (split across 2 weeks) +**Dependencies:** STORY-02.1 + +**Description:** +System umieszczania budynków na siatce z ghost sprite i walidacją. + +**Acceptance Criteria:** +- [ ] Przycisk "Build Menu" otwiera bottom sheet z 5 kartami budynków +- [ ] Tap na kartę budynku → placement mode +- [ ] Ghost sprite podąża za dotykiem (snap to grid) +- [ ] Invalid placement (occupied tile) → red tint +- [ ] Valid placement → green tint +- [ ] Tap to confirm → deduct gold, spawn BuildingComponent +- [ ] Cancel button wychodzi z placement mode +- [ ] 10 building limit (Tier 1) enforced + +**Placement Logic:** +```dart +class BuildingPlacementSystem { + bool isValidPlacement(Point gridPosition, List existingBuildings) { + // Check grid bounds (50×50) + if (gridPosition.x < 0 || gridPosition.x >= 50) return false; + if (gridPosition.y < 0 || gridPosition.y >= 50) return false; + + // Check occupied tiles + return !existingBuildings.any((b) => b.gridPosition == gridPosition); + } + + PlayerEconomy placeBuilding( + PlayerEconomy economy, + BuildingType type, + Point gridPosition, + ) { + final definition = BuildingDefinitions.tier1[type]!; + + // Validate + if (economy.buildings.length >= 10) throw MaxBuildingsReached(); + if (!economy.canAfford(definition.costs.construction)) throw InsufficientGold(); + + // Place + final newBuilding = Building(...); + return economy + .deductGold(definition.costs.construction) + .copyWith(buildings: [...economy.buildings, newBuilding]); + } +} +``` + +**Definition of Done:** +- Ghost sprite pojawia się w placement mode +- Invalid tiles pokazują red tint +- Placement odejmuje złoto poprawnie +- 10 building limit enforced (error message) + +**Estimated Hours:** 32-40h (complex UI state + placement logic) + +**Sprint Split:** +- **Week 4 (5 SP):** Ghost sprite, validation, tint colors +- **Week 5 (3 SP):** Confirm placement, gold deduction, 10 building limit + +--- + +### STORY-02.6: Economic Balance Validation +**Story Points:** 3 SP +**Priority:** P2 +**Sprint:** Week 5 +**Dependencies:** STORY-02.4, STORY-02.5 + +**Description:** +Automatyczne testy walidujące ekonomiczną równowagę gry. + +**Acceptance Criteria:** +- [ ] Test: Gracz może zarobić 1000 złota w 30 minut (Tier 1 gameplay) +- [ ] Test: Gracz odblokowuje Tier 2 w 2-3 godziny (60%+ success rate) +- [ ] Test: Brak pętli arbitrażowych (buy → craft → sell = loss) +- [ ] Test: Building ROI (Return on Investment) validation +- [ ] Symulacja: 1000 graczy, 2-hour session → avg gold = 2000-3000 + +**Economic Simulation:** +```dart +test('Player earns 1000g in 30 minutes (Tier 1)', () { + final player = PlayerEconomy.initial(gold: 500); + + // Minute 0: Build Lumbermill (100g) → 400g left + var economy = _placeBuilding(player, BuildingType.lumbermill); + + // Minute 5: Collect 5 Wood, sell for 20g → 420g + economy = _collectAndSell(economy, 'wood', 5); + + // ... simulate 30 minutes + + expect(economy.gold, greaterThanOrEqualTo(1000)); +}); +``` + +**Definition of Done:** +- Economic simulation tests pass +- 1000g w 30 minut osiągalne (95%+ success rate) +- Brak pętli arbitrażowych + +**Estimated Hours:** 12-15h (simulation testing) + +--- + +## 🔗 Dependencies & Prerequisites + +### External Dependencies +| Dependency | Type | Status | Impact if Missing | +|------------|------|--------|-------------------| +| EPIC-01 Complete | Hard | ✅ Done | Cannot start Epic 2 | +| STORY-01.2 (Resource & PlayerEconomy) | Hard | ✅ Done | Cannot define buildings | +| Grid System (STORY-01.5) | Hard | ✅ Done | Cannot place buildings | +| BuildingComponent (STORY-01.7) | Soft | ✅ Done | Can mock for testing | + +### Internal Dependencies (Within Epic 2) +``` +STORY-02.1 (Building Definitions) + ↓ +STORY-02.2 (Resource Definitions) + ↓ +STORY-02.3 (NPC Market UI) + ↓ +STORY-02.4 (Market Transaction Use Case) + ↓ +STORY-02.5 (Building Placement) + ↓ +STORY-02.6 (Economic Balance) +``` + +**Critical Path:** STORY-02.1 → STORY-02.5 (13 SP / 5 days critical path) + +--- + +## ⚠️ Risks & Mitigation + +### High-Risk Items + +| Risk ID | Risk Description | Probability | Impact | Mitigation Strategy | +|---------|------------------|-------------|--------|---------------------| +| **R-EPİC2-001** | Economic balance testing reveals broken progression | MEDIUM | HIGH | Early simulation testing in Week 3, adjust prices before Week 5 | +| **R-EPIC2-002** | Building placement UI too complex, >8 SP estimate | MEDIUM | MEDIUM | Split STORY-02.5 across 2 weeks (already planned) | +| **R-EPIC2-003** | Icon assets not ready for 7 resources | LOW | MEDIUM | Use placeholder icons, add real assets post-MVP | +| **R-EPIC2-004** | Market UI doesn't fit mobile screen | MEDIUM | HIGH | Design review in Week 3, iterate before Week 4 implementation | + +### Technical Risks + +**Building Placement (STORY-02.5):** +- **Risk:** Ghost sprite performance issues with Flame engine +- **Mitigation:** Profile early, use sprite caching if needed + +**Economic Balance (STORY-02.6):** +- **Risk:** 1000g in 30 min not achievable with current prices +- **Mitigation:** Run early simulations, tweak production rates/prices + +--- + +## 📊 Velocity & Capacity Planning + +### Team Capacity +- **Developer:** Solo developer (full-time) +- **Available Hours/Week:** 40 hours (30 productive) +- **Target Velocity:** 25 SP/week (realistic for solo dev) + +### Epic 2 Allocation + +| Week | Stories | SP Planned | SP Capacity | Status | +|------|---------|------------|-------------|--------| +| **Week 3** | STORY-02.1, 02.2, 02.3 | 10 SP | 25 SP | ✅ Under capacity | +| **Week 4** | STORY-02.4, 02.5 (Part 1) | 10 SP | 25 SP | ✅ Under capacity | +| **Week 5** | STORY-02.5 (Part 2), 02.6 | 6 SP | 25 SP | ✅ Under capacity | + +**Total Epic 2:** 26 SP ÷ 3 weeks = **8.67 SP/week average** ✅ Well within capacity + +**Note:** Remaining capacity used for EPIC-03 stories (Automation) in parallel. + +--- + +## ✅ Success Criteria & Acceptance + +### Epic-Level Acceptance Criteria + +**Functional:** +- [ ] 5 building types placeable on grid +- [ ] All 5 buildings producible with correct rates +- [ ] NPC Market buy/sell functional for all 7 resources +- [ ] Gold balance updates correctly on all transactions +- [ ] 10 building limit enforced + +**Performance:** +- [ ] Market UI renders <16ms (60 FPS) +- [ ] Building placement ghost sprite <16ms +- [ ] No lag with 10 buildings + market open + +**Quality:** +- [ ] 100% unit test coverage for use cases +- [ ] 80%+ widget test coverage for Market UI +- [ ] Economic simulation tests pass (1000g in 30 min) + +**Business:** +- [ ] Player can earn 1000g in 30 minutes +- [ ] No arbitrage loops (validated by tests) + +### Demo Readiness Checklist + +**Week 5 Demo (End of Epic 2):** +- [ ] Build 5 different building types +- [ ] Collect resources from buildings +- [ ] Open NPC Market, buy Wood +- [ ] Sell resources for gold +- [ ] Place 10 buildings (limit enforced) +- [ ] Show economic balance (earn 1000g scenario) + +--- + +## 🎯 Sprint Goals + +### Sprint 2 - Week 3: "Economy Foundations" +**Goal:** Zdefiniować wszystkie budynki, zasoby i stworzyć UI dla Market. + +**Deliverables:** +- BuildingDefinitions class z 5 budynkami +- ResourceDefinitions class z 7 zasobami +- Market screen (BUY/SELL tabs) functional + +**Exit Criteria:** +- [ ] 15 unit testów dla building definitions +- [ ] 7 resource icons (32×32px) +- [ ] Market UI działa (buy/sell tabs toggle) + +--- + +### Sprint 2 - Week 4: "Market Transactions" +**Goal:** Umożliwić kupowanie i sprzedawanie zasobów oraz rozpocząć placement system. + +**Deliverables:** +- MarketTransactionUseCase z pełną walidacją +- Ghost sprite dla building placement +- Invalid/valid placement visualization + +**Exit Criteria:** +- [ ] 30 unit testów dla market transactions +- [ ] Buy/Sell funkcje działają +- [ ] Ghost sprite pojawia się przy placement + +--- + +### Sprint 3 - Week 5: "Placement & Balance" +**Goal:** Dokończyć placement system i zwalidować ekonomię. + +**Deliverables:** +- Pełny building placement z gold deduction +- 10 building limit enforced +- Economic balance tests passing + +**Exit Criteria:** +- [ ] Placement odejmuje złoto poprawnie +- [ ] 10 building limit działa +- [ ] Economic simulation: 1000g w 30 min ✅ + +--- + +## 📅 Daily Breakdown (Szczegółowy Harmonogram) + +### Week 3: Days 1-5 + +**Day 1 (Monday):** +- [ ] STORY-02.1: Create BuildingDefinition class +- [ ] STORY-02.1: Define Lumbermill + Mine (2/5 buildings) +- [ ] Daily standup: Review EPIC-01 completion + +**Day 2 (Tuesday):** +- [ ] STORY-02.1: Define Smelter + Workshop + Market (3/5 buildings) +- [ ] STORY-02.1: Write 15 unit tests +- [ ] STORY-02.1: Mark as DONE ✅ + +**Day 3 (Wednesday):** +- [ ] STORY-02.2: Create ResourceDefinition class +- [ ] STORY-02.2: Define all 7 resources with prices +- [ ] STORY-02.2: Create 7 placeholder icons (32×32px) +- [ ] STORY-02.2: Write arbitrage validation test +- [ ] STORY-02.2: Mark as DONE ✅ + +**Day 4 (Thursday):** +- [ ] STORY-02.3: Design Market UI layout +- [ ] STORY-02.3: Implement BUY tab with 7 resources +- [ ] STORY-02.3: Implement SELL tab with 7 resources + +**Day 5 (Friday):** +- [ ] STORY-02.3: Add slider for quantity selection +- [ ] STORY-02.3: Implement Buy/Sell button logic +- [ ] STORY-02.3: Add haptic feedback +- [ ] STORY-02.3: Write 20 widget tests +- [ ] STORY-02.3: Mark as DONE ✅ +- [ ] **Weekly Review:** 10 SP completed + +--- + +### Week 4: Days 6-10 + +**Day 6 (Monday):** +- [ ] STORY-02.4: Create MarketTransactionUseCase class +- [ ] STORY-02.4: Implement buyResource method +- [ ] STORY-02.4: Implement sellResource method + +**Day 7 (Tuesday):** +- [ ] STORY-02.4: Add validation (insufficient gold/resources) +- [ ] STORY-02.4: Write 30 unit tests (all edge cases) +- [ ] STORY-02.4: Mark as DONE ✅ + +**Day 8 (Wednesday):** +- [ ] STORY-02.5: Create BuildingPlacementSystem class +- [ ] STORY-02.5: Implement ghost sprite following touch +- [ ] STORY-02.5: Add grid snapping logic + +**Day 9 (Thursday):** +- [ ] STORY-02.5: Implement isValidPlacement method +- [ ] STORY-02.5: Add red/green tint for invalid/valid tiles +- [ ] STORY-02.5: Test placement validation + +**Day 10 (Friday):** +- [ ] STORY-02.5 (Part 1): Review and test +- [ ] **Weekly Review:** 10 SP completed (02.4 + 02.5 Part 1) + +--- + +### Week 5: Days 11-12 + +**Day 11 (Monday):** +- [ ] STORY-02.5 (Part 2): Implement confirm placement +- [ ] STORY-02.5 (Part 2): Add gold deduction on placement +- [ ] STORY-02.5 (Part 2): Enforce 10 building limit +- [ ] STORY-02.5: Mark as DONE ✅ + +**Day 12 (Tuesday):** +- [ ] STORY-02.6: Write economic simulation test (1000g in 30 min) +- [ ] STORY-02.6: Write arbitrage loop test +- [ ] STORY-02.6: Run 1000-player simulation +- [ ] STORY-02.6: Mark as DONE ✅ +- [ ] **Epic 2 Demo:** Show all features working +- [ ] **Epic 2 Retrospective** + +--- + +## 🔄 Integration Points + +### Integration with Other Epics + +**EPIC-01 (Core Gameplay Loop):** +- Uses: Building entity, Resource entity, PlayerEconomy +- Extends: Adds 5 new building types to existing system + +**EPIC-03 (Tier 2 Automation):** +- Provides: Building definitions for Smelter (Tier 2 automation target) +- Provides: Resource definitions (Wood, Ore, Bars for conveyors) + +**EPIC-05 (Mobile-First UX):** +- Integrates: Market UI must be mobile-responsive +- Integrates: Building placement uses touch controls + +**EPIC-09 (Firebase Backend):** +- Syncs: PlayerEconomy (gold + resources) to Firestore +- Syncs: Building placements to cloud save + +--- + +## 📝 Testing Strategy + +### Unit Tests +- **Target Coverage:** 100% for use cases (MarketTransactionUseCase, BuildingPlacementSystem) +- **Total Tests:** ~50 unit tests across Epic 2 + +**Test Categories:** +- Building definitions validation (15 tests) +- Resource definitions validation (7 tests) +- Market transaction logic (30 tests) +- Placement validation (20 tests) +- Economic balance simulation (10 tests) + +### Widget Tests +- **Target Coverage:** 80% for Market UI +- **Total Tests:** ~20 widget tests + +**Test Scenarios:** +- Buy button disabled when insufficient gold +- Sell button disabled when insufficient resources +- Slider updates total cost/revenue +- Tab switching (BUY ↔ SELL) + +### Integration Tests +- **End-to-End Scenario:** Place building → Collect resources → Sell at market → Buy new resources +- **Performance Test:** Market UI renders at 60 FPS with 7 resources + +--- + +## 🚀 Next Steps After Epic 2 + +### Immediate Follow-Up (Epic 3) +- **STORY-03.1:** A* Pathfinding Algorithm (8 SP) +- **STORY-03.2:** Conveyor Entity (3 SP) +- Start automation system leveraging Economy resources + +### Future Enhancements (Post-MVP) +- Dynamic market prices (supply/demand) +- Additional Tier 2 buildings (Factory, Refinery) +- Trading between players (multiplayer economy) + +--- + +## 📞 Communication Plan + +### Daily Standups +- **When:** Every morning, 9:00 AM +- **Duration:** 15 minutes +- **Format:** + - Yesterday: What was completed + - Today: What will be worked on + - Blockers: Any impediments + +### Sprint Reviews +- **Week 3 Review:** Friday, 5:00 PM (Demo STORY-02.1, 02.2, 02.3) +- **Week 4 Review:** Friday, 5:00 PM (Demo STORY-02.4, 02.5 Part 1) +- **Week 5 Review:** Tuesday, 5:00 PM (Demo full Epic 2) + +### Retrospective +- **When:** Week 5, after Epic 2 completion +- **Duration:** 1 hour +- **Topics:** + - What went well + - What could be improved + - Action items for Epic 3 + +--- + +## 🎓 Learnings & Assumptions + +### Assumptions +1. **Flame Engine Proficiency:** Developer has basic Flame experience (from EPIC-01) +2. **Icon Assets:** Placeholder icons acceptable for MVP +3. **Economic Balance:** 1000g in 30 min is achievable with current rates +4. **Solo Developer:** No external dependencies on designers/artists + +### Known Constraints +- **Mobile-First:** All UI must be touch-friendly +- **60 FPS Target:** Snapdragon 660 or equivalent +- **Offline-First:** Economy state must work without internet + +--- + +## 📚 Documentation Links + +- [Epics & Stories Document](./epics-stories-trade-factory-masters-2025-11-17.md) +- [Sprint Planning Review](./sprint-planning-review-2025-11-17.md) +- [PRD (Product Requirements)](./PRD.md) *(if exists)* +- [Architecture Document](./architecture.md) *(if exists)* + +--- + +## 🎉 Epic 2 Completion Criteria + +**Epic 2 is COMPLETE when:** +- ✅ All 6 stories marked as DONE +- ✅ 100% unit test coverage for use cases +- ✅ Economic simulation test passes (1000g in 30 min) +- ✅ Demo shows: place building → collect → sell → buy → place another +- ✅ Code review passed +- ✅ Retrospective completed + +--- + +**Last Updated:** 2025-11-23 +**Next Review:** Week 3 Friday (End of Sprint 2) +**Epic Owner:** Economy Systems Team +**Status:** ✅ Ready for Sprint 2 Kickoff