Skeletons
This page covers sharing one animation between characters, previewing motion for free, writing your own motions, checking what came back, fixing joints by hand, and animating a character at runtime as a cut-out.
Why use one: animate_from_prompt asks a model to imagine a walk, so two characters walk differently, and a frame can come back in any pose. A skeleton says exactly where every joint goes on every frame. That gives you the same timing and stride across a cast, contact frames that land where QA expects them, and poses you can check before paying.
What it needs: drawing frames from a skeleton needs PixelLab, whose endpoint is a beta. In testing, two characters of different builds both passed QA on one shared walk. Cut-outs are free and local.
How it works#
- A skeleton (
art/skeletons/humanoid.json) holds bones and motions. One file serves the whole game. - A rest pose says where one character's joints are, per direction. It's kept on the asset.
- A motion is written once. Atelier works out each direction from the camera angle, and scales the stride to each character's legs. A short goblin and a tall knight share one walk and keep their own bodies.
Left and right mean the character's own, not the screen's. On sheets, the left limbs are blue and the right ones orange.
Recipe: share a walk between characters#
Start from characters with still poses (see Characters).
Using Atelier, make the humanoid skeleton and find the joints of
<id>and<id2>. Show me the sheets.
skeleton_createmakes the skeleton, with the templateswalk,runandidle. It's free.skeleton_estimatereads the joints from each direction's still. It costs 0.1 generations a direction.
Check the sheet. Every joint should sit on the body, and blue should be the character's left. Facing the viewer, that's on the right of the screen. A wrong rest pose gives a wrong animation, so this is the moment to catch it.
Show me the walk on
<id>.
skeleton_render_guides draws the motion on the character, frame by frame, for free. Then:
Animate
<id>and<id2>with the walk from the skeleton, normalise them and run QA.
animate_from_skeleton costs 3 generations a direction for 8 frames. Each direction takes about 2 to 5 minutes, and a free-tier account runs one job at a time, so expect Claude to come back later with job_wait. If the timeout passes first, Claude is told which directions weren't sent and sends them next.
The walk's contact frames are set for you, so qa_report knows which frames should have a foot down.
Recipe: did it follow the skeleton?#
Lay the skeletons over
<id>'s walk.
skeleton_render_guides { over: "raw" } draws what was asked for on what came back. Limbs should sit inside the skeleton's lines. If one direction ignored its pose, redo it: "animate the walk on <id> again, facing w only".
"Almost duplicates" warnings: PixelLab can leave a small step undrawn, so a frame holds. Redo that direction with a new seed. If it holds in the same place again, the motion's step there is too small: widen it with skeleton_animate, and redraw every direction so they stay one motion.
An estimate fails: PixelLab's skeleton service returns an HTTP 500 now and then, at no charge. Claude is told which directions to run again.
qa_report makes this check for you: it warns, with frame numbers, when a frame's limbs aren't where the skeleton put them. A warning like that usually means a new seed will fix it.
Recipe: fix joints by hand#
An estimate is usually right. When it isn't, or when you skipped it, ask for the skeleton editor:
Using Atelier, the
goblin's arms look swapped facing north. Openhuman_posefor it.
Claude gives you a link. In the editor:
- Drag a joint onto the body. Blue is the character's left, orange its right.
- Click a joint and use the arrow keys to nudge it a pixel.
- Swap left and right fixes a whole direction in one click.
- Play on this pose tries a motion on your unsaved joints, so you can see the result before saving.
- A dot beside a direction means you've changed it. Reset puts it back.
Directions with no rest pose start from a typical body fitted to the sprite, so this works without skeleton_estimate and costs nothing. Frames already drawn don't change by themselves: Claude tells you which ones were drawn from the old joints, so you can redraw those that matter.
Without asking Claude: click Edit joints on a character's page in the web app. Saving applies the joints straight away and offers to queue the redraw as a task. The same page has a motion keyframes strip for editing a motion frame by frame (see the task queue).
Recipe: animate at runtime with a cut-out#
A cut-out splits a character's still into parts on its bones, and the game moves the parts. It's free, needs no frames from a provider, and plays smoothly at any speed. Change a motion and you only export again.
Using Atelier, export
knightas a cut-out with the walk and idle, and show me the parts.
export_cutout needs rest poses and normalised stills. It returns a sheet with the parts in colours, the rest pose, and the walk, adds three items to the content list, and copies exports/cutout-runtime.js. export_asset repeats it from then on. Open the preview page to see every motion playing through the real animation package.
In the game:
import ContentManager from '@basementuniverse/content-manager';
import { MultiAnimation } from '@basementuniverse/animation';
import { CutoutSprite } from './art/exports/cutout-runtime.js';
const knight = new CutoutSprite(ContentManager.get('knight-cutout'), name => ContentManager.get(name), MultiAnimation);
knight.direction = 'w';
knight.play('walk');
// each frame
knight.update(dt);
knight.draw(context, { x: 100, y: 100 }, 2);
Set knight.direction at any time and the walk carries on from the same point. knight.play() with no name goes back to the rest pose.
Frames or cut-out?
Frames (animate_from_skeleton) |
Cut-out (export_cutout) |
|
|---|---|---|
| Costs | Generations per direction | Nothing |
| Looks | Redrawn each frame, so cloth and hair move | One drawing, bent at the joints |
| Best for | Pixel art, small sprites | Painted art, large sprites, many motions |
What to expect:
- Check the sheet. Limbs rotate as flat pieces. On small pixel art, 1 px outlines break up when rotated, so judge it at your game's scale. A side view at 64 px is the hardest case.
- Coats and capes go with the legs, because nothing tells the cut they're cloth.
- A wrong cut is often a wrong joint. Fix it with
human_pose, then export again. - A limb hidden behind the body borrows the other side's, a shade darker, so a side view still has two arms. Claude tells you when this happens.
- Effects aren't on the parts. Outlines and shadows stay on the frames, so draw a ground shadow in the game.
Points, held items and normals:
Using Atelier, export
knightas a cut-out holdingswordin its right hand, with a point at the left hand.
- Points (
points: [{ name: 'hand-l', bone: 'forearm_l' }]): a named point on a bone,alongit (0 its start, 1 its end, the default: the wrist), baked frame by frame.knight.getAttachmentPoint('hand-l')gives where it is now relative to the sprite's origin, and which way the bone points (radians), flipped directions included: hang a torch or a particle emitter on it. - Held items (
held: [{ name: 'sword', bone: 'forearm_r', image: 'sword' }]): one more part, riding a point on the bone. It turns with the bone but never stretches, and is drawn just in front of it (behind: truefor just behind).imageis another asset (its still in the same direction), a frame reference or a PNG, drawn as it's held at rest;gripis the point in it that's held (default its bottom middle). - Normals (on by default when the asset has normal maps): each part's normals are cut from the still's, into
<id>-cutout-normals.pngin the same places.knight.drawNormals(normalContext, position, scale)draws them where the parts are, each part's normals turned with it, into the game's normal buffer.
Recipe: write your own motion#
Describe the poses, and check them before spending anything:
Add a skeleton motion
wave: 6 frames, right arm rising to above the head, then waving twice. Show it to me on a stand-in figure.
Claude uses skeleton_animate with key poses, and shows them with skeleton_render_guides. Motions are written as seen from the side, facing right:
| Bone | Value | Means |
|---|---|---|
thigh_l, thigh_r |
90 | hanging straight down; 70 reaches forward, 110 back |
shin_l, shin_r |
0 | leg straight; higher values bend the knee |
upperarm_l, upperarm_r |
180 | hanging down; 160 forward, 20 overhead |
forearm_l, forearm_r |
0 | arm straight; negative values bend the elbow |
torso |
-90 | upright; -80 leans forward |
head |
0 | in line with the torso |
groundLockkeeps the lowest foot on the floor, so hips bob by themselves. Leave it on unless the character leaves the ground: turn it off for jumps, and for floating or flying.root.xandroot.ytracks move the whole body, in leg lengths. A jump isroot.ygoing negative.- Start from a template to vary one: "make a
limpfrom the walk, keeping the right knee stiff". - Named poses (
poses) let keys reuse a pose, such asguardat the start and end of an attack. - Several skeletons: give a game a second one with
skeleton_create { id: "knight" }when a group of characters needs its own motions.
Recipe: a quadruped#
Using Atelier, give
<wolf>a four-legged skeleton and draw its trot in 4 directions.
PixelLab takes skeletons of any shape (a custom rig), so four-legged characters animate in 2D without a 3D model. This route is experimental.
skeleton_create { body: 'quadruped' }(free) makesart/skeletons/quadruped.json: a spine from the hips to the withers, a neck, head and tail, and four two-part legs, 17 joints in all. It comes with a four-beat walk (walk: left hind, left fore, right hind, right fore, a quarter of the cycle apart), a trot (trot: diagonal pairs together) and an idle with a wagging tail.skeleton_animatewrites others the same way, by its bones (upper_fl,lower_hr,tail,neck…).skeleton_estimatefits a typical four-legged body inside each direction's sprite (free; PixelLab's estimate only finds humanoid joints). Check the sheet, then drag the joints onto the legs, hips, withers, head and tail withhuman_pose: the fit is rough, and the motion moves the joints from where they are.skeleton_render_guides { animation: 'trot' }(free) previews it, thenanimate_from_skeleton { animation: 'trot' }draws it. PixelLab gets the skeleton as its rig (each joint with its parent, and whether it's on the near or far side for that direction) and takes depth from a dog's body. Settemplatein the skeleton file tocat,horse,lionorbearfor other animals, or passtemplateId.
3D motions stay humanoid: for a quadruped, use its skeleton's motions, or rig its model and add clips (page 13). Cut-outs are humanoid only.
Limits#
- PixelLab only, 3 to 15 frames, images up to 256×256. Longer clips are cheap: 15 frames cost 4 generations, against 3 for 8 frames.
- Humanoids and quadrupeds. The
humanoidskeleton has PixelLab's 18 joints; aquadrupedone has its own 17 (above). Other bodies (wings, a lid) aren't built in yet. - Side-view motions. A skeleton's motions move limbs forwards and back only. For a slash across the body, a turn or anything from motion capture, use a 3D motion: 3D motions.
- Mirrored directions follow their source:
eis a flip ofw. - The frame can grow. If a limb would leave the image, Atelier adds a transparent margin before sending it.
normalise_framesremoves it, and the asset's canvas doesn't change.
Next: The task queue.
Found a mistake? Edit this page on GitHub.