#!/usr/bin/env python3 """ SLOW MODE GENERATOR - Works within quota limits Generates 1 image every 3 minutes = 20 images per hour = safe! """ import time import vertexai from vertexai.preview.vision_models import ImageGenerationModel from pathlib import Path PROJECT_ID = "gen-lang-client-0428644398" LOCATION = "us-central1" BASE_PATH = Path("/Users/davidkotnik/repos/novafarma/assets/slike") # Style 32 detailed STYLE_32 = """Style 32: Cult of the Lamb cute-dark aesthetic. CRITICAL: Bold thick black outlines (3px), chibi proportions (head = 1/3 body), pastel-gothic colors (dusty pink #E8B4D4, muted purple #9B7FB5, cream #F5EFE6, noir shadows #2D2D2D), big expressive eyes (1/4 of face), smooth gradients, cute-dark contradiction. """ COMMON = """2D game sprite, pixel-perfect clarity, centered with 10px margin, solid chroma green background (#00FF00).""" # Priority assets - most important first PRIORITY_QUEUE = [ # Zombies (most important for gameplay) ("kreature/zombiji", "zombie_basic_idle", f"{STYLE_32}Basic shambling zombie, rotting flesh, exposed ribs, tattered clothing, blank eyes. IDLE: standing still, slight sway. {COMMON}"), ("kreature/zombiji", "zombie_basic_walk", f"{STYLE_32}Basic shambling zombie, rotting flesh, exposed ribs, tattered clothing. WALKING forward, shambling gait, Stardew Valley hop style. {COMMON}"), ("kreature/zombiji", "zombie_basic_attack", f"{STYLE_32}Basic shambling zombie, rotting flesh, exposed ribs. ATTACKING: arms extended forward, bite motion. {COMMON}"), ("kreature/zombiji", "zombie_runner_idle", f"{STYLE_32}Fast aggressive zombie, sprinting pose, lean athletic build, wild hair, crazed expression. IDLE: aggressive stance, ready to run. {COMMON}"), ("kreature/zombiji", "zombie_runner_walk", f"{STYLE_32}Fast aggressive zombie, lean build, wild hair. RUNNING: full sprint pose, speed motion. {COMMON}"), ("kreature/zombiji", "zombie_runner_attack", f"{STYLE_32}Fast aggressive zombie. ATTACKING: diving tackle lunge. {COMMON}"), ("kreature/zombiji", "zombie_tank_idle", f"{STYLE_32}Massive bulky zombie, muscular frame, cracked skin, intimidating chunky. IDLE: heavy breathing, powerful stance. {COMMON}"), ("kreature/zombiji", "zombie_tank_walk", f"{STYLE_32}Massive bulky zombie, muscular. WALKING: slow powerful stomp. {COMMON}"), ("kreature/zombiji", "zombie_tank_attack", f"{STYLE_32}Massive bulky zombie. ATTACKING: overhead smash motion. {COMMON}"), # Animals (farm basics) ("kreature/zivali", "chicken_idle", f"{STYLE_32}Cute farm chicken, fluffy feathers, chunky body, big eyes. IDLE: standing, pecking ground. {COMMON}"), ("kreature/zivali", "chicken_walk", f"{STYLE_32}Cute farm chicken, fluffy. WALKING: waddle gait. {COMMON}"), ("kreature/zivali", "cow_idle", f"{STYLE_32}Farm cow, spotted pattern, big eyes, friendly. IDLE: standing, chewing. {COMMON}"), ("kreature/zivali", "cow_walk", f"{STYLE_32}Farm cow, spotted. WALKING: slow amble. {COMMON}"), # NPCs (basic town) ("npc/trgovci", "merchant_general", f"{STYLE_32}General store merchant, apron over casual clothes, welcoming smile, friendly shopkeeper. IDLE pose behind counter. {COMMON}"), ("npc/zdravstvo", "doctor_main", f"{STYLE_32}Town doctor, white coat, stethoscope, glasses, kind wise expression. IDLE pose standing. {COMMON}"), ] def generate_slow(): """Generate assets slowly to stay within quota.""" print("=" * 70) print("🐌 SLOW MODE GENERATOR") print("=" * 70) print("Rate: 1 image every 3 minutes") print(f"Queue: {len(PRIORITY_QUEUE)} assets") print(f"Total time: ~{len(PRIORITY_QUEUE) * 3} minutes") print("=" * 70) print() vertexai.init(project=PROJECT_ID, location=LOCATION) model = ImageGenerationModel.from_pretrained("imagen-3.0-generate-001") success = 0 failed = 0 for i, (category, filename, prompt) in enumerate(PRIORITY_QUEUE, 1): print(f"[{i}/{len(PRIORITY_QUEUE)}] {category}/{filename}") print(f" Generating...") try: response = model.generate_images( prompt=prompt, number_of_images=1, aspect_ratio="1:1", safety_filter_level="block_few", person_generation="allow_adult" ) if response.images: # Save output_dir = BASE_PATH / category output_dir.mkdir(parents=True, exist_ok=True) output_path = output_dir / f"{filename}.png" response.images[0].save(location=str(output_path)) print(f" ✅ SAVED: {output_path}") success += 1 else: print(f" ❌ FAILED: No image returned") failed += 1 except Exception as e: print(f" ❌ ERROR: {e}") failed += 1 if "429" in str(e) or "Quota" in str(e): print(f" ⏰ QUOTA HIT - Waiting 10 minutes...") time.sleep(600) # Wait 10 min if quota hit continue # Progress print(f" Progress: {success} success, {failed} failed") print() # SLOW DOWN - 3 minutes between images if i < len(PRIORITY_QUEUE): print(f" ⏰ Waiting 3 minutes before next image...") time.sleep(180) # 3 minutes print() # Summary print("=" * 70) print("✅ SLOW GENERATION COMPLETE!") print(f" Success: {success}") print(f" Failed: {failed}") print("=" * 70) if __name__ == "__main__": generate_slow()