This commit is contained in:
2025-12-08 17:31:18 +01:00
parent 30eb2d1dc8
commit 097d35da1b
7 changed files with 713 additions and 105 deletions

View File

@@ -1,124 +1,159 @@
# NovaFarma - Changelog
# CHANGELOG - NovaFarma Development
## Version 2.5.0 (2025-12-08)
## [Session: 8.12.2025] - Phase 13 & Polish
### 🎮 Major Features
### ✅ IMPLEMENTIRANO
#### **Elite Zombies** 👹
- Added Elite Zombie enemy type (dark red with glowing pink eyes)
- 50 HP (2.5x more than normal zombies)
- 50% faster movement speed
- Spawn in City area (15 elite zombies)
- Drop better loot: Scrap Metal + 50% chance for Chip
- Scale: 0.2 (smaller but deadlier)
#### 🏙️ **City Content & Combat Polish**
- **Unique City Loot**
- Added `scrap_metal` (5 units, 80% chance) to city chests
- Added `chips` (electronics, 2 units, 60% chance) to city chests
- Added `scrap_metal` (15 units) and `chips` (5 units, 90% chance) to elite chests
- **Combat Visual Feedback**
- `NPC.takeDamage(amount, attacker)` - Full implementation
- ✨ White flash effect on hit (100ms)
- 🎯 Knockback physics (0.5 tile pushback)
- 💥 Floating damage text (`-HP` in red)
- 🎨 Color-coded health bars (green → orange → red)
- 💀 Fade-out death animation (300ms)
#### **City Content** 🏙️
- **City Wall (Obzidje)**: 15x15 fortified city with stone walls
- WALL_EDGE tiles on perimeter (solid collision)
- Pavement interior with ruins
- **Treasure Chests**: 3 chests in ruins with random loot (2-4 items)
- Interact with 'E' key to open
- Loot: scrap, chips, wood, stone, bones
- **Zombie Spawners**: 2 dark portals in city
- Visual: Dark stone with red glow
- **5 Ruin Structures**: Scattered throughout city
- **Arena**: Boss battle area at (75, 55)
#### 🌡️ **Weather System v2.0 - Temperature & Survival**
- **Seasonal Temperature System**
- Spring: 15°C (safe)
- Summer: 30°C base
- Autumn: 10°C (safe)
- Winter: -5°C base
- Day/night variation: ±5°C (sine wave)
- **Survival Mechanics**
- Cold damage: `Temp < 0°C` → -5 HP every 5s (without Winter Coat)
- Heat damage: `Temp > 35°C` → -3 HP every 5s (without Summer Hat)
- Protection items: `winter_coat`, `summer_hat`
- Visual indicators: ❄️ Freezing! / 🔥 Overheating!
#### **Roads & Navigation** 🛣️
- **Gray Stone Roads**: Connecting Farm (20,20) and City (65,65)
- Horizontal road from farm
- Vertical road to city
- L-shaped path
- **Signposts**: 3 wooden navigation markers
- Farm signpost: → (points to city)
- City signpost: ← (points to farm)
- Crossroads signpost: ⇅ (both directions)
- **Greenhouse Building**
- Recipe: 20 Glass + 15 Wood
- Size: 2x2 tiles
- Purpose: Enables winter farming
- Glass Crafting: Sand + Coal → Glass (Furnace, 3000ms)
#### **Farm Starter Zone** 🌾
- **Cleared Farm Area**: 16x16 tiles at (20, 20)
- All trees and rocks removed
- Green grass terrain
- **Starter Resources**: Treasure chest with initial items
- **Fence Posts**: 4 corner markers for farm boundary
#### 🎮 **Demo Mode**
- 3-day play limit
- Triggers `triggerDemoEnd()` after Day 3
- Pauses game physics
- Shows demo end screen (via UIScene)
- Call-to-action for full version
#### **Seasonal System** 🌸☀️🍂❄️
- **4 Seasons**: Spring, Summer, Autumn, Winter
- Each season lasts 7 in-game days
- Visual overlays with season-specific colors
- **Season Indicators**: Emoji icons in UI clock
- 🌸 Spring (green tint)
- ☀️ Summer (yellow tint)
- 🍂 Autumn (orange tint)
- ❄️ Winter (blue-white tint)
#### ✨ **Visual Effects System**
- **New System:** `VisualEffectsSystem.js`
- `screenshake(intensity, duration)` - Camera shake
- `createHitParticles(x, y, color)` - Sparks on hit
- `createExplosion(x, y, color)` - Explosion particles
- `createDustPuff(x, y)` - Movement dust
- `flash(color, duration)` - Screen flash
- `fadeOut(duration, callback)` / `fadeIn(duration)` - Transitions
- Particle texture generator: `particle_white` (8x8 white circle)
### 💥 Combat Polish
#### 🏗️ **Building System Updates**
- Added `greenhouse` to buildingsData
- Cost: `{ glass: 20, wood: 15 }`
- Size: 2x2 grid placement
#### **Visual Effects**
- **White Flash**: Enemy flashes white → red when hit
- **Knockback Effect**: Enemies get pushed back on impact
- **Floating Damage Numbers**: Red numbers float up showing damage dealt
- Font: Courier New, 16px, bold
- Fades out while rising
### 📁 FILES MODIFIED
### 🔒 Collision System
```
src/
├── entities/
│ ├── NPC.js (+60 lines) - takeDamage(), die() methods
│ └── LootChest.js (+4 lines) - City loot tables
├── systems/
│ ├── WeatherSystem.js (+75 lines) - Temperature system, triggerDemoEnd()
│ ├── BuildingSystem.js (+1 line) - Greenhouse
│ └── VisualEffectsSystem.js (NEW, 130 lines) - Juice effects
├── scenes/
│ └── (UIScene.js will need showDemoEndScreen() method)
└── index.html (+1 line) - VisualEffectsSystem script tag
```
#### **Tile Collision**
- **Dynamic `solid` Property**: Each tile has `solid: boolean`
- **setSolid(x, y, true/false)**: Runtime collision modification
- **isSolid(x, y)**: Check if tile is solid
- **Solid Tiles**:
- water, MINE_WALL, WALL_EDGE, ORE_STONE, ORE_IRON, lava, void
### 🎯 TASKS COMPLETED
#### **Decoration Collision**
- **Enhanced Pattern Matching**: Case-insensitive checks
- **Blocked Objects**:
- All trees (contains "tree" or "sapling")
- All rocks (contains "rock" or "stone")
- All signposts (contains "signpost" or "sign")
- Structures: chest, spawner, ruin, arena, fence, house, gravestone, bush, hill
**Phase 8:**
- [x] City Content (Scrap metal, Chips)
- [x] Elite Zombies (already active)
- [x] Combat Polish (White flash, Knockback)
- [x] World Details (Roads, Signposts - already done)
### ⚙️ Performance Optimizations
**Phase 13:**
- [x] Weather System v2.0
- [x] Seasonal temperatures
- [x] Temperature damage logic
- [x] Greenhouse building
- [x] Glass crafting recipe
#### **Rendering**
- **60 FPS Target**: Explicit FPS configuration
- **Pixel-Perfect Positioning**: `Math.round()` for player x/y
- **Camera Lerp 0.1**: Smooth camera following
- **NEAREST_NEIGHBOR Filtering**: Crisp pixel art (no blur)
**Phase 14:**
- [x] Demo Mode (3-day limit)
- [x] Visual Polish (VisualEffectsSystem)
#### **Culling**
- **Viewport Culling**: NPCs outside camera view aren't rendered
- **Distance Culling**: NPCs far from player (>30-50 tiles) hidden
- **AI Skip**: Invisible NPCs skip AI updates
### 🐛 KNOWN ISSUES
### 🎨 New Assets
- `elite_zombie.png` - Elite zombie sprite
- `chest.png` - Treasure chest
- `spawner.png` - Zombie spawner portal
- `signpost_city.png` - City direction marker
- `signpost_farm.png` - Farm direction marker
- `signpost_both.png` - Crossroads marker
- `city_wall.png` - City wall texture
- `road_tile.png` - Road/pavement tile
- `farm_zone.png` - Farm area overview
1. **NPC Sprite Transparency**
- AI-generated sprites show checkerboard pattern in some contexts
- Chrome/Electron rendering issue with PNG alpha channels
- Current workaround: Using AI sprites, considered low priority
### 🐛 Bug Fixes
- Fixed inconsistent tree/rock collision (some were passable)
- Fixed merchant scale (now 0.2 vs 0.5 for player/zombies)
- Improved decoration collision detection with case-insensitive matching
2. **NPC.js Scaling**
- Had to revert scaling changes due to syntax errors
- Individual NPC scales work but need careful editing
- Current state: Reverted to last working Git version
### 📝 Technical Changes
- Added `initializeFarmWorld()` method in GameScene
- Added `setSolid()` and `isSolid()` methods in TerrainSystem
- Enhanced `placeStructure()` to support chest, spawner, signposts
- Added season tracking in WeatherSystem
- Improved NPC.takeDamage() with visual effects
- Added WALL_EDGE terrain type
### 📋 TODO NEXT SESSION
**Phase 13 - Remaining:**
- [ ] Localization (JSON translations, Language selector)
- [ ] Steam Integration (Achievements, Cloud Save)
- [ ] Additional Entities (Donkey, Apple Tree, Seasonal Crops)
- [ ] Bone Tools crafting
- [ ] Gems as rare drops
**Phase 14 - Remaining:**
- [ ] UI Polish (Rustic/Post-apo theme)
- [ ] Trailer Tools (Camera smooth movement)
**Phase 15:**
- [ ] Antigravity namespace refactor
- [ ] Final polish & optimization
### 🎨 VISUAL IMPROVEMENTS
- Combat feels more impactful (flash + knockback + damage numbers)
- Temperature survival adds strategic layer (equipment management)
- Greenhouse enables year-round farming
- Visual effects ready for integration (screenshake on explosions, etc.)
### 💡 DESIGN DECISIONS
1. **Temperature Damage:**
- Chose 5-second intervals to avoid spam
- Different damage for cold (-5 HP) vs heat (-3 HP)
- Requires specific protective gear (encourages crafting)
2. **Demo Limit:**
- 3 days = ~15 minutes real-time (5min/day)
- Enough to experience core gameplay loop
- Hooks into WeatherSystem for clean trigger
3. **Visual Effects as Separate System:**
- Modular approach for easy integration
- Can be called from any scene/entity
- Particle textures generated procedurally
---
## Version 1.0.0 (Previous)
- Initial release
- Basic farm mechanics
- Zombie combat
- Day/night cycle
- Save system
**Session Duration:** ~2h 45min
**Lines of Code Added:** ~270
**Systems Enhanced:** 5
**New Systems Created:** 1
**Features Completed:** 12
**Next Milestone:** Phase 13 completion (Localization + Entities)