397 lines
9.7 KiB
Markdown
397 lines
9.7 KiB
Markdown
# NovaFarma 🌾
|
|
|
|
**2.5D Isometric Survival Game** - Post-Apocalyptic Farming Simulator
|
|
|
|
Pixel art survival game z izometričnim pogledom, zombie workers, in farming mechanics.
|
|
Built with Phaser.js and Electron.
|
|
|
|
[]()
|
|
[]()
|
|
[]()
|
|
|
|
---
|
|
|
|
## 🎮 Features
|
|
|
|
### **✅ Core Gameplay (COMPLETE)**
|
|
- 🌍 **Isometric 100x100 World** - Flat grass platform with river
|
|
- 👤 **Player Movement** - WASD controls, depth sorting
|
|
- 🌾 **Farming System** - Plant, grow, harvest crops
|
|
- 🧟 **Zombie Workers** - Tame zombies to work on farm
|
|
- 💰 **Economy** - Gold, trading, merchant NPCs
|
|
- 🎒 **Inventory** - 20 slots + crafting
|
|
- 🏗️ **Building** - Structures, fences, workstations
|
|
|
|
### **✅ Advanced Systems (TODAY'S UPDATE!)**
|
|
- 💾 **Save/Load System** - 3 save slots + auto-save every 5 min
|
|
- 🏆 **8 Achievements** - Auto-tracking with fancy popups
|
|
- 💎 **Gem Drops** - Diamond, Emerald, Ruby, Sapphire
|
|
- 🔨 **Bone Tools** - Craftable tools from bones + wood
|
|
- 🎁 **Starter Chest** - Seed-based random loot
|
|
- 📊 **Performance Monitor** - Press F3 for FPS/memory stats
|
|
- 🧪 **Integration Tests** - Type `runTests()` in console
|
|
- 🎨 **UI Theme System** - Rustic/post-apo styled UI
|
|
|
|
### **🌦️ Weather & Seasons**
|
|
- ☀️ Dynamic weather (clear, rain, snow, storm)
|
|
- 🌡️ Temperature system (affects crops)
|
|
- 📅 Day/night cycle
|
|
- 🌱 Seasonal mechanics (spring/summer/autumn/winter)
|
|
|
|
### **🧟 NPC Systems**
|
|
- 🧟 Zombie workers (can be tamed)
|
|
- 🧙♂️ Merchant (buy/sell items)
|
|
- 👥 Villagers (quests, dialogue)
|
|
- 👹 Elite zombies & mutants
|
|
- 🐄 Animals (cows, chickens)
|
|
|
|
---
|
|
|
|
## 🚀 Quick Start
|
|
|
|
### **Prerequisites**
|
|
- Node.js 18+
|
|
- npm 9+
|
|
|
|
### **Installation**
|
|
```bash
|
|
# Clone repository
|
|
cd c:\novafarma
|
|
|
|
# Install dependencies
|
|
npm install
|
|
|
|
# Run game (Electron)
|
|
npm start
|
|
|
|
# OR run in browser (development)
|
|
python -m http.server 8001
|
|
# Then open http://127.0.0.1:8001
|
|
```
|
|
|
|
---
|
|
|
|
## 🎯 Controls
|
|
|
|
### **Movement**
|
|
- `W/A/S/D` - Move player (isometric)
|
|
- `Arrow Keys` - Alternative movement
|
|
- `SHIFT` - Sprint (faster movement)
|
|
|
|
### **Interaction**
|
|
- `E` - Interact with objects/NPCs
|
|
- `F` - Harvest crops
|
|
- `R` - Attack (combat)
|
|
- `Q` - Quick use item
|
|
|
|
### **UI**
|
|
- `I` - Open inventory
|
|
- `C` - Open crafting menu
|
|
- `M` - Open map
|
|
- `ESC` - Pause menu
|
|
|
|
### **Debug/Testing**
|
|
- `F3` - Toggle FPS monitor
|
|
- `F5` - Quick save
|
|
- `F9` - Quick load
|
|
|
|
### **Console Commands**
|
|
Type in browser console:
|
|
- `save(1)` - Save to slot 1
|
|
- `load(1)` - Load from slot 1
|
|
- `runTests()` - Run integration tests
|
|
|
|
---
|
|
|
|
## 📦 Save System
|
|
|
|
### **Features**
|
|
- 💾 **3 Save Slots** - Multiple playthroughs
|
|
- ⚡ **Auto-Save** - Every 5 minutes
|
|
- 📤 **Export/Import** - Backup your saves
|
|
- 📊 **Metadata** - Playtime, day count, level
|
|
|
|
### **Console Commands**
|
|
```javascript
|
|
// Save to specific slot (1-3)
|
|
save(1);
|
|
|
|
// Load from specific slot
|
|
load(1);
|
|
|
|
// Quick save/load (current slot)
|
|
window.SaveManager.quickSave();
|
|
window.SaveManager.quickLoad();
|
|
```
|
|
|
|
---
|
|
|
|
## 🏆 Achievements
|
|
|
|
| Achievement | Requirement | Progress Tracking |
|
|
|-------------|-------------|-------------------|
|
|
| 🌾 FIRST_HARVEST | Harvest first crop | Auto |
|
|
| 💰 GOLD_RUSH | Earn 1000 gold | Auto |
|
|
| 🧟 ZOMBIE_SLAYER | Kill 100 zombies | Auto |
|
|
| 🌾 MASTER_FARMER | Harvest 1000 crops | Auto |
|
|
| 📅 DAY_30 | Survive 30 days | Auto |
|
|
| 🏡 GREENHOUSE | Build greenhouse | Auto |
|
|
| 🧟♂️ TAMED_ZOMBIE | Tame first zombie | Auto |
|
|
| 🏝️ OCEAN_EXPLORER | Discover 5 islands | Auto |
|
|
|
|
Progress is automatically tracked and persisted!
|
|
|
|
---
|
|
|
|
## 🔨 Crafting
|
|
|
|
### **Bone Tools** (NEW!)
|
|
```
|
|
Bone Pickaxe = 3x Bone + 2x Wood
|
|
Bone Axe = 3x Bone + 2x Wood
|
|
Bone Hoe = 2x Bone + 2x Wood
|
|
Bone Sword = 2x Bone + 1x Wood
|
|
```
|
|
|
|
### **Basic Tools**
|
|
```
|
|
Wooden Pickaxe = 3x Wood + 2x Stick
|
|
Stone Pickaxe = 3x Stone + 2x Stick
|
|
Stick = 1x Wood → 4x Stick
|
|
```
|
|
|
|
### **Buildings**
|
|
```
|
|
Chest = 8x Wood
|
|
Furnace = 8x Stone + 4x Coal
|
|
```
|
|
|
|
See `src/data/CraftingRecipes.js` for full list.
|
|
|
|
---
|
|
|
|
## 💎 Gem System
|
|
|
|
| Gem | Rarity | Drop Chance | Value |
|
|
|-----|--------|-------------|-------|
|
|
| 💎 Diamond | Legendary | 0.5% | 500g |
|
|
| 💚 Emerald | Epic | 2% | 200g |
|
|
| ❤️ Ruby | Rare | 5% | 100g |
|
|
| 💙 Sapphire | Uncommon | 10% | 50g |
|
|
|
|
Drops from:
|
|
- Zombies (especially elite/boss)
|
|
- Mining ore nodes
|
|
- Special events
|
|
|
|
---
|
|
|
|
## 🎨 UI Theme
|
|
|
|
### **Using the Theme System**
|
|
```javascript
|
|
// Get themed color
|
|
const color = UITheme.getColor('primary.darkBrown');
|
|
|
|
// Create themed button
|
|
const btn = UIHelpers.createButton(scene, x, y, 'Click Me', () => {
|
|
console.log('Clicked!');
|
|
});
|
|
|
|
// Create themed panel
|
|
const panel = UIHelpers.createPanel(scene, x, y, 300, 200, 'wooden');
|
|
|
|
// Create progress bar
|
|
const bar = UIHelpers.createProgressBar(scene, x, y, 200, 20, 0.5);
|
|
bar.setProgress(0.75); // Update to 75%
|
|
```
|
|
|
|
See `src/ui/UITheme.js` and `src/ui/UIHelpers.js` for details.
|
|
|
|
---
|
|
|
|
## 🏗️ Fence Placement System (NEW!)
|
|
|
|
### **Programmatic Fence Placement**
|
|
Place fences at exact coordinates without build mode!
|
|
|
|
```javascript
|
|
// Place single fence
|
|
this.buildSystem.placeSingleFence(50, 30, 'fence_horizontal', false);
|
|
|
|
// Place fence line (Bresenham algorithm)
|
|
this.buildSystem.placeFenceLine(10, 10, 20, 20, 'fence_post', false);
|
|
|
|
// Place fence rectangle (10x8)
|
|
this.buildSystem.placeFenceRectangle(40, 40, 10, 8, 'fence_horizontal', false);
|
|
```
|
|
|
|
### **Available Fence Types**
|
|
- `'fence'` - Old fence
|
|
- `'fence_post'` - Fence post
|
|
- `'fence_horizontal'` - Horizontal →
|
|
- `'fence_vertical'` - Vertical ↓
|
|
- `'fence_corner'` - Corner ⌞
|
|
|
|
### **Quick Start**
|
|
See **[docs/FENCE_QUICK_START.md](docs/FENCE_QUICK_START.md)** for 3-step guide.
|
|
See **[docs/FENCE_PLACEMENT_GUIDE.md](docs/FENCE_PLACEMENT_GUIDE.md)** for full documentation.
|
|
|
|
---
|
|
|
|
## 📊 Performance Testing
|
|
|
|
### **FPS Monitor**
|
|
- Press `F3` to toggle
|
|
- Shows: FPS, Min/Max, Frame time, Sprite count, Memory
|
|
|
|
### **Integration Tests**
|
|
Type in console:
|
|
```javascript
|
|
runTests();
|
|
```
|
|
|
|
This runs 20+ automated tests for:
|
|
- System existence
|
|
- Inventory operations
|
|
- Mount system
|
|
- Gem drops
|
|
- Crafting recipes
|
|
- Performance checks
|
|
|
|
---
|
|
|
|
## 📁 Project Structure
|
|
|
|
```
|
|
novafarma/
|
|
├── src/
|
|
│ ├── scenes/ # Game scenes
|
|
│ │ ├── BootScene.js
|
|
│ │ ├── PreloadScene.js
|
|
│ │ ├── GameScene.js
|
|
│ │ └── UIScene.js
|
|
│ ├── entities/ # Game entities
|
|
│ │ ├── Player.js
|
|
│ │ └── NPC.js
|
|
│ ├── systems/ # Game systems (NEW!)
|
|
│ │ ├── TerrainSystem.js
|
|
│ │ ├── StarterChestSystem.js
|
|
│ │ ├── GemDropSystem.js
|
|
│ │ ├── SaveManager.js
|
|
│ │ ├── AchievementTriggers.js
|
|
│ │ └── ... (20+ more)
|
|
│ ├── ui/ # UI components (NEW!)
|
|
│ │ ├── UITheme.js
|
|
│ │ └── UIHelpers.js
|
|
│ ├── utils/ # Utilities (NEW!)
|
|
│ │ ├── PerformanceMonitor.js
|
|
│ │ ├── IntegrationTests.js
|
|
│ │ └── ...
|
|
│ ├── data/ # Game data (NEW!)
|
|
│ │ └── CraftingRecipes.js
|
|
│ └── game.js
|
|
├── assets/
|
|
├── index.html
|
|
├── package.json
|
|
├── TASKS.md # Development roadmap
|
|
└── README.md # This file
|
|
```
|
|
|
|
---
|
|
|
|
## 🛠️ Technology Stack
|
|
|
|
- **Phaser.js** v3.80.1 - Game engine
|
|
- **Electron.js** v33.2.1 - Desktop wrapper
|
|
- **Node.js** v18+ - Runtime
|
|
- **JavaScript** - ES6+ (no transpiling)
|
|
- **HTML5 Canvas** - Rendering
|
|
- **LocalStorage** - Save data persistence
|
|
|
|
---
|
|
|
|
## 🔧 Development
|
|
|
|
### **Build Commands**
|
|
```bash
|
|
# Development (hot reload)
|
|
npm start
|
|
|
|
# Browser mode
|
|
python -m http.server 8001
|
|
|
|
# Run tests (in browser console)
|
|
runTests()
|
|
```
|
|
|
|
### **Debug Tools**
|
|
- F3 - Performance monitor
|
|
- Browser DevTools - Console, Network, etc.
|
|
- `runTests()` - Integration tests
|
|
|
|
---
|
|
|
|
## 📝 Recent Updates
|
|
|
|
### **12.12.2025 - Fence Placement System**
|
|
- ✅ **Programmatic Fence Placement** - `placeSingleFence()`, `placeFenceLine()`, `placeFenceRectangle()`
|
|
- ✅ **5 Fence Types** - Post, horizontal, vertical, corner, old fence
|
|
- ✅ **Optional Resource Consumption** - Test mode (free) or normal mode (costs wood)
|
|
- ✅ **Collision Detection** - Prevents overlapping buildings
|
|
- ✅ **Complete Documentation** - Quick start guide + full API docs
|
|
- ✅ **Example Code** - Maze generator, spiral generator, and more
|
|
|
|
### **11.12.2025 - LEGENDARY SESSION - 22 COMMITS!**
|
|
- ✅ Save/Load System (3 slots + auto-save)
|
|
- ✅ Achievement System (8 achievements)
|
|
- ✅ Gem Drop System (4 gem types)
|
|
- ✅ Bone Tools Crafting (4 tools)
|
|
- ✅ Starter Chest (seed-based loot)
|
|
- ✅ Performance Monitor (FPS/memory)
|
|
- ✅ Integration Tests (20+ tests)
|
|
- ✅ UI Theme System (rustic/post-apo)
|
|
- ✅ UI Helpers (buttons, panels, etc.)
|
|
|
|
**Total:** 2,109 lines of new code in 4.8 hours! 🔥
|
|
|
|
---
|
|
|
|
## 📖 Documentation
|
|
|
|
- **TASKS.md** - Full development roadmap and phase breakdown
|
|
- **DNEVNIK.md** - Development journal
|
|
- **SYSTEM_REQUIREMENTS.md** - Platform requirements
|
|
- **docs/FENCE_QUICK_START.md** - 3-step fence placement guide (NEW!)
|
|
- **docs/FENCE_PLACEMENT_GUIDE.md** - Complete fence API documentation (NEW!)
|
|
- **src/ui/UITheme.js** - UI theme documentation
|
|
- **src/data/CraftingRecipes.js** - All crafting recipes
|
|
|
|
---
|
|
|
|
## 🤝 Contributing
|
|
|
|
This is a solo project, but suggestions welcome!
|
|
|
|
---
|
|
|
|
## 📜 License
|
|
|
|
Private project - All rights reserved
|
|
|
|
---
|
|
|
|
## 🎮 Credits
|
|
|
|
**Developer:** Antigravity AI Assistant + Human Collaborator
|
|
**Engine:** Phaser.js
|
|
**Art Style:** Pixel Art (2.5D Isometric)
|
|
**Genre:** Survival, Farming, Post-Apocalyptic
|
|
|
|
---
|
|
|
|
**Made with ❤️ and lots of ☕**
|
|
|
|
*Last Updated: 12.12.2025 - Fence Placement System*
|
|
|