For All 4 Naught, we needed a way to animate a whole roster of hand-drawn characters without drawing every frame by hand. The usual answer here is skeletal animation, where you cut a character into parts, rig them to a skeleton, and then animate the bones instead of the pixels.

The go-to tool for this is Spine1, but there were a few reasons that disuaded us from it.

  • The licensing gets complicated once you’re shipping a commercial game.
  • It isn’t cheap, especially for a small studio just getting started.
  • Hubris. I was pretty sure we could build something that did exactly what we needed, and nothing more.

This led me to create a custom format, PCHR (short for “Paper Character”), and the tooling we’d need to create assets using this format.

#The format

A .pchr file is a small binary file that holds everything the game needs to draw a character: the atlas image, the bones, the meshes, and every frame of every animation.

SectionWhat it holds
ImagesThe character’s art, packed right into the file
BonesThe skeleton, and which bone is attached to which
MeshesThe pieces of art, cut into triangles and weighted to bones
AnimationsThe pose of every bone, for every frame

It’s designed to be read from start to finish in a single pass. Everything that varies in size is preceded by its length, so the game never has to jump around the file or parse any text2.

Animations are also “baked”, meaning the file stores the actual pose of every bone on every frame rather than the curves the animator drew. It makes the files a bit bigger, but the game doesn’t have to do any math to figure out where a bone should be.

Tooling

The full spec lives on the format site, along with a small pchr command line tool for inspecting files and converting them to and from JSON.

#Authoring it in Blender

Initially, I extended our Playable Workshop Blender addon to rig and animate characters, and export them as .pchr files. Blender already has bones, meshes and a timeline, so it seemed like a good shortcut.

It did work… for a while. Blender is obviously created for 3D modeling and animation, which is one extra axis than we needed3 and this 2D work trickier. There were also several features we wanted to add and be able to preview while authoring that were just a “no-go” in Blender.

#Creating Pachario

Eventually, we decided to build a dedicated app for it, called Pachario (a portmanteau of “Paper Character Studio”).

Rather than starting from scratch, I took the Godot engine and hollowed it out. Godot already has a solid renderer, a UI toolkit, and an editor full of things like property inspectors and an animation timeline. Everything else, like 3D, physics, audio, scripting and the game export pipeline, got removed.

#How it works

Working on a character in Pachario is split into two modes, plus an export button for when you’re done.

ModeWhat you do
SetupImport the art, cut it into parts, build the skeleton, and paint how much each bone moves each part
AnimatePose the bones on a timeline, and tune things like physics-based bones
ExportWrite out the .pchr for the game

Here’s what that looks like while working on some of the All 4 Naught characters. Click any of them for a closer look.

A project can also have characters that build on top of each other. Most of our heroes share the same skeleton and most of the same animations, so a hero only stores what makes it different. Fixing a problem in the base character fixes it for every hero built on top of it.

#Version 2

Heads up!

v2 is still internal for now, and the Blender addon doesn’t support it.

Once we had software that could do more than Blender could, we began extending what the spec (and runtimes) supported.

  • Rest pose properly stored in the file
  • Show, hide or scroll the art of a single part
  • Animation events (like “play a footstep sound here”)
  • Physics-based bones
  • Says how big the character should be in the runtime

The physics-based bones was our favorite and made a number of things like hair, capes and tails WAY more dynamic, reducing a lot of the manual animation we’d otherwise do for secondary animations. This single feature added a lot of life to the characters in All 4 Naught.

#The future of this project

Right now, the code that actually plays .pchr files only lives as C++ inside of our custom fork of Godot. Eventually, I want to package it up as a GDExtension for anyone who wants to use the format in their own Godot projects.

I’ll likely also update the Blender addon to support PCHR v2 at some point (though it won’t support all of V2’s features) and I’m unsure if we’ll ever release the “Pachario” app to the open public.