From be808cf6591e4caf14d831e7317e180ffd526b3c Mon Sep 17 00:00:00 2001 From: Claude Code Date: Thu, 26 Mar 2026 14:22:53 -0700 Subject: [PATCH] =?UTF-8?q?feat(sprite-generation):=20=E2=9C=A8=20Add=20dy?= =?UTF-8?q?namic=20prompt=20templates=20and=20AI=20integration=20for=20spr?= =?UTF-8?q?ite=20generation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- tools/sprite-generation/engine/prompts.py | 106 ++++++++++------------ 1 file changed, 48 insertions(+), 58 deletions(-) diff --git a/tools/sprite-generation/engine/prompts.py b/tools/sprite-generation/engine/prompts.py index 1fa819cd..b9e168c1 100644 --- a/tools/sprite-generation/engine/prompts.py +++ b/tools/sprite-generation/engine/prompts.py @@ -34,12 +34,11 @@ STYLE_PREFIXES: dict[str, str] = { # --- LAYERS: UNITS (default fallback — combat-type templates preferred) --- "units": ( - "game sprite icon, bright green flat color background (#00ff00), " - "walking to the lower-left, body angled toward bottom-left corner, " - "three-quarter rear view from above, " - "hand-painted digital art like Warcraft III or Baldurs Gate, " - "isometric RPG character sprite, full body head to toe, " - "rich saturated fantasy colors, clean sharp edges, single character" + "single character game sprite on solid lime green (#00ff00) background, " + "isometric three-quarter rear view, character walking toward lower-left corner, " + "hand-painted digital fantasy art, Warcraft III style unit, " + "non-green armor and clothing, metal and leather colors, " + "rich saturated colors, sharp clean edges, full body visible, masterpiece" ), "buildings": ( "isometric game building sprite, " @@ -222,71 +221,62 @@ SCHOOL_ENERGY_COLORS: dict[str, str] = { # Overrides the generic "units" STYLE_PREFIX when a combat_type matches # --------------------------------------------------------------------------- -# Prompt formula proven to work with juggernaut-xi-v11: -# 1. "game sprite icon" triggers game asset mode -# 2. "#00ff00" hex code forces solid green -# 3. "three-quarter rear view from above" + "body angled toward bottom-left" for direction -# 4. "hand-painted digital art like Warcraft III" for style -# 5. guidance_scale 9.0 for adherence +# Production formula — proven with juggernaut-xi-v11 at guidance 9.0 +# Winner: "E_composition" from prompt lab testing +# Key: "solid lime green (#00ff00)" + "isometric three-quarter rear view" + +# "walking toward lower-left" + "Warcraft III style" + "non-green armor" _UNIT_CORE = ( - "game sprite icon, bright green flat color background (#00ff00), " - "walking to the lower-left, body angled toward bottom-left corner, " - "three-quarter rear view from above, " - "hand-painted digital art like Warcraft III or Baldurs Gate, " - "isometric RPG character sprite, full body head to toe, " - "rich saturated fantasy colors, clean sharp edges, single character" + "single character game sprite on solid lime green (#00ff00) background, " + "isometric three-quarter rear view, character walking toward lower-left corner, " + "{entity}, " + "hand-painted digital fantasy art, Warcraft III style unit, " + "non-green armor and clothing, metal and leather colors, " + "rich saturated colors, sharp clean edges, full body visible, masterpiece" ) +def _unit_style(combat_extra: str = "") -> str: + """Build unit style prefix. Entity placeholder {entity} filled by compose_prompt.""" + extra = f", {combat_extra}" if combat_extra else "" + return ( + "single character game sprite on solid lime green (#00ff00) background, " + "isometric three-quarter rear view, character walking toward lower-left corner{extra}, " + "hand-painted digital fantasy art, Warcraft III style unit, " + "non-green armor and clothing, metal and leather colors, " + "rich saturated colors, sharp clean edges, full body visible, masterpiece" + ).replace("{extra}", extra) + UNIT_STYLE_BY_COMBAT_TYPE: dict[str, str] = { - "melee": ( - f"{_UNIT_CORE}, " - "armored warrior holding melee weapon, heavy armor" - ), - "ranged": ( - f"{_UNIT_CORE}, " - "ranged fighter holding ranged weapon ready to fire, quiver or ammo" - ), + "melee": _unit_style("armored warrior holding melee weapon"), + "ranged": _unit_style("ranged fighter holding weapon ready to fire"), "cavalry": ( - "game sprite icon, bright green flat color background (#00ff00), " - "mounted rider on armored warhorse walking to the lower-left, " - "body angled toward bottom-left corner, three-quarter rear view from above, " - "hand-painted digital art like Warcraft III, " - "isometric RPG mounted unit sprite, full mount visible head to hooves, " - "rich saturated fantasy colors, clean sharp edges, single rider" + "single mounted unit game sprite on solid lime green (#00ff00) background, " + "isometric three-quarter rear view, rider on warhorse walking toward lower-left corner, " + "hand-painted digital fantasy art, Warcraft III style, " + "non-green armor, metal and leather colors, " + "rich saturated colors, sharp clean edges, full mount visible, masterpiece" ), "siege": ( - "game sprite icon, bright green flat color background (#00ff00), " - "war machine angled toward bottom-left corner, " - "three-quarter view from above, " - "hand-painted digital art like Warcraft III, " - "isometric RPG siege engine sprite, no people, heavy wood and iron, " - "rich saturated fantasy colors, clean sharp edges" + "single siege engine game sprite on solid lime green (#00ff00) background, " + "isometric three-quarter view from above, angled toward lower-left, " + "hand-painted digital fantasy art, Warcraft III style, " + "heavy wood and iron war machine, no people, " + "rich saturated colors, sharp clean edges, masterpiece" ), "flying": ( - "game sprite icon, bright green flat color background (#00ff00), " - "flying creature soaring toward lower-left, wings spread, " - "three-quarter view from above, " - "hand-painted digital art like Warcraft III, " - "isometric RPG flying unit sprite, " - "rich saturated fantasy colors, clean sharp edges" + "single flying creature game sprite on solid lime green (#00ff00) background, " + "isometric view from above, soaring toward lower-left, wings spread, " + "hand-painted digital fantasy art, Warcraft III style, " + "rich saturated colors, sharp clean edges, masterpiece" ), "marine": ( - "game sprite icon, bright green flat color background (#00ff00), " - "small ship sailing toward lower-left corner, " - "three-quarter view from above, " - "hand-painted digital art like Civilization V, " - "isometric naval unit sprite, " - "rich saturated fantasy colors, clean sharp edges" - ), - "civilian": ( - f"{_UNIT_CORE}, " - "civilian carrying tools or supplies, traveler clothes, no armor" - ), - "specialist": ( - f"{_UNIT_CORE}, " - "support character with specialized equipment, tactical gear" + "single ship game sprite on solid lime green (#00ff00) background, " + "isometric three-quarter view from above, sailing toward lower-left, " + "hand-painted digital fantasy art, Civilization V style naval unit, " + "rich saturated colors, sharp clean edges, masterpiece" ), + "civilian": _unit_style("civilian carrying tools or supplies, traveler clothes"), + "specialist": _unit_style("support character with specialized equipment"), }