Save all: Fixed blue screen, VibeVoice audio, Tiled setup

This commit is contained in:
2025-12-27 02:11:06 +01:00
parent 6a01731de0
commit 41fc635f3a
8 changed files with 322 additions and 35 deletions

84
ai_image_gen/apple.md Normal file
View File

@@ -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.

65
ai_image_gen/rtx.md Normal file
View File

@@ -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.

141
assets/maps/NovaFarma.json Normal file
View File

@@ -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
}

View File

@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.11.2" orientation="orthogonal" renderorder="right-down" width="8" height="8" tilewidth="32" tileheight="32" infinite="0" nextlayerid="4" nextobjectid="5"> <map version="1.10" tiledversion="1.11.2" orientation="orthogonal" renderorder="right-down" width="8" height="8" tilewidth="32" tileheight="32" infinite="0" nextlayerid="4" nextobjectid="1">
<properties> <properties>
<property name="description" value="FAZA 1 - Kickstarter Demo Map (8x8)"/> <property name="description" value="FAZA 1 - Kickstarter Demo Map (Empty)"/>
<property name="name" value="NovaFarma"/> <property name="name" value="NovaFarma"/>
<property name="spawnX" value="4"/>
<property name="spawnY" value="4"/>
</properties> </properties>
<tileset firstgid="1" source="01_Ground.tsx"/> <tileset firstgid="1" source="01_Ground.tsx"/>
<tileset firstgid="300" source="02_Obstacles.tsx"/> <tileset firstgid="300" source="02_Obstacles.tsx"/>
<tileset firstgid="600" source="04_Buildings.tsx"/> <tileset firstgid="600" source="04_Buildings.tsx"/>
<tileset firstgid="900" source="03_Fences.tsx"/>
<tileset firstgid="1200" source="05_Tools_Items.tsx"/>
<layer id="1" name="Ground" width="8" height="8"> <layer id="1" name="Ground" width="8" height="8">
<data encoding="csv"> <data encoding="csv">
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
@@ -22,18 +22,5 @@
</data> </data>
</layer> </layer>
<objectgroup id="2" name="Objects"/> <objectgroup id="2" name="Objects"/>
<objectgroup id="3" name="SpawnPoints"> <objectgroup id="3" name="SpawnPoints"/>
<object id="1" name="kai_spawn" x="192" y="192">
<point/>
</object>
<object id="2" name="zombie_spawn" x="288" y="144">
<point/>
</object>
<object id="3" name="grok_spawn" x="96" y="96">
<point/>
</object>
<object id="4" name="susi_spawn" x="240" y="288">
<point/>
</object>
</objectgroup>
</map> </map>

View File

@@ -1,5 +1,5 @@
{ {
"activeFile": "", "activeFile": "assets/maps/NovaFarma.tmx",
"expandedProjectPaths": [ "expandedProjectPaths": [
"assets/maps" "assets/maps"
], ],
@@ -10,20 +10,27 @@
"assets/maps/02_Obstacles.tsx": { "assets/maps/02_Obstacles.tsx": {
"scaleInDock": 1 "scaleInDock": 1
}, },
"assets/maps/03_Fences.tsx": {
"scaleInDock": 1
},
"assets/maps/04_Buildings.tsx": { "assets/maps/04_Buildings.tsx": {
"scaleInDock": 1 "scaleInDock": 1
}, },
"assets/maps/05_Tools_Items.tsx": {
"scaleInDock": 1
},
"assets/maps/NovaFarma.tmx": { "assets/maps/NovaFarma.tmx": {
"scale": 0.17070312499999998, "scale": 1,
"selectedLayer": 0, "selectedLayer": 0,
"viewCenter": { "viewCenter": {
"x": -187.4599542334097, "x": -16.5,
"y": 2.9290617848969305 "y": 196
} }
} }
}, },
"last.externalTilesetPath": "/Users/davidkotnik/repos/novafarma/assets/maps", "last.externalTilesetPath": "/Users/davidkotnik/repos/novafarma/assets/maps",
"openFiles": [ "openFiles": [
"assets/maps/NovaFarma.tmx"
], ],
"project": "novafarma.tiled-project", "project": "novafarma.tiled-project",
"recentFiles": [ "recentFiles": [

View File

@@ -35,9 +35,16 @@ class PreloadScene extends Phaser.Scene {
// this.load.tilemapTiledJSON('farm_map', 'assets/maps/farm_map.json'); // 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_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.tilemapTiledJSON('micro_farm_8x8', 'assets/maps/micro_farm_8x8.json'); // 🏕️ Manjša test mapa
this.load.image('grass_tileset_img', 'assets/tilesets/grass.png'); // 🗺️ TILED MAP (User's NovaFarma)
this.load.image('water_tileset_img', 'assets/tilesets/water.png'); this.load.tilemapTiledJSON('NovaFarma', 'assets/maps/NovaFarma.json');
this.load.image('decorations_tileset_img', 'assets/tilesets/decorations.png');
// 🎨 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 // New asset packs
this.load.image('objects_pack', 'assets/objects_pack.png'); this.load.image('objects_pack', 'assets/objects_pack.png');
@@ -771,8 +778,8 @@ class PreloadScene extends Phaser.Scene {
// ✅ Starting main menu (StoryScene) // ✅ Starting main menu (StoryScene)
this.time.delayedCall(500, () => { this.time.delayedCall(500, () => {
console.log('🎮 Starting StoryScene (Main Menu)...'); console.log('🎮 Starting TiledTestScene (NovaFarma Test)...');
this.scene.start('StoryScene'); // ← MAIN MENU this.scene.start('TiledTestScene'); // ← Direct jump to Tiled Test
}); });
} }

View File

@@ -14,8 +14,8 @@ class TiledTestScene extends Phaser.Scene {
// Try to load the tilemap // Try to load the tilemap
try { try {
// Load the micro farm tilemap // Load the USER'S NovaFarma tilemap
this.map = this.make.tilemap({ key: 'micro_farm_128x128' }); this.map = this.make.tilemap({ key: 'NovaFarma' });
console.log(`📐 Map size: ${this.map.width}x${this.map.height} tiles`); 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(`📐 Tile size: ${this.map.tileWidth}x${this.map.tileHeight}px`);
console.log(`📐 Map dimensions: ${this.map.widthInPixels}x${this.map.heightInPixels}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! // Add tilesets - mora biti enako kot v .tmx!
// BELEŽKA: Ta imena morajo biti enaka kot v micro_farm_128x128.tmx
const tilesets = {}; const tilesets = {};
// Poskusi dodati tilesets // Poskusi dodati tilesets
@@ -81,11 +80,8 @@ class TiledTestScene extends Phaser.Scene {
this.cameras.main.setBounds(0, 0, mapWidth, mapHeight); this.cameras.main.setBounds(0, 0, mapWidth, mapHeight);
// Zoom out to see the whole 128x128 map // Zoom IN for small 8x8 map
// 128 tiles * 48px = 6144px const zoomLevel = 2.0;
// Typical screen is ~1920x1080
// Zoom = 1920 / 6144 ≈ 0.3 (adjust for comfort)
const zoomLevel = 0.4;
this.cameras.main.setZoom(zoomLevel); this.cameras.main.setZoom(zoomLevel);
console.log(`📷 Camera zoom set to ${zoomLevel}`); console.log(`📷 Camera zoom set to ${zoomLevel}`);