#!/usr/bin/env python3 """ COMPLETE BIOME ASSET GENERATOR Generates ALL missing biome assets with dual art style (Style A + B) """ import os import time import requests import json from pathlib import Path # ======================================== # CONFIGURATION # ======================================== PROJECT_ROOT = Path("/Users/davidkotnik/repos/novafarma") BIOME_ROOT = PROJECT_ROOT / "assets/slike/biomi" # Gemini API endpoint (ฤe imaลก API key) API_KEY = os.getenv("GEMINI_API_KEY") # Set this in environment API_URL = "https://generativelanguage.googleapis.com/v1beta/models/gemini-3-pro-image:generateImage" # Art styles STYLE_A = "cartoon vector art with bold black outlines (1.4px), flat vibrant colors, clean playful aesthetic" STYLE_B = "dark hand-drawn gritty noir style with dramatic shadows, high contrast, sketchy atmospheric lines" # ======================================== # BIOME DEFINITIONS # ======================================== BIOMES = { "dino_valley": { "rekviziti": [ "dinosaur_skeleton_full", "dino_ribcage", "fossil_imprint", "amber_chunk_insect", "dino_tooth_large", "dino_nest_eggs", "volcanic_rock_cluster", "steam_vent_active", "tar_pit_bubbles", "cave_entrance_prehistoric", "ruins_pillar_ancient", "ruins_wall_ancient", "stone_altar_prehistoric", "lava_flow", "geyser_active", "dino_claw_large", "precious_stone_raw", "ancient_artifact", "plant_sample_rare", "volcano_background" ], "npcs": [ "paleontologist", "cave_person_male", "cave_person_female", "cave_child", "dino_keeper_romance" ], # Add other categories as needed }, # Add other biomes... } # ======================================== # HELPER FUNCTIONS # ======================================== def check_existing_assets(biome_name, category): """Check which assets already exist""" folder = BIOME_ROOT / biome_name / category if not folder.exists(): return [] existing = [] for file in folder.glob("*.png"): # Extract base name without _styleA/B suffix name = file.stem if name.endswith("_stylea") or name.endswith("_styleb"): base = name.rsplit("_style", 1)[0] existing.append(base) return list(set(existing)) def generate_asset_prompt(asset_name, asset_type, style): """Generate prompt for specific asset""" category_prompts = { "rekviziti": "2D game prop", "npcs": "2D game character NPC", "vegetacija": "2D game vegetation", "teren": "2D game terrain tile, seamlessly tileable", "fauna": "2D game creature", "zgradbe": "2D game building/structure", "hrana": "2D game food item", "materiali": "2D game crafting material", "oblacila": "2D game clothing/armor piece", "orodja": "2D game tool/weapon" } base_prompt = category_prompts.get(asset_type, "2D game asset") style_text = STYLE_A if style == "A" else STYLE_B # Format asset name to readable readable_name = asset_name.replace("_", " ").title() prompt = f"{base_prompt}, {style_text}. Asset: {readable_name}. Background: SOLID BRIGHT CHROMA KEY GREEN (#00FF00), centered, game-ready." return prompt def save_to_file(image_data, filepath): """Save generated image to file""" filepath.parent.mkdir(parents=True, exist_ok=True) with open(filepath, 'wb') as f: f.write(image_data) print(f"โœ… Saved: {filepath.name}") # ======================================== # MAIN GENERATION LOGIC # ======================================== def generate_missing_assets(biome_name, category, assets_list): """Generate all missing assets for a biome category""" existing = check_existing_assets(biome_name, category) missing = [a for a in assets_list if a not in existing] if not missing: print(f"โœ… {biome_name}/{category} - All assets exist!") return print(f"\n๐ŸŽจ Generating {biome_name}/{category}: {len(missing)} assets missing") for asset_name in missing: for style in ["A", "B"]: filename = f"{asset_name.lower()}_style{style.lower()}.png" filepath = BIOME_ROOT / biome_name / category / filename if filepath.exists(): print(f"โญ๏ธ Skipping (exists): {filename}") continue print(f"๐Ÿ–ผ๏ธ Generating: {filename}") prompt = generate_asset_prompt(asset_name, category, style) # TODO: Replace with actual API call # For now, just create placeholder print(f" Prompt: {prompt[:80]}...") # Simulate generation delay time.sleep(1) # NOTE: Replace this with actual image generation API call # image_data = call_image_api(prompt) # save_to_file(image_data, filepath) print(f"โœ… {biome_name}/{category} complete!") # ======================================== # SCRIPT EXECUTION # ======================================== if __name__ == "__main__": print("="*60) print("๐Ÿฆ– BIOME ASSET GENERATOR - COMPLETE EDITION") print("="*60) total_generated = 0 for biome_name, categories in BIOMES.items(): print(f"\n{'='*60}") print(f"๐Ÿ“ BIOME: {biome_name.upper()}") print(f"{'='*60}") for category, assets in categories.items(): generate_missing_assets(biome_name, category, assets) total_generated += len(assets) * 2 # ร— 2 for dual styles print(f"\n{'='*60}") print(f"โœ… GENERATION COMPLETE!") print(f"๐Ÿ“Š Total assets processed: {total_generated}") print(f"{'='*60}")