Game Sprite Pipeline
Use this skill to turn image-model sprite-sheet outputs into usable game assets. Treat generated sheets as source material, then apply deterministic cleanup before integrating them into a game.
Core Rule
Do not trust raw AI sprite sheets as game-ready. Always post-process them into fixed-size RGBA sheets with stable frame dimensions, transparent gutters, consistent baseline, and matching metadata.
Workflow
Define a character bible:
- Species/body/proportions.
- Outfit and accessories.
- Camera angle and facing direction.
- Rendering style.
- Forbidden variations, such as outfit changes or collar appearing too early.
Generate a unified source sheet:
- Prefer one sheet containing related animations for the same character.
- Ask for fixed rows: for example, row 1 idle, row 2 walk.
- Require same character, outfit, scale, angle, foot baseline, and full body in every frame.
- Ask for transparent background, but expect fake checkerboard and clean it later.
Inspect the source:
- View the image before processing.
- Confirm frame count, pose order, outfit consistency, and whether feet/heads are cropped.
- Reject or regenerate if the character identity changes heavily across frames.
Process into game sheets:
- Convert fake checkerboard/near-white background to alpha.
- Detect each character pose as a connected component.
- Crop each pose, keeping only the main component.
- Normalize height while preserving proportions.
- Place every pose into the same frame size.
- Bottom-align feet to one baseline.
- Add transparent gutters to prevent browser/game texture bleed.
- Export separate sheets per animation.
Integrate and test:
- Use one fixed display box per character.
- Swap only the inner sprite sheet/animation class, not the outer character box.
- Change animation state only when movement starts/stops, not every frame.
- Test idle, movement, direction flip, clipping, size popping, and console errors.
Persist metadata:
- Record frame width, height, frame count, frame duration, pivot point, and baseline.
- Keep original generated source next to processed sheets.
Prompt Pattern
Use a strict prompt like:
Game-ready sprite sheet, transparent background, one consistent character only:
[character bible].
Same exact character, same outfit, same proportions, same camera angle, same scale,
full body visible, feet on same baseline, no cropping, no text.
Grid: [row/column layout].
Row 1: [animation and frames].
Row 2: [animation and frames].
[Facing direction]. Clear readable motion. Stable head/nose. Even spacing between frames.
Recommended Animation Order
Build animations in this order:
- Idle: 4 frames.
- Walk: 8 frames, including passing/crossover poses.
- Happy/celebrate: 4 frames.
- Think/listen: 4 frames.
- Pray/solemn: 4 frames.
- Startled: 4 frames.
- Receive item: 4 frames.
Scripts
Use scripts/process_sprite_sheet.py when converting a generated sprite sheet into separate animation sheets. It expects rows with known frame counts and exports cleaned RGBA sheets plus previews.
Example:
python3 ~/.codex/skills/game-sprite-pipeline/scripts/process_sprite_sheet.py \
--input /path/to/generated.png \
--output-dir /path/to/assets/generated/character/sprites \
--prefix young-wilson \
--rows idle:4,walk:8 \
--frame-width 320 \
--frame-height 363
Read references/sprite-framework.md for the complete project framework and decision checklist.
1---2name: game-sprite-pipeline3description: Generate, clean, align, and integrate consistent game-ready character sprite sheets from AI image outputs. Use when working on 2D/2.5D game character sprites, animation sheets, transparent-background sprite assets, frame slicing, alpha cleanup, fixed frame boxes, baseline/pivot alignment, idle/walk/action animation loops, or image-model prompts for consistent game sprites.4---56# Game Sprite Pipeline78Use this skill to turn image-model sprite-sheet outputs into usable game assets. Treat generated sheets as source material, then apply deterministic cleanup before integrating them into a game.910## Core Rule1112Do not trust raw AI sprite sheets as game-ready. Always post-process them into fixed-size RGBA sheets with stable frame dimensions, transparent gutters, consistent baseline, and matching metadata.1314## Workflow15161. Define a character bible:17 - Species/body/proportions.18 - Outfit and accessories.19 - Camera angle and facing direction.20 - Rendering style.21 - Forbidden variations, such as outfit changes or collar appearing too early.22232. Generate a unified source sheet:24 - Prefer one sheet containing related animations for the same character.25 - Ask for fixed rows: for example, row 1 idle, row 2 walk.26 - Require same character, outfit, scale, angle, foot baseline, and full body in every frame.27 - Ask for transparent background, but expect fake checkerboard and clean it later.28293. Inspect the source:30 - View the image before processing.31 - Confirm frame count, pose order, outfit consistency, and whether feet/heads are cropped.32 - Reject or regenerate if the character identity changes heavily across frames.33344. Process into game sheets:35 - Convert fake checkerboard/near-white background to alpha.36 - Detect each character pose as a connected component.37 - Crop each pose, keeping only the main component.38 - Normalize height while preserving proportions.39 - Place every pose into the same frame size.40 - Bottom-align feet to one baseline.41 - Add transparent gutters to prevent browser/game texture bleed.42 - Export separate sheets per animation.43445. Integrate and test:45 - Use one fixed display box per character.46 - Swap only the inner sprite sheet/animation class, not the outer character box.47 - Change animation state only when movement starts/stops, not every frame.48 - Test idle, movement, direction flip, clipping, size popping, and console errors.49506. Persist metadata:51 - Record frame width, height, frame count, frame duration, pivot point, and baseline.52 - Keep original generated source next to processed sheets.5354## Prompt Pattern5556Use a strict prompt like:5758```text59Game-ready sprite sheet, transparent background, one consistent character only:60[character bible].6162Same exact character, same outfit, same proportions, same camera angle, same scale,63full body visible, feet on same baseline, no cropping, no text.6465Grid: [row/column layout].66Row 1: [animation and frames].67Row 2: [animation and frames].68[Facing direction]. Clear readable motion. Stable head/nose. Even spacing between frames.69```7071## Recommended Animation Order7273Build animations in this order:74751. Idle: 4 frames.762. Walk: 8 frames, including passing/crossover poses.773. Happy/celebrate: 4 frames.784. Think/listen: 4 frames.795. Pray/solemn: 4 frames.806. Startled: 4 frames.817. Receive item: 4 frames.8283## Scripts8485Use `scripts/process_sprite_sheet.py` when converting a generated sprite sheet into separate animation sheets. It expects rows with known frame counts and exports cleaned RGBA sheets plus previews.8687Example:8889```bash90python3 ~/.codex/skills/game-sprite-pipeline/scripts/process_sprite_sheet.py \91 --input /path/to/generated.png \92 --output-dir /path/to/assets/generated/character/sprites \93 --prefix young-wilson \94 --rows idle:4,walk:8 \95 --frame-width 320 \96 --frame-height 36397```9899Read `references/sprite-framework.md` for the complete project framework and decision checklist.