"""Preset configurations for different game asset styles.
Optimized for SDXL models with proper resolutions and prompts.
"""
from dataclasses import dataclass
from typing import Dict, Any
@dataclass
class Preset:
"""A preset configuration for asset generation."""
name: str
description: str
prompt_prefix: str
prompt_suffix: str
negative_prompt: str
default_width: int
default_height: int
steps: int
cfg_scale: float
sampler: str = "euler_ancestral"
scheduler: str = "karras"
def to_dict(self) -> Dict[str, Any]:
return {
"name": self.name,
"description": self.description,
"prompt_prefix": self.prompt_prefix,
"prompt_suffix": self.prompt_suffix,
"negative_prompt": self.negative_prompt,
"default_width": self.default_width,
"default_height": self.default_height,
"steps": self.steps,
"cfg_scale": self.cfg_scale,
"sampler": self.sampler,
"scheduler": self.scheduler
}
# Common negative prompts for game assets
NEGATIVE_COMMON = "blurry, low quality, watermark, signature, text, jpeg artifacts, noise, grain"
NEGATIVE_ICON = "complex background, text, watermark, cropped, off-center, multiple objects, busy, cluttered"
NEGATIVE_CHARACTER = "multiple characters, background scenery, cropped, blurry, bad anatomy, deformed"
NEGATIVE_PIXEL = "blurry, smooth, realistic, 3d, anti-aliased, high resolution details, gradients"
PRESETS: Dict[str, Preset] = {
# === SDXL-Optimized Presets (1024x1024 base) ===
"default": Preset(
name="default",
description="General purpose game asset (SDXL optimized)",
prompt_prefix="a single ",
prompt_suffix=", game asset, centered composition, isolated object, clean edges, solid color background, high quality, professional game art",
negative_prompt=NEGATIVE_COMMON,
default_width=1024,
default_height=1024,
steps=25,
cfg_scale=6.0
),
"icon": Preset(
name="icon",
description="Game icons - clear, centered, high contrast (SDXL)",
prompt_prefix="a single ",
prompt_suffix=" icon, clean game icon design, centered, isolated, clear silhouette, simple shape, professional, highly polished, smooth shading, sharp edges, studio lighting, 2d game icon, solid background, no text",
negative_prompt=NEGATIVE_ICON + ", ugly, deformed, lowres, bad proportions, messy, noisy",
default_width=1024,
default_height=1024,
steps=35,
cfg_scale=5.5,
sampler="dpmpp_2m_sde",
scheduler="karras"
),
"icon_item": Preset(
name="icon_item",
description="Item icons for inventory (sword, potion, etc.)",
prompt_prefix="game item icon of ",
prompt_suffix=", RPG item icon, centered, isolated object, clear silhouette, stylized, highly polished, smooth shading, sharp edges, studio lighting, 2d game art, solid background, no text",
negative_prompt=NEGATIVE_ICON + ", realistic, photographic, ugly, deformed, lowres, bad proportions, messy, noisy",
default_width=1024,
default_height=1024,
steps=35,
cfg_scale=5.5,
sampler="dpmpp_2m_sde",
scheduler="karras"
),
"character": Preset(
name="character",
description="Character sprites - full body, clear pose (SDXL)",
prompt_prefix="game character, ",
prompt_suffix=", character design, full body view, clear pose, standing, facing viewer, solid color background, game art style, high detail",
negative_prompt=NEGATIVE_CHARACTER,
default_width=768,
default_height=1024,
steps=30,
cfg_scale=6.0
),
"character_portrait": Preset(
name="character_portrait",
description="Character portraits - face/bust focus",
prompt_prefix="character portrait of ",
prompt_suffix=", game character portrait, bust shot, facing viewer, expressive, detailed face, solid background, game art style",
negative_prompt=NEGATIVE_CHARACTER + ", full body, legs visible",
default_width=1024,
default_height=1024,
steps=30,
cfg_scale=6.0
),
"tileset": Preset(
name="tileset",
description="Seamless tileable textures (SDXL)",
prompt_prefix="seamless texture of ",
prompt_suffix=", seamless pattern, tileable, game texture, repeatable, top-down view, uniform lighting",
negative_prompt="visible seams, non-tileable, watermark, text, objects, characters",
default_width=1024,
default_height=1024,
steps=25,
cfg_scale=6.0
),
"environment": Preset(
name="environment",
description="Environment/background art",
prompt_prefix="game environment, ",
prompt_suffix=", game background, scenic, atmospheric, detailed, game art style, concept art quality",
negative_prompt=NEGATIVE_COMMON + ", characters, UI elements",
default_width=1024,
default_height=768,
steps=30,
cfg_scale=6.5
),
"prop": Preset(
name="prop",
description="Game props and objects",
prompt_prefix="game prop, ",
prompt_suffix=", 3/4 view, isolated object, game asset, clean edges, solid background, stylized",
negative_prompt=NEGATIVE_COMMON + ", multiple objects, characters",
default_width=1024,
default_height=1024,
steps=25,
cfg_scale=6.0
),
"topdown_prop": Preset(
name="topdown_prop",
description="Top-down 2D props (orthographic, no perspective)",
prompt_prefix="top-down view, overhead view, camera directly above, looking straight down, orthographic, 2d game sprite, centered, ",
prompt_suffix=", isolated object, only top surface visible, clean silhouette, consistent lighting, solid background, no shadow, game asset",
negative_prompt=NEGATIVE_COMMON + ", perspective, isometric, 3/4 view, side view, front view, angled view, eye level, portrait, horizon, ground plane, visible front face, visible side faces",
default_width=1024,
default_height=1024,
steps=30,
cfg_scale=5.0,
sampler="dpmpp_2m_sde",
scheduler="karras"
),
"topdown_character": Preset(
name="topdown_character",
description="Top-down 2D characters (RPG topdown)",
prompt_prefix="top-down view, overhead view, camera directly above, looking straight down, orthographic, 2d game character sprite, ",
prompt_suffix=", full body, centered, readable silhouette, simple details, consistent outfit, no visible face, helmet top view, solid background, game art",
negative_prompt=NEGATIVE_CHARACTER + ", perspective, isometric, 3/4 view, side view, front view, angled view, eye level, portrait, close-up, cropped, face, eyes, mouth, visible facial features, multiple characters, duplicate, extra heads, extra arms, extra legs, multiple swords, multiple shields, extra weapons, floating objects, disembodied parts, separated armor, detached armor",
default_width=1024,
default_height=1024,
steps=35,
cfg_scale=5.0,
sampler="dpmpp_2m_sde",
scheduler="karras"
),
"topdown_tile": Preset(
name="topdown_tile",
description="Top-down seamless tiles (ground/walls)",
prompt_prefix="top-down view, orthographic, seamless tileable texture, ",
prompt_suffix=", uniform lighting, top-down game tile, repeatable pattern, clean edges",
negative_prompt="visible seams, non-tileable, perspective, isometric, 3/4 view, horizon, text, watermark",
default_width=1024,
default_height=1024,
steps=30,
cfg_scale=6.0,
sampler="dpmpp_2m_sde",
scheduler="karras"
),
# === Style-Specific Presets ===
"handpainted": Preset(
name="handpainted",
description="Hand-painted art style",
prompt_prefix="hand painted digital art of ",
prompt_suffix=", painterly style, visible brush strokes, artistic, game art, stylized, vibrant colors",
negative_prompt="photo, realistic, 3d render, pixel art, flat colors, vector",
default_width=1024,
default_height=1024,
steps=30,
cfg_scale=6.5
),
"flat_ui": Preset(
name="flat_ui",
description="Flat design UI elements",
prompt_prefix="flat design ",
prompt_suffix=", UI element, vector style, clean shapes, solid colors, minimalist, modern design",
negative_prompt="3d, realistic, gradients, shadows, texture, noise, detailed",
default_width=1024,
default_height=1024,
steps=20,
cfg_scale=5.5
),
"isometric": Preset(
name="isometric",
description="Isometric game assets",
prompt_prefix="isometric ",
prompt_suffix=", isometric view, isometric perspective, game asset, clean edges, stylized, solid background",
negative_prompt="side view, top view, perspective distortion, blurry, realistic",
default_width=1024,
default_height=1024,
steps=25,
cfg_scale=6.0
),
# === Pixel Art Presets (generate at higher res, then downscale) ===
"pixel_art": Preset(
name="pixel_art",
description="Pixel art style (generates at 1024, downscale after)",
prompt_prefix="pixel art style ",
prompt_suffix=", pixel art, retro game style, 16-bit aesthetic, clean pixels, game sprite",
negative_prompt=NEGATIVE_PIXEL,
default_width=1024,
default_height=1024,
steps=25,
cfg_scale=7.0
),
"pixel_character": Preset(
name="pixel_character",
description="Pixel art character sprite",
prompt_prefix="pixel art character ",
prompt_suffix=", pixel art style, retro game character, 16-bit, clean pixels, full body, game sprite",
negative_prompt=NEGATIVE_PIXEL + ", " + NEGATIVE_CHARACTER,
default_width=768,
default_height=1024,
steps=25,
cfg_scale=7.0
),
# === Legacy Presets (kept for compatibility, but use SDXL settings) ===
"pixel_16": Preset(
name="pixel_16",
description="16x16 pixel art (generates at 512, downscale after)",
prompt_prefix="pixel art, 16-bit style, ",
prompt_suffix=", crisp pixels, retro game style, simple design, game sprite",
negative_prompt=NEGATIVE_PIXEL,
default_width=512,
default_height=512,
steps=20,
cfg_scale=7.0
),
"pixel_32": Preset(
name="pixel_32",
description="32x32 pixel art (generates at 512, downscale after)",
prompt_prefix="pixel art, 32-bit style, ",
prompt_suffix=", crisp pixels, retro game style, detailed pixel work, game sprite",
negative_prompt=NEGATIVE_PIXEL,
default_width=512,
default_height=512,
steps=20,
cfg_scale=7.0
),
"pixel_64": Preset(
name="pixel_64",
description="64x64 pixel art (generates at 512, downscale after)",
prompt_prefix="pixel art, ",
prompt_suffix=", detailed pixel art, game sprite, clean pixels, retro style",
negative_prompt=NEGATIVE_PIXEL,
default_width=512,
default_height=512,
steps=25,
cfg_scale=7.0
),
# === Effect & VFX Presets ===
"effect": Preset(
name="effect",
description="Visual effects (explosions, magic, particles)",
prompt_prefix="game visual effect, ",
prompt_suffix=", VFX, particle effect, transparent background, game effect sprite, dynamic, glowing",
negative_prompt="realistic, photo, characters, solid objects, text",
default_width=1024,
default_height=1024,
steps=25,
cfg_scale=6.0,
sampler="dpmpp_2m_sde",
scheduler="karras"
),
"magic_effect": Preset(
name="magic_effect",
description="Magic/spell effects",
prompt_prefix="magical effect, ",
prompt_suffix=", fantasy magic, glowing, ethereal, particle effect, game VFX, transparent background",
negative_prompt="realistic, photo, characters, solid objects, text, dark",
default_width=1024,
default_height=1024,
steps=30,
cfg_scale=5.5,
sampler="dpmpp_2m_sde",
scheduler="karras"
),
# === UI Presets ===
"ui_button": Preset(
name="ui_button",
description="Game UI buttons",
prompt_prefix="game UI button, ",
prompt_suffix=", clean design, game interface element, stylized, polished, centered",
negative_prompt="text, realistic, photo, 3d, complex, busy",
default_width=512,
default_height=256,
steps=20,
cfg_scale=5.5
),
"ui_frame": Preset(
name="ui_frame",
description="Game UI frames and panels",
prompt_prefix="game UI frame, ",
prompt_suffix=", decorative border, game interface panel, stylized, ornate edges, transparent center",
negative_prompt="text, realistic, photo, characters, busy interior",
default_width=1024,
default_height=768,
steps=25,
cfg_scale=5.5
),
# === Creature/Monster Presets ===
"creature": Preset(
name="creature",
description="Fantasy creatures and monsters",
prompt_prefix="fantasy creature, ",
prompt_suffix=", monster design, full body, dynamic pose, game art style, detailed, solid background",
negative_prompt=NEGATIVE_CHARACTER + ", cute, friendly, human",
default_width=1024,
default_height=1024,
steps=35,
cfg_scale=6.0,
sampler="dpmpp_2m_sde",
scheduler="karras"
),
"topdown_creature": Preset(
name="topdown_creature",
description="Top-down creatures/enemies",
prompt_prefix="top-down view, overhead view, camera directly above, looking straight down, orthographic, 2d game creature sprite, ",
prompt_suffix=", full body, centered, readable silhouette, monster design, solid background, game art",
negative_prompt=NEGATIVE_CHARACTER + ", perspective, isometric, 3/4 view, side view, front view, angled view, eye level, portrait, face, eyes, visible facial features",
default_width=1024,
default_height=1024,
steps=35,
cfg_scale=5.0,
sampler="dpmpp_2m_sde",
scheduler="karras"
)
}
def get_preset(name: str) -> Preset:
"""Get a preset by name, or return default if not found."""
return PRESETS.get(name, PRESETS["default"])
def list_presets() -> Dict[str, Dict[str, Any]]:
"""List all available presets."""
return {name: preset.to_dict() for name, preset in PRESETS.items()}