diff --git a/ai_image_gen/apple.md b/ai_image_gen/apple.md new file mode 100644 index 000000000..94ae09202 --- /dev/null +++ b/ai_image_gen/apple.md @@ -0,0 +1,84 @@ +# AI Image Generation na MacOS (Apple Silicon M1/M2/M3/M4) + +MacOS z Apple Silicon čipi (M4) ne podpira Nvidia CUDA, zato ne morete uporabljati "navadnih" navodil za Nvidia RTX. Namesto tega uporabljamo **MPS (Metal Performance Shaders)**, ki omogoča uporabo grafičnega čipa na M4 procesorju. + +## Priporočena Pot: ComfyUI (Native ali Docker) + +Najbolj robusten način za poganjanje naprednih AI modelov (kot je Qwen-VL ali Stable Diffusion z Qwen text encoderjem) na Macu je uporaba **ComfyUI**, ki ima odlično podporo za MacOS. + +### 1. Namestitev (Python venv method) + +To je "native" način, ki teče direktno na tvojem Macu. + +**Predpogoji:** +- Python 3.10 ali 3.11 (priporočeno) +- Git + +**Postopek:** + +1. **Odpri Terminal** in pojdi v mapo, kjer želiš imeti program: + ```bash + cd ~/repos/novafarma/ai_image_gen # ali kamorkoli želiš + ``` + +2. **Kloniraj ComfyUI:** + ```bash + git clone https://github.com/comfyanonymous/ComfyUI + cd ComfyUI + ``` + +3. **Ustvari virtualno okolje:** + ```bash + python3 -m venv venv + source venv/bin/activate + ``` + +4. **Namesti torch za MacOS (Nightly build za najboljšo M4 podporo):** + ```bash + pip install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu + ``` + +5. **Namesti ostale odvisnosti:** + ```bash + pip install -r requirements.txt + ``` + +6. **Zaženi:** + ```bash + python main.py + ``` + +### 2. Uporaba Qwen Modelov + +Qwen (Qwen-VL ali Qwen2-VL) so primarno "Vision-Language" modeli. Če jih želiš uporabljati za generiranje slik ali "chatting with images": + +1. Namesti **ComfyUI-Qwen-VL-Chat** (custom node): + - Pojdi v `ComfyUI/custom_nodes` + - `git clone https://github.com/StartInception/ComfyUI-Qwen-VL-Chat` + - `pip install -r requirements.txt` (znotraj venv) + +2. **Prenesi model:** + - Modeli so ponavadi v `.gguf` formatu za Mac (manj RAM-a) ali originalni `transformers` format. + - Prenesi npr. `Qwen2-VL-7B-Instruct` iz HuggingFace. + +## Alternativa: MLX (Apple Framework) + +Za maksimalno hitrost na M4 čipu obstaja knjižnica **MLX** od Apple-a. + +1. **Namestitev:** + ```bash + pip install mlx-lm + ``` + +2. **Uporaba:** + MLX ekipa redno porta Qwen modele. + ```bash + # Primer za Qwen text model + python -m mlx_lm.generate --model Qwen/Qwen2.5-7B-Instruct-mlx --prompt "Hello" + ``` + Za slike (VL modeli) preveri `mlx-examples` repozitorij na GitHubu. + +## Pomembno za M4 Uporabnike + +- **RAM je VRAM:** Tvoj sistemski RAM (npr. 32GB ali 64GB) se uporablja kot video spomin. Zapri Chrome/Electron aplikacije, ko generiraš slike, da sprostiš spomin. +- **Toplota:** Dolgotrajno generiranje bo segrelo prenosnik/Mac Mini. To je normalno. diff --git a/ai_image_gen/rtx.md b/ai_image_gen/rtx.md new file mode 100644 index 000000000..029b18a79 --- /dev/null +++ b/ai_image_gen/rtx.md @@ -0,0 +1,65 @@ +# AI Image Generation na PC (Nvidia RTX) + +Nvidia RTX kartice so industrijski standard za AI. Uporabljajo **CUDA** jedra, kar zagotavlja najhitrejše generiranje in najširšo podporo. + +## Priporočena Pot: ComfyUI (Windows/Linux) + +### 1. Priprava Driverjev + +- Posodobi Nvidia Studio ali Game Ready driverje na zadnjo verzijo. +- Namesti **CUDA Toolkit** (če delaš "ročno" namestitev, čeprav Torch to pogosto prinese s seboj). + +### 2. Namestitev ComfyUI (Portable - Najlažje za Windows) + +Če si na Windowsih, je najlažja pot "Portable" verzija, ki ima vse vključeno (Python, Torch, itd.). + +1. **Prenesi:** + - Pojdi na [ComfyUI GitHub releases](https://github.com/comfyanonymous/ComfyUI/releases). + - Prenesi `ComfyUI_windows_portable_nvidia_cu121_or_cpu.7z`. + +2. **Razširi:** + - Odzipaj datoteko v `C:\AI\ComfyUI` (ali podobno mapo brez presledkov v imenu). + +3. **Zaženi:** + - Klikni `run_nvidia_gpu.bat`. + +### 3. Ročna Namestitev (Linux / Advanced Windows) + +1. Kloniraj repo: + ```bash + git clone https://github.com/comfyanonymous/ComfyUI + ``` +2. Virtualno okolje in Torch (CUDA verzija): + ```bash + python -m venv venv + source venv/bin/activate # ali venv\Scripts\activate na Win + pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 + ``` +3. Ostalo: + ```bash + pip install -r requirements.txt + python main.py + ``` + +## Uporaba Qwen Modelov na RTX + +Ker imaš RTX kartico, lahko poganjaš polne (ne-kvantizirane) modele, če imaš dovolj VRAM-a (npr. 24GB na 3090/4090). + +### Qwen2-VL (Vision Language) + +1. **Custom Nodes:** + - Namesti `ComfyUI-Qwen-VL-Chat` preko ComfyUI Managerja (priporočam namestitev Managerja: `git clone https://github.com/ltdrdata/ComfyUI-Manager` v `custom_nodes`). + +2. **Modeli:** + - Prenesi modele iz HuggingFace (npr. `Qwen/Qwen2-VL-7B-Instruct`). + - Shrani jih v `ComfyUI/models/LLM` (morda boš moral ustvariti mapo, odvisno od custom node-a). + +### VRAM Optimizacija + +- **RTX 3060 (12GB) / 4060 Ti (16GB):** Uporabljaj `fp16` ali `int8` (kvantizirane) verzije modelov za hitrost in manjšo porabo spomina. +- **RTX 3090 / 4090 (24GB):** Lahko poganjaš večje modele (npr. 70B int4 ali 7B fp16) brez težav. + +## Ostale Možnosti za RTX + +- **Ollama:** Odlično za tekstovne/chat modele (tudi Qwen), teče lokalno in podpira GPU pospeševanje avtomatsko. +- **LM Studio:** GUI za nalaganje GGUF modelov, zelo enostaven za uporabo na Windowsih. diff --git a/assets/audio/voiceover/prologue/prologue_03.wav b/assets/audio/voiceover/prologue/prologue_03.wav index 9dca34676..95ee59306 100644 Binary files a/assets/audio/voiceover/prologue/prologue_03.wav and b/assets/audio/voiceover/prologue/prologue_03.wav differ diff --git a/assets/maps/NovaFarma.json b/assets/maps/NovaFarma.json new file mode 100644 index 000000000..4cbfb3449 --- /dev/null +++ b/assets/maps/NovaFarma.json @@ -0,0 +1,141 @@ +{ + "compressionlevel": -1, + "height": 8, + "infinite": false, + "layers": [ + { + "data": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "height": 8, + "id": 1, + "name": "Ground", + "opacity": 1, + "type": "tilelayer", + "visible": true, + "width": 8, + "x": 0, + "y": 0 + } + ], + "nextlayerid": 4, + "nextobjectid": 1, + "orientation": "orthogonal", + "renderorder": "right-down", + "tiledversion": "1.11.2", + "tileheight": 32, + "tilesets": [ + { + "firstgid": 1, + "source": "01_Ground.tsx", + "name": "01_Ground", + "tilewidth": 32, + "tileheight": 32, + "imageheight": 512, + "imagewidth": 512 + }, + { + "firstgid": 300, + "source": "02_Obstacles.tsx", + "name": "02_Obstacles", + "tilewidth": 32, + "tileheight": 32, + "imageheight": 512, + "imagewidth": 512 + }, + { + "firstgid": 600, + "source": "04_Buildings.tsx", + "name": "04_Buildings", + "tilewidth": 32, + "tileheight": 32, + "imageheight": 512, + "imagewidth": 512 + }, + { + "firstgid": 900, + "source": "03_Fences.tsx", + "name": "03_Fences", + "tilewidth": 32, + "tileheight": 32, + "imageheight": 512, + "imagewidth": 512 + }, + { + "firstgid": 1200, + "source": "05_Tools_Items.tsx", + "name": "05_Tools_Items", + "tilewidth": 32, + "tileheight": 32, + "imageheight": 512, + "imagewidth": 512 + } + ], + "tilewidth": 32, + "type": "map", + "version": "1.10", + "width": 8 +} \ No newline at end of file diff --git a/assets/maps/NovaFarma.tmx b/assets/maps/NovaFarma.tmx index 1f026bd48..3e18196c2 100644 --- a/assets/maps/NovaFarma.tmx +++ b/assets/maps/NovaFarma.tmx @@ -1,14 +1,14 @@ - + - + - - + + 0,0,0,0,0,0,0,0, @@ -22,18 +22,5 @@ - - - - - - - - - - - - - - + diff --git a/novafarma.tiled-session b/novafarma.tiled-session index 233a7491f..f970185e8 100644 --- a/novafarma.tiled-session +++ b/novafarma.tiled-session @@ -1,5 +1,5 @@ { - "activeFile": "", + "activeFile": "assets/maps/NovaFarma.tmx", "expandedProjectPaths": [ "assets/maps" ], @@ -10,20 +10,27 @@ "assets/maps/02_Obstacles.tsx": { "scaleInDock": 1 }, + "assets/maps/03_Fences.tsx": { + "scaleInDock": 1 + }, "assets/maps/04_Buildings.tsx": { "scaleInDock": 1 }, + "assets/maps/05_Tools_Items.tsx": { + "scaleInDock": 1 + }, "assets/maps/NovaFarma.tmx": { - "scale": 0.17070312499999998, + "scale": 1, "selectedLayer": 0, "viewCenter": { - "x": -187.4599542334097, - "y": 2.9290617848969305 + "x": -16.5, + "y": 196 } } }, "last.externalTilesetPath": "/Users/davidkotnik/repos/novafarma/assets/maps", "openFiles": [ + "assets/maps/NovaFarma.tmx" ], "project": "novafarma.tiled-project", "recentFiles": [ diff --git a/src/scenes/PreloadScene.js b/src/scenes/PreloadScene.js index 3a1204d3c..1f4d4c5a3 100644 --- a/src/scenes/PreloadScene.js +++ b/src/scenes/PreloadScene.js @@ -35,9 +35,16 @@ class PreloadScene extends Phaser.Scene { // this.load.tilemapTiledJSON('farm_map', 'assets/maps/farm_map.json'); // this.load.tilemapTiledJSON('micro_farm_128x128', 'assets/maps/micro_farm_128x128.json'); // 🌾 Testna farma // this.load.tilemapTiledJSON('micro_farm_8x8', 'assets/maps/micro_farm_8x8.json'); // 🏕️ Manjša test mapa - this.load.image('grass_tileset_img', 'assets/tilesets/grass.png'); - this.load.image('water_tileset_img', 'assets/tilesets/water.png'); - this.load.image('decorations_tileset_img', 'assets/tilesets/decorations.png'); + // 🗺️ TILED MAP (User's NovaFarma) + this.load.tilemapTiledJSON('NovaFarma', 'assets/maps/NovaFarma.json'); + + // 🎨 TILED TILESETS (Manual Loading) + const kzPath = 'assets/narezano_in_majhno/krvava_zetev_sprites/'; + this.load.image('tileset_01_Ground', kzPath + 'grass_soil_tileset_1766171156780_obdelan.png'); + this.load.image('tileset_02_Obstacles', kzPath + 'farm_obstacles_1766171194583_obdelan.png'); + this.load.image('tileset_03_Fences', kzPath + 'fence_tileset_1766171177275_obdelan.png'); + this.load.image('tileset_04_Buildings', kzPath + 'town_buildings_pack_1766099810580_obdelan.png'); + this.load.image('tileset_05_Tools_Items', kzPath + 'tools_items_pack_tiled_1766099926620_obdelan.png'); // New asset packs this.load.image('objects_pack', 'assets/objects_pack.png'); @@ -771,8 +778,8 @@ class PreloadScene extends Phaser.Scene { // ✅ Starting main menu (StoryScene) this.time.delayedCall(500, () => { - console.log('🎮 Starting StoryScene (Main Menu)...'); - this.scene.start('StoryScene'); // ← MAIN MENU + console.log('🎮 Starting TiledTestScene (NovaFarma Test)...'); + this.scene.start('TiledTestScene'); // ← Direct jump to Tiled Test }); } diff --git a/src/scenes/TiledTestScene.js b/src/scenes/TiledTestScene.js index ee4c7eab5..fcbc6232d 100644 --- a/src/scenes/TiledTestScene.js +++ b/src/scenes/TiledTestScene.js @@ -14,8 +14,8 @@ class TiledTestScene extends Phaser.Scene { // Try to load the tilemap try { - // Load the micro farm tilemap - this.map = this.make.tilemap({ key: 'micro_farm_128x128' }); + // Load the USER'S NovaFarma tilemap + this.map = this.make.tilemap({ key: 'NovaFarma' }); console.log(`📐 Map size: ${this.map.width}x${this.map.height} tiles`); console.log(`📐 Tile size: ${this.map.tileWidth}x${this.map.tileHeight}px`); console.log(`📐 Map dimensions: ${this.map.widthInPixels}x${this.map.heightInPixels}px`); @@ -33,7 +33,6 @@ class TiledTestScene extends Phaser.Scene { }); // Add tilesets - mora biti enako kot v .tmx! - // BELEŽKA: Ta imena morajo biti enaka kot v micro_farm_128x128.tmx const tilesets = {}; // Poskusi dodati tilesets @@ -81,11 +80,8 @@ class TiledTestScene extends Phaser.Scene { this.cameras.main.setBounds(0, 0, mapWidth, mapHeight); - // Zoom out to see the whole 128x128 map - // 128 tiles * 48px = 6144px - // Typical screen is ~1920x1080 - // Zoom = 1920 / 6144 ≈ 0.3 (adjust for comfort) - const zoomLevel = 0.4; + // Zoom IN for small 8x8 map + const zoomLevel = 2.0; this.cameras.main.setZoom(zoomLevel); console.log(`📷 Camera zoom set to ${zoomLevel}`);