feat(sprite-generation): Add race, unit class, and composition prompt templates for sprite generation

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Claude Code 2026-03-29 23:23:59 -07:00
parent cabf9ba11c
commit 7372f0b56e
5 changed files with 41 additions and 25 deletions

View file

@ -132,7 +132,7 @@ def get_unit_style(combat_type: str) -> str:
return comp.get("units", "")
def _sprite_properties(category: str, combat_type: str = "") -> dict[str, object]:
def _sprite_properties(category: str, combat_type: str = "", race: str = "") -> dict[str, object]:
"""Derive sprite properties from category and combat type.
These properties drive rule matching in negatives.yaml.
@ -166,6 +166,7 @@ def _sprite_properties(category: str, combat_type: str = "") -> dict[str, object
"has_character": has_character,
"has_mount": has_mount,
"facing": facing,
"race": race,
}
@ -193,7 +194,7 @@ def _match_rule(rule_when: dict, props: dict[str, object]) -> bool:
return True
def get_negative(category: str, combat_type: str = "") -> str:
def get_negative(category: str, combat_type: str = "", race: str = "") -> str:
"""Build the negative prompt dynamically from rules in negatives.yaml.
Evaluates each rule against the sprite's derived properties.
@ -201,7 +202,7 @@ def get_negative(category: str, combat_type: str = "") -> str:
"""
negs_data = _negatives()
rules = negs_data.get("rules", [])
props = _sprite_properties(category, combat_type)
props = _sprite_properties(category, combat_type, race)
parts: list[str] = []
for rule in rules:
@ -360,7 +361,8 @@ def compose_prompt(
# No background color needed — rembg handles background removal in post-processing.
parts.append(
"game sprite, single character, simple background, "
"character walking AWAY toward bottom-left, BACK turned to camera"
"character walking AWAY toward bottom-left, BACK turned to camera, "
"STEEP top-down overhead view, top of head visible from above"
)
# Layer 2: Unit class weapon/role — at token ~15, still within SDXL's top-weight zone.

View file

@ -45,39 +45,43 @@ edges: >-
# Added "hand-painted digital art" to counter juggernaut's photorealism bias.
units: >-
character walking AWAY from viewer toward bottom-left corner, BACK turned to camera,
rear diagonal view from slightly above, floating, simple background,
STEEP top-down overhead view, DOTA 2 camera angle, looking steeply down from above,
top of head and helmet clearly visible from above, body appears compact from overhead perspective,
floating, simple background,
NO floor NO ground NO surface NO shadow NO reflection, character suspended in air,
full body visible head to feet, single figure,
hand-painted digital fantasy game art, Warcraft III sprite art style,
semi-realistic painted fantasy game art, detailed hand-painted illustration,
NOT photorealistic, NOT a photograph, NOT 3D hyperrealistic render,
flat even lighting, no cast shadows, clean crisp edges, masterpiece, best quality
# Per-combat-type unit overrides (only where composition differs from default)
units.cavalry: >-
horse and rider walking AWAY from viewer toward LOWER-LEFT corner, REAR view from above,
warhorse and rider moving southwest, back of rider visible, horse rear visible,
horse and rider walking AWAY from viewer toward LOWER-LEFT corner,
STEEP top-down overhead view, DOTA 2 camera angle, looking steeply down from above,
top of rider's helmet clearly visible from above, horse's back and rump visible from overhead,
back of rider visible, horse hindquarters and tail visible,
floating, simple background, NO floor NO ground NO surface NO shadow,
isometric view from slightly above, full body of horse and rider visible head to hooves,
hand-painted digital fantasy game art, Warcraft III style,
full body of horse and rider visible head to hooves,
semi-realistic painted fantasy game art, detailed hand-painted illustration,
NOT photorealistic, NOT a photograph, flat even lighting, no cast shadows, clean crisp edges, masterpiece
units.siege: >-
single siege engine game sprite, simple background,
isometric three-quarter view from above, angled toward lower-left,
hand-painted digital fantasy art, Warcraft III style,
STEEP top-down overhead view, angled toward lower-left,
semi-realistic painted fantasy game art, detailed hand-painted illustration,
heavy wood and iron war machine, no people,
rich saturated colors, sharp clean edges, masterpiece
units.flying: >-
single flying creature game sprite, simple background,
isometric view from above, soaring toward lower-left, wings spread,
hand-painted digital fantasy art, Warcraft III style,
STEEP overhead view from above, soaring toward lower-left, wings spread,
semi-realistic painted fantasy game art, detailed hand-painted illustration,
rich saturated colors, sharp clean edges, masterpiece
units.marine: >-
single ship game sprite, simple background,
isometric three-quarter view from above, sailing toward lower-left,
hand-painted digital fantasy art, Civilization V style naval unit,
top-down isometric view from above, sailing toward lower-left,
semi-realistic painted fantasy game art, detailed hand-painted illustration,
rich saturated colors, sharp clean edges, masterpiece
buildings: >-
@ -90,16 +94,16 @@ buildings: >-
resources: >-
simple background,
single small game resource icon, 3/4 isometric view,
single small game resource icon, top-down isometric view,
one isolated glowing resource node, NOT terrain, NOT ground texture,
polished hand-painted game art like Warcraft III or Civilization V resource,
vibrant colors, sharp detail, clean crisp edges, masterpiece, best quality
polished hand-painted fantasy game art, vibrant colors,
sharp detail, clean crisp edges, masterpiece, best quality
improvements: >-
simple background,
tiny game map icon sprite, 3/4 isometric view from above,
tiny game map icon sprite, top-down isometric view from above,
ONE small simple object centered in frame, nothing else,
miniature game asset like a Civilization V map icon,
miniature hand-painted fantasy game asset,
painted fantasy art, clean simple,
clean crisp edges, masterpiece, best quality

View file

@ -85,12 +85,22 @@ rules:
- name: no_photo
when: { is_layered: true }
negate: "photograph, photorealistic, photo, 3D render, CGI, hyperrealism, ultra realistic, realism, realistic rendering"
negate: "photograph, photorealistic, photo, 3D render, CGI, hyperrealism, ultra realistic, realism, realistic rendering, studio lighting, grey studio background, product photography, studio render, 3D studio, render preview, CGI model"
- name: no_modern_clothes
when: { has_character: true }
negate: "jeans, denim, t-shirt, hoodie, casual wear, modern clothing, contemporary clothes, business suit, office attire, sneakers, sport shoes, jacket, sweatshirt, polo shirt, hard hat, safety helmet, hi-vis vest, reflective vest, safety goggles, construction worker, yellow safety vest, orange vest, cargo pants"
# ── MOUNT-SPECIFIC ─────────────────────────────────────────────────
- name: no_fantasy_mount_colors
when: { has_mount: true }
negate: "green horse, neon horse, fantasy colored horse, magical horse, glowing horse, unicorn, rainbow horse, neon green animal, bright green creature, fluorescent animal, purple horse, blue horse, unnaturally colored animal"
# ── RACE-SPECIFIC ──────────────────────────────────────────────────
- name: dwarf_anti_orc_bleed
when: { race: dwarves }
negate: "green skin, orc, goblin, troll, tusks, monster skin, creature skin, dark olive complexion, orcish, goblinoid"
# ── SPELL-SPECIFIC ─────────────────────────────────────────────────
- name: no_characters_in_spells
when: { background: black, has_character: false }

View file

@ -27,7 +27,7 @@ humans:
dwarves:
body: "dwarf, SHORT and STOCKY with broad shoulders, thick limbs, barrel chest, wide stance, half the height of a human"
features: "ruddy complexion, strong jaw"
features: "ruddy human skin tone, peach-brown complexion, strong jaw, NOT green skin"
hair: "thick auburn hair"
armor: "heavy plate and chainmail with rune etchings"

View file

@ -93,7 +93,7 @@ cavalry:
weapon: "rider holding lance or sword"
equipment: "saddle and barding"
armor: "plate barding on horse, leather and metal horse armor"
mount: "BROWN WARHORSE in walking pose, horse is brown/bay colored"
mount: "BROWN WARHORSE in walking pose, horse is natural brown/bay/chestnut colored, realistic horse colors, NOT green, NOT fantasy colored"
stance: "both rider and horse fully visible"
heavy_cavalry:
@ -101,7 +101,7 @@ heavy_cavalry:
weapon: "rider in heavy plate armor with lance couched"
equipment: "full plate barding on horse"
armor: "iron and steel armor plates on both rider and mount"
mount: "large armored WARHORSE, horse is brown/chestnut"
mount: "large armored WARHORSE, horse is natural brown/chestnut colored, realistic horse colors, NOT green, NOT fantasy colored"
stance: "imposing massive presence, both mount and rider fully visible"
# ─── SIEGE ─────────────────────────────────────────────────────────────