chat-pet-sprite-creation
Chat Pet Sprite Creation
Create pet sprites that feel like one continuous character rather than separate drawings. Start from the current pet body, preserve its visual anchor, and make every difference intentional.
Source of truth
- Sprite art:
src/vs/workbench/contrib/chat/browser/widget/media/chatPet/ - Runtime states, dimensions, timing, and transitions:
src/vs/workbench/contrib/chat/browser/widget/chatPetWidget.ts - Eye geometry, facing, clipping, and motion CSS:
src/vs/workbench/contrib/chat/browser/widget/media/chatPet.css - Unit tests:
src/vs/workbench/contrib/chat/test/browser/widget/chatPetWidget.test.ts
Read the current implementation before drawing. Existing dimensions and timings may have changed since this skill was written.
PR precedence and lineage
This skill distills the complete pet PR history. When rules conflict, use this precedence:
- Current code and tests
- The newest relevant open PR
- Newer merged PRs
- Older historical behavior
In particular, animation cleanup PR #330399 supersedes the old revive-sign flow and several earlier sprite/timing assumptions.
| PR | Durable learning |
|---|---|
| #327063 | The pet is one semantic button; sprite canvases, images, eyes, and effects are visual-only and aria-hidden. Resolve asset URLs through FileAccess. |
| #327412 | Model reactions as explicit states. Do not immediately repeat ordinary random reactions; sample rare transformations separately. |
| #327588 | Double-buffer sprite images and swap only after the pending image loads. Never blank the active sprite while a new source is loading. |
| #327696 | Stable/Insiders is a typed, persisted appearance choice. Keep variant naming and geometry systematic. |
| #327714 | Animated art is a horizontal sprite sheet plus a deliberate static reduced-motion PNG. Timing is runtime data, not image metadata. |
| #328334 | Persistent behavior such as “on the run” belongs in service state. Multi-phase animations advance from completion signals, not guessed delays. |
| #328480 | A drag release must not also trigger a click reaction. Gestures that share pointer events need explicit suppression/ownership. |
| #328530 | Waking consumes the interaction that woke the pet; it must not also trigger a random reaction. Reduced motion may skip the wake transition. |
| #329121 | Coalesce gaze updates, pause sprite timers while the document is hidden, and resume from elapsed time rather than replaying missed frames. |
| #329347 | Keep pixel-art pose changes in sprite frames and spatial motion in layout/CSS/physics. Complete falls from transition signals. |
| #329729 | Face the interaction before starting a reaction. Give each transient state an explicit lifetime and use real completion events for chained phases. |
| #329852 | Pointer and keyboard gestures need equivalent outcomes. Reduced motion preserves the state change while removing the travel animation. |
| #329867 | Attention animations are bounded; clapping stops after the confirmation-attention window even if the confirmation remains pending. |
| #330160 | Eyes are a composited runtime layer with tracking/blinking modes. Rapid facing changes can trigger a separate dizzy state. Wide art must respect live bounds. |
| #330275 | Physics uses the body footprint, bounded frame steps, and explicit impact moments. Recompute geometry when layout changes during flight. |
| #330399 | Latest animation contract: wide sleep/wake art, frame-aware blink composition, fixed-orientation decorations, and reverse despawn → forward respawn using one effect sheet. |
The logical pixel
The canonical art unit is one logical pixel:
8×8source pixels4×4CSS pixels at the standard96×96source →48×48display scale
Core silhouettes, facial features, props, and repeated details must use the same logical-pixel scale. Do not make a new object from smaller or larger blocks simply to fit more detail.
Effects may deliberately subdivide the logical pixel—for example, small stars, bubbles, or curved motion—but the subdivision must:
- Serve a specific effect that cannot read on the core grid.
- Stay consistent throughout that effect.
- Never come from antialiasing or resampling.
Use nearest-neighbor rendering only. Keep transparent backgrounds and hard pixel edges. Do not introduce blur, feathered alpha, color interpolation, or accidental off-grid scaling.
Start from a baseline
Never redraw the pet body from memory.
- Use the current idle sprite as the baseline for resting, pointer-driven, or playful states.
- Use the current rendering sprite as the baseline for request/processing states.
- Copy the complete body first, then alter only the parts required by the new state.
This preserves:
- Body width and height
- Bottom baseline
- Antenna roots and spacing
- Highlight and shadow ramps
- Eye sockets
- Collision/interaction footprint
The first and last key poses must transition cleanly to idle or rendering without a body-position, silhouette, baseline, or scale pop.
Canvas and anchoring
The default source canvas is 96×96, or 12×12 logical pixels.
Use a larger canvas only when content intentionally extends outside the canonical body box:
- A terminal or button may need extra width.
- A note, star, or bubble may need extra height.
- The body must remain anchored exactly where it sits in the baseline sprite.
Do not center the body inside a wider frame. Keep the body in the canonical 96×96 region and let the prop/effect overhang. Declare every nonstandard source dimension in chatPetWidget.ts and update wide-sprite boundary handling.
The runtime collision and movement box belongs to the pet body, not to a decorative overhang.
