# 📖 DNEVNIK RAZVOJA - NovaFarma ## ⚠️ **POMEMBNO - User Availability:** **Status:** Na dopustu / bolniški **Razpoložljivost:** Lahko delamo dolge sessions (3-4+ ur) **Ni potrebe:** Skrbeti za čas spanja ali utrujenost **User bo povedal:** Ko je utrujen/zaspan --- ## 🗓️ 15. December 2025 - Session 5: Phase 28 Complete - Rivers & Lakes! 🌊 **Trajanje:** 1.5 uri (19:18 - 19:45) **Cilj:** Zaključiti Phase 28 Session 5 (Rivers & Lakes) + bug fixes + visual polish ### ✅ Dosežki: **PHASE 28 SESSION 5: RIVERS & LAKES** 🌊🏞️ 1. **RiverSystem.js (270 linij):** - ✅ 3 major rivers generated - ✅ Mountain/forest sources - ✅ Tributaries (15% spawn chance) - ✅ River width variation (2-6 tiles) - ✅ Curved paths using Perlin noise - ✅ Biome-aware water coloring 2. **LakeSystem.js (260 linij):** - ✅ 11+ lakes distributed across biomes - ✅ Organic lake shapes with depth - ✅ Biome-specific placement rules - ✅ 15 small ponds (grassland) - ✅ 2 desert oases - ✅ Depth gradient rendering 3. **Water Features:** - **Reke:** Forest (#2a5f4f), Swamp (#3d5a3d), Desert (#87CEEB), Mountain (#4682B4) - **Jezera:** Per-biome colors with depth variation - **Mlake:** Grassland only - **Oaze:** Desert special feature 4. **Integration:** - ✅ Water rendering in `Flat2DTerrainSystem.renderChunk()` - ✅ Rivers + lakes overlay (depth 2) - ✅ Skip tree features on water tiles - ✅ Connected to GameScene - ✅ BiomeSystem integration ### 🐛 Bug Fixes (3 major): 1. **ES6 Export Fix:** - ❌ `export default class` ne deluje v browser brez bundlerja - ✅ Odstranil `export default` iz RiverSystem + LakeSystem 2. **ChunkManager BiomeSystem Fix:** - ❌ `this.scene.biomeSystem` undefined during chunk generation - ✅ Dodal `this.biomeSystem` property in connection - ✅ Fixed chunk tile generation with proper biome data 3. **TransitionSystem Feature Structure Fix:** - ❌ `biomeData.spawnProbability.trees` ne obstaja - ✅ Spremenil v `biomeData.features.trees` - ✅ Dodal support za cacti + boulders ### 🎨 Visual Polish: 1. **Tree Scaling - 40% manjša!** - Cherry: 0.25-0.4 (prej 0.4-0.6) - Oak: 0.28-0.42 (prej 0.45-0.65) - Pine: 0.28-0.45 (prej 0.45-0.7) 2. **Apple Tree Redesign:** - ✅ Flat 2D Stardew Valley style - ✅ Simple rounded crown (3 circles) - ✅ Scale 0.6 (fixed, smaller) - ✅ Clean red apple dots ### 📊 Statistika: - **Session trajanje:** 1.5 uri - **Datoteke spremenjene:** 8 - **Nove datoteke:** 4 (RiverSystem, LakeSystem, 2 docs) - **Linije kode:** +600 - **Bug fixes:** 3 critical - **Commits:** 5 total - Session 5 complete - Bug fix (biomeSystem connection) - Bug fix (ES6 exports) - Bug fix (TransitionSystem features) - Visual polish (trees) ### 💡 Lekcije: 1. **ES6 modules ne delajo v browser** - vedno uporabljaj `class` brez `export` 2. **System connections kritične** - chunkManager.biomeSystem moral biti povezan! 3. **Data structure pomembna** - features.trees vs spawnProbability.trees 4. **40% smaller trees = better visibility** - map je bolj pregleden 5. **Flat 2D style deluje** - jablane sedaj izgledajo kot Stardew Valley ### 🎯 Naslednji Koraki: **PHASE 28 - 90% COMPLETE!** ✅ **Session 6:** Structures, Roads, Final Polish (1-2h) --- ## 🗓️ 14. December 2024 - Session 1: Tiled Map Editor Exploration **Trajanje:** 2 uri (20:00 - 22:00) **Cilj:** Integracija Tiled Map Editor za custom map design ### ✅ Dosežki: 1. **Tiled Map Editor Setup:** - ✅ Instaliran Tiled v1.11.2 (via winget) - ✅ Ustvarjena workflow dokumentacija (`.agent/workflows/tiled-map-setup.md`) - ✅ Demo mapa ustvarjena (`farm_map.tmx`, `farm_map.json`) - ✅ Tileset files (.tsx) pripravljeni 2. **Bug Fixes:** - ✅ SaveSystem.js - fixed compatibility z Flat2DTerrainSystem - ✅ InteractionSystem.js - dodal null check za terrainSystem 3. **2D Visual Enhancements (Predhodni session):** - ✅ Cherry blossom trees (flat 2D triangular design) - ✅ Vibrant colors (grass, water, dirt) - ✅ Outlines za 2D cartoon style ### ❌ Izzivi: 1. **Tiled Integration Incomplete:** - Tileset PNG slike so prevelike (3072x3072 namesto 192x192) - Tile indices ne kažejo pravih pixlov - Layer rendering ne deluje - **ODLOČITEV:** Rollback na procedural Flat2DTerrainSystem 2. **Časovna omejitev:** - 2 uri dela brez vidnega rezultata - Kompleksnost Tiled integracije podcenjena ### 🎯 Naslednji Koraki: 1. **Tiled Map - Future Work:** - Narediti pravilne tileset PNG slike (192x192, 4x4 grid) - Testirati z manjšimi demo mapami - Raziskati Phaser Tiled integration best practices 2. **2D Map Improvements:** - Nadaljnja vizualna poliranje procedural sistema - Auto-tiling za smooth edges (grass/water transitions) - Weather effects (rain on water) ### 📊 Statistika: - **Datoteke spremenjene:** 11 - **Nove datoteke:** 5 (Tiled setup) - **Linije kode:** ~500 (večinoma debugging in testiranje) - **Bugs fixed:** 3 ### 💡 Lekcije: 1. **Procedural sistem deluje dobro** - ni nujno zamenjati 2. **Tiled integration zahteva več raziskave** - tileset dimensions critical 3. **Incremental approach** - manjše testne mape pred velikimi 4. **Time management** - vedno imej rollback plan! --- ## 🗓️ 15. December 2024 - Session 4: Micro Farm & Minting System **Trajanje:** 4.5 uri (00:50 - 01:42) **Cilj:** Phase 37 (Micro Farm) + Phase 40 (Minting) Implementation ### ✅ Dosežki: **PHASE 37: MICRO FARM & EXPANSION** 🌱 1. **8x8 Micro Farm System:** - ✅ Initial farm boundary (center of 100x100 map) - ✅ White boundary visualization with corner markers - ✅ Tile tracking system (Set-based unlocked tiles) - ✅ MicroFarmSystem.js created 2. **Visual Feedback:** - ✅ Locked tile overlay (30% opacity black) - ✅ Clear farm vs locked distinction - ✅ Dynamic rendering (15 tile viewRange) - ✅ Depth-sorted overlays 3. **Farming Restrictions:** - ✅ Block tilling outside farm boundary - ✅ Error messages with floating text - ✅ FarmingSystem integration - ✅ Boundary validation on every action 4. **Expansion System:** - ✅ 4-direction unlock buttons (⬆️⬇️➡️⬅️) - ✅ Cost system (50 gold per 2x2 expansion) - ✅ Interactive UI with hover effects - ✅ Dynamic boundary updates 5. **Minimap Integration:** - ✅ Farm boundary visible in minimap - ✅ White box indicator - ✅ Fixed terrainSystem compatibility - ✅ Player-relative rendering **PHASE 40: MINTING SYSTEM** 💰 1. **Core System:** - ✅ Smelter (Gold Ore → Gold Bar) - ✅ Mint (Gold Bar → Gold Coins) - ✅ MintingSystem.js created - ✅ Processing time tracking 2. **Recipes:** - ✅ Smelt: 1 ore + 1 coal → 1 bar (5s) - ✅ Mint: 1 bar → 10 coins (3s) - ✅ Fuel system for smelter - ✅ Progress tracking 3. **Visual Representation:** - ✅ Smelter sprite (🔥 brown with fire outline) - ✅ Mint sprite (💰 gold with coin icon) - ✅ Processing feedback - ✅ Completion floating text ### 🔧 Technical Fixes: 1. **Flat2DTerrainSystem:** - ✅ Added decorationsMap (Map) for InteractionSystem - ✅ Fixed crash in handleInteraction - ✅ Compatibility with existing systems 2. **UIScene Minimap:** - ✅ Fixed player position reading (gridX/gridY) - ✅ TerrainSystem.getTile() integration - ✅ Farm boundary rendering - ✅ Circular minimap compatibility 3. **Variable Scope:** - ✅ Fixed farmCenterX/Y references - ✅ Proper this. prefixing - ✅ Overlay rendering fixes ### ❌ Izzivi: 1. **AI Image Generation:** - Green screen transparency NE deluje zanesljivo - Manual background removal potreben - **LEKCIJA:** Direct transparent PNG je edina pot! 2. **Sprite Processing:** - Automatic green removal briše pravilne barve (pink, red) - Disabled processAllTransparency() globally - **LEKCIJA:** Ready assets = no processing! 3. **Complexity:** - 3 velike features v 1 session - Water auto-tiling postponed - Phase 38 postponed ### 🎯 Naslednji Koraki: 1. **Phase 38: Town Repair** (Next priority) - Ruined buildings system - NPC relationship (hearts) - Trading shops - Repair mechanics 2. **Water Auto-Tiling** (Visual improvement) - Edge detection - Smooth transitions - Wave animations 3. **Weather Improvements:** - Rain ripples on water - Better puddles - Particle effects ### 📊 Statistika: - **Session trajanje:** 4.5 uri - **Datoteke spremenjene:** 6 - **Nove datoteke:** 2 (MicroFarmSystem.js, MintingSystem.js) - **Linije kode:** +500 - **Features completed:** 2 major phases - **Commits:** 2 (Phase 37, Phase 40) ### 💡 Lekcije: 1. **Micro systems work!** - 8x8 start je dovolj za gameplay 2. **Visual feedback je critical** - overlay + boundaries = clarity 3. **Expansion mechanics engaging** - unlock buttons + cost = satisfying 4. **Minting = unique economy** - no random coin drops! 5. **4.5h session možen** - ampak potreben break! 😴 --- ## 🗓️ 14. December 2024 - Session 2: Cherry Blossom Trees + Visual Polish **Trajanje:** 30 min (22:30 - 23:00) **Cilj:** Dodati cherry blossom drevesa in testirati PNG sprite integration ### ✅ Dosežki: 1. **Cherry Blossom Trees:** - ✅ Generirane AI PNG slike (`roza_cesnjevo_drevo.png`, `cesnja_sadje.png`) - ✅ Dodan loading v PreloadScene.js - ✅ Implementiran PNG sprite rendering v Flat2DTerrainSystem - ✅ Testiranje različnih velikosti (0.8x → 0.5x scale) 2. **Background Removal Attempts:** - ✅ Dodal cherry tree v `processSpriteTransparency()` seznam - ✅ Implementiral `ultraRemoveBackground()` za pink + brown piksle - ❌ AI generiran PNG ima črne obrobe ki jih težko odstranimo 3. **Končna Rešitev:** - ✅ Revert nazaj na **proceduralne cherry blossom trees** (roza trikotniki) - ✅ Čisto brez artefaktov, pravilno rendering ### 🎨 **POMEMBNO PRAVILO - Image Generation:** **🟢 VSE PRIHODNJE AI GENERIRANE SLIKE:** - **GREEN SCREEN BACKGROUND** (RGB: 0, 255, 0) - **100% solid green** - NO gradients, NO transparency - Razlog: Chroma-key removal je 100% zanesljiv! - Sistem že ima `processSpriteTransparency()` - lahko dodamo green detection **Format:** ``` Background: Solid bright green (#00FF00) Subject: Clear, sharp edges No anti-aliasing on green boundary ``` ### 💡 Lekcije: 1. **AI transparency NE DELUJE zanesljivo** - vedno ostanejo artefakti 2. **Green screen je STANDARD** - uporablja Hollywood, uporabimo tudi mi! 3. **Procedural graphics > problematic PNGs** - če PNG ne deluje, procedural je backup 4. **Test early** - raje testiraj hitro kot da persistent z nedelujočim pristopom --- ## **Prejšnji Sessions:** *(Sessions pred 14.12.2024 niso dokumentirani v tem dnevniku)*