Screenplay-driven stick-figure animation for Manim, with Fountain+ conversion, graph-based characters, prop systems, cartoon faces, wardrobe overlays, camera blocking, and optional Blender export.
PAM is a Python/Manim toolkit for building fast, scriptable blocking animations from JSON or annotated Fountain screenplays. Characters are represented as graph-theoretic skeletons: joints are nodes, bones are edges, and every pose is a dictionary of joint coordinates. Actions interpolate those graphs through named poses, programmatic targets, prop interactions, speech bubbles, and camera beats.
PAM was developed for the Too Nice to Die animated sci-fi production pipeline, but the engine is general enough for storyboards, animatics, classroom demonstrations, character blocking tests, prop-layout tests, and graph-based animation experiments.
Current reference basis: PAM v0.9.18
Fountain converter basis:fountain2pamv0.9.13
Primary renderer: Manim Community
Primary authoring formats: PAM JSON and Fountain+
Canonical cast registry:tntd_characters.json
- What PAM does
- Pipeline
- Feature highlights
- Installation
- Quick start: render a JSON scene
- Quick start: use Fountain+
- Core concepts
- PAM JSON format
- Characters
- Faces and appearance
- Wardrobe overlays and accessories
- Props and scene objects
- Actions
- Camera system
- Blender export
- Environment variables
- Project layout
- Development guide
- Troubleshooting
- Version highlights
- Documentation
- Contributing
- License
PAM turns screenplay-like action descriptions into Manim animations.
It can:
- register a cast of humans, aliens, dogs, and dodecahedral “Governor” figures;
- animate walking, running, turning, waving, nodding, shrugging, reacting, grabbing, placing, punching buttons, dodging, falling, sitting, exiting, and other blocking actions;
- render speech bubbles for characters and props;
- persist or clear bubbles, captions, sound cues, overlays, and focus states;
- build and attach props such as desks, doors, phones, folders, laptops, backpacks, flowers, backdrops, buildings, pods, elevators, TV monitors, and dodecahedra;
- distinguish interactive props from large camera-addressable scene objects;
- attach flat-cartoon faces generated from JSON rather than bitmap assets;
- swap face expressions at runtime;
- attach wardrobe overlays such as name tags, gloves, shoes, torso icons, dog harnesses, and service labels;
- drive camera framing from screenplay annotations;
- convert Fountain+ scripts into PAM JSON plus prompt metadata;
- export the animation to Blender as solid 3D stick figures with smooth motion, planted feet, shadows, and speech bubbles, or export layout information only.
PAM’s design priority is screenplay-driven blocking. It answers production questions quickly:
- Does the scene read?
- Are the characters in the right positions?
- Does the dialogue timing work?
- Are prop interactions clear?
- Does the camera cut or drift at the right beat?
- Can this be used as a reliable reference for downstream rendering?
The blocking render is intentionally cheap to regenerate. It is a choreography and timing artifact, not a final character-animation pass.
A typical PAM-centered production path looks like this:
Fountain screenplay (.fountain)
|
v
+------------------+
| fountain2pam.py |
| Fountain+ parser|
+------------------+
|
+--> screenplay.json PAM action sequence
+--> prompts.json per-subscene visual prompts
+--> characters.txt optional synced character list
|
v
+------------------+
| pam_player.py |
| Manim renderer |
+------------------+
|
v
blocking MP4
|
+------------------------------+
v v
+------------------+ +------------------+
| pam_trace.py | | pam2blender.py |
| motion trace | | layout export |
+------------------+ +------------------+
| |
v v
+------------------+ Blender layout /
| trace2blender.py | lights / camera / props
+------------------+
|
v
animated 3D .blend (motion, camera, bubbles)
|
v
AI video generation or manual refinement
|
v
Final edit
The blocking MP4 is the main iteration artifact. It is normally rendered many times while tuning positions, line timing, reactions, captions, camera drift, and prop choreography.
PAM represents characters as graph figures. A character has:
- a dictionary of joints;
- a set of edges connecting those joints;
- a named pose;
- a scale;
- an offset in Manim world coordinates;
- a style dictionary;
- optional face, wardrobe, bubble, and tic-profile metadata.
Supported figure families include:
| Figure family | Typical class | Notes |
|---|---|---|
| Human | HumanGraph |
Humanoid actors with male, female, and child presets. |
| Alien | AlienGraph |
Humanoid/split-torso alien actors with male/female variants. |
| Dog | DogGraph |
Quadruped figures, often dual-registered as cast members and props. |
| Governor | GovernorGraph |
Dodecahedral autonomous prop-character, useful for AI/governmental displays. |
PAM includes roughly thirty registered prop builders organized across furniture, carried props, flora, environmental props, and accessories.
Examples include:
chairdeskdoorpocket_doorelevatoravatar_podtv_monitorphonefolderbriefcasebackpacklaptopflowerfloral_arrangementbuildingsunmoondodecahedronbackdropsolar_panelsilver_hairknife(a handle and a blade that come apart),satchel,bowl,rock,altarscroll(rolled, unrolled, written on, or trailing like a banner, with text that is written, crossed out and replaced),quillrope(a coil, wound round two wrists and pulled tight, or snapped into two pieces that recoil and lie where they fall)barbell(a composite of two boulders and a log,assembledor taken apart into analtar),magazine(one, with words on its cover, or a stack)
Several props are stateful: doors and avatar pods open and close, the Governor changes color, a knife breaks, a phone goes live, a scroll is unrolled and revised, a rope is tied and snaps. pam/prop_states.py keeps the state of all of them, and the prop_transition action changes it.
PAM works directly from JSON, but the intended authoring layer is often Fountain+:
INT. POLYMERCORP OFFICE - DAY
[[ CAMERA: FRAMING=medium | SUBJECT=ensemble | MOVE=static | TRANSITION=cut ]]
[[ MOOD: corporate, fluorescent, slightly absurd ]]
[[ CAPTION: Office of Mrs Tatiana Bosch | lower-third | 5s | italic ]]
ALICE
Hi, Bob.
BOB
Hi, Alice.
fountain2pam.py converts these annotations into JSON actions, shot metadata, prompts, and optional character-registry merges.
PAM v0.9.x includes a JSON-driven face system implemented in face_builder.py.
Faces are built from Manim vector objects, not image files. A face can define:
- skin color;
- hair color and style;
- eyes;
- brows;
- mouth;
- clothing panel;
- hats;
- buns;
- earrings;
- expression variants;
- front and side views.
The face system is separate from skeleton physics. The cast block defines the body; the faces block defines the cartoon head overlay.
PAM can attach small updater-driven mobjects to live figures:
- torso icons;
- rectangular name tags;
- gloves;
- shoes;
- text-only badge labels;
- dog harnesses and service labels.
These overlays follow the character through walking, running, morphing, turning, scale changes, and fade-out cleanup.
PAM’s player is a Manim MovingCameraScene. It can consume _subscene_marker and _shot_meta data generated by Fountain+ CAMERA annotations.
Common camera vocabulary includes:
- framing:
wide,medium,close,insert; - movement:
static,push,pull,pan-follow,pan-up,pan-down,drift; - subject:
ensemble, a character key, or a prop/insert target; - transition: usually
cut, with animated transitions handled through movement duration.
Camera mode must be explicitly enabled with PAM_CAMERA_MODE=1.
Recommended baseline:
- Python 3.10+
- Manim Community, tested in the reference manual with Manim 0.20.1 on the Cairo backend
screenplain, used byfountain2pam.py- NumPy and SciPy, typically installed through Manim
- FFmpeg and system libraries required by Manim
- optional: LaTeX, if scenes use TeX-rendered labels
- optional: Blender (4.2, 4.4, and 5.2 tested; 3.x supported), for
trace2blender.pyandpam2blender.py
git clone https://github.com/wdjoyner/pam.git
cd pampython3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pippip install manim screenplain
pip install -e .PAM is developed and tested with Manim 0.22.1, and requirements.txt pins it: pip install -r requirements.txt. The timed parallel blocks depend on details of how Manim redraws a scene, so run the tests (python -m pytest) before relying on another version.
manim --versionpython - <<'PY'
import pam
print("PAM import OK")
PYDepending on how the repository is packaged at a given commit, you may also be able to work directly from the repository root without an editable install, as long as Python can import the local pam modules.
Create scene_quick_start.json:
[
{
"action": "title",
"text": "Quick Start",
"subtitle": "PAM v0.9.18"
},
{
"action": "cast",
"characters": {
"alice": {
"figure_type": "human",
"gender": "female",
"pose": "standing_front",
"offset": [-2.0, 0, 0],
"style": {
"head_label": "A",
"edge_color": "#cc4477",
"node_color": "#cc4477",
"head_color": "#ffffff",
"head_stroke": "#cc4477"
}
},
"bob": {
"figure_type": "human",
"gender": "male",
"pose": "standing_front",
"offset": [2.0, 0, 0],
"style": {
"head_label": "B",
"edge_color": "#4477cc",
"node_color": "#4477cc",
"head_color": "#ffffff",
"head_stroke": "#4477cc"
}
}
}
},
{
"action": "props",
"items": {
"table": {
"type": "desk",
"x": 0.0,
"label": "T"
}
}
},
{ "action": "fade_in", "who": "alice" },
{ "action": "fade_in", "who": "bob" },
{ "action": "say", "who": "alice", "text": "Hi, Bob!" },
{ "action": "wave", "who": "bob", "cycles": 2 },
{ "action": "say", "who": "bob", "text": "Hi, Alice!" },
{ "action": "walk_to", "who": "alice", "to_x": -0.5 },
{ "action": "walk_to", "who": "bob", "to_x": 0.5 },
{ "action": "say", "who": "alice", "text": "Nice desk." }
]Render it:
PAM_SCRIPT=scene_quick_start.json manim -pql pam_player.py PAMPlayerHigh-quality render:
PAM_SCRIPT=scene_quick_start.json manim -pqh pam_player.py PAMPlayer4K render:
PAM_SCRIPT=scene_quick_start.json manim -qk pam_player.py PAMPlayerSome older PAM notes used command-line arguments such as:
manim -pql pam_player.py PAMScene --json scene_quick_start.jsonThe current pam_player.py reference describes PAMPlayer, which reads the screenplay path from the PAM_SCRIPT environment variable. Prefer the PAM_SCRIPT=... manim ... PAMPlayer form unless you are intentionally running an older branch.
Create scene.fountain:
Title: Quick PAM Scene
Author: David Joyner
INT. POLYMERCORP OFFICE - DAY
[[ CAMERA: FRAMING=medium | SUBJECT=ensemble | MOVE=static | TRANSITION=cut ]]
[[ MOOD: corporate, fluorescent, slightly absurd ]]
[[ CAPTION: Office of Mrs Tatiana Bosch | lower-third | 5s | italic ]]
ALICE
Hi, Bob.
BOB
Hi, Alice.
Convert it to PAM JSON:
python fountain2pam.py scene.fountain \
-o scene.json \
--prompts scene_prompts.jsonRender it with camera mode enabled:
PAM_SCRIPT=scene.json \
PAM_PROMPTS=scene_prompts.json \
PAM_CAMERA_MODE=1 \
manim -pql pam_player.py PAMPlayerIf the scene uses a project character registry:
python fountain2pam.py scene.fountain \
-o scene.json \
--prompts scene_prompts.json \
--characters tntd_characters.json| Key | Purpose | Typical output |
|---|---|---|
CAMERA |
Framing, subject, move, transition | _shot_meta on a _subscene_marker |
MOOD |
Lighting or atmosphere | Prompt metadata |
KIND |
Scene type | Prompt metadata |
SCENE POPULATION |
Extras/background density | Prompt metadata |
NEGATIVE |
“Avoid this” prompt terms | Prompt metadata |
CAPTION |
On-screen text | caption action |
SOUND |
Diegetic sound flash | sound_cue action |
PHONE |
Phone/intercut speech mode | say with O.S. bubble metadata |
CHARACTER |
Per-scene character override | Cast-block entry/update |
PRODUCTION NOTE |
Human-only metadata | No executable action |
BEAT (Milestone 5) |
A beat identifier next to an action or a line of dialogue: [[beat: s02_pull_attempt]] |
With --cues or --project, the cue's hand-authored steps; otherwise nothing |
When using [[ ... ]] annotation blocks before dialogue, keep a blank line before the character cue.
Good:
[[ CAMERA: FRAMING=close | SUBJECT=Sidel | MOVE=static | TRANSITION=cut ]]
SIDEL
The Governor is waiting.
Risky:
[[ CAMERA: FRAMING=close | SUBJECT=Sidel | MOVE=static | TRANSITION=cut ]]
SIDEL
The Governor is waiting.
A PAM screenplay is a JSON array. Each executable step has an "action" key:
[
{ "action": "cast", "characters": {} },
{ "action": "props", "items": {} },
{ "action": "fade_in", "who": "alice" },
{ "action": "say", "who": "alice", "text": "Hello." }
]The cast action registers character specs. Later actions refer to them by who.
{
"action": "cast",
"characters": {
"sidel": {
"figure_type": "alien",
"gender": "female",
"pose": "standing_front",
"offset": [-3, 0, 0],
"scale": { "sx": 0.7, "sy": 0.7, "anchor": "lankle" },
"style": {
"head_label": "Sidel",
"edge_color": "#4f77aa"
}
}
}
}The props action registers initial props. Later prop actions refer to them by prop.
{
"action": "props",
"items": {
"phone": {
"type": "phone",
"style": "cellphone",
"x": 1.5,
"y": -1.2
},
"desk": {
"type": "desk",
"x": 0.0
}
}
}Large background or camera-addressable objects may be stored in a separate scene_objects registry. Use scene-object teardown actions for those, not prop teardown actions.
[
{
"action": "scene_objects",
"items": {
"skyline": { "type": "backdrop", "x": 0, "y": 1.5 }
}
},
{ "action": "remove_scene_object", "prop": "skyline", "rt": 0.4 }
]Use remove_prop for interactive props. Use remove_scene_object or clear_all_scene_objects for non-interactive stage dressing registered under scene_objects.
Fountain+ CAMERA annotations generate _subscene_marker steps. The player only uses them when:
PAM_CAMERA_MODE=1Without camera mode, _subscene_marker steps are skipped.
A common JSON screenplay order is:
- optional
title; cast;- optional
faces; - initial
props; - optional
scene_objects; - executable actions.
Example skeleton:
[
{ "action": "title", "text": "Scene 25", "subtitle": "Hospital corridor" },
{
"action": "cast",
"characters": {
"freydoon": {
"figure_type": "human",
"gender": "male",
"pose": "standing_front",
"offset": [-4.5, 0, 0],
"style": { "head_label": "Freydoon" }
}
}
},
{
"action": "faces",
"characters": {
"freydoon": {
"skin": "#c07848",
"hair": "#181818",
"hair_style": "short_male",
"eye_type": "human",
"eye_color": "#6a3808",
"mouth": "neutral"
}
}
},
{
"action": "props",
"items": {
"phone": { "type": "phone", "x": 1.5 }
}
},
{ "action": "fade_in", "who": "freydoon" },
{ "action": "attach_face", "who": "freydoon", "image": "freydoon", "scale": 0.35 },
{ "action": "walk_to_prop", "who": "freydoon", "prop": "phone" },
{ "action": "pick_up_phone", "who": "freydoon", "prop": "phone" },
{ "action": "say", "who": "freydoon", "text": "This had better be important." }
]PAM uses underscore-prefixed keys for comments and generated metadata.
| Key | Purpose |
|---|---|
_comment |
Human-readable comment; skipped by the player |
_hint |
Authoring/debugging hint; skipped by the player |
_subscene_marker |
Generated subscene boundary used for camera and prompt chunking |
_shot_meta |
Camera metadata generated from Fountain+ CAMERA tags |
Use _comment entries instead of trying to add JSON comments:
{ "_comment": "Sidel crosses to the phone." }| Field | Meaning |
|---|---|
figure_type |
human, alien, dog, or dodecahedral/Governor-style prop-character type |
gender |
Preset used by human/alien builds |
build |
Body-proportion preset |
pose |
Initial named pose |
scale |
sx, sy, and anchor information |
offset |
Initial world-space position |
color |
Canonical base color, often expanded into style colors |
torso_color |
Torso/uniform color |
style |
Head label, edge color, node color, bubble colors, clothing fields, overlays |
uniforms |
Named uniform variants for change_uniform |
tic_profile |
Optional triggered micro-motion profile |
hidden |
Register without initially showing |
scale may be a float or a dictionary. The dictionary form is clearer:
"scale": {
"sx": 0.7,
"sy": 0.7,
"anchor": "lankle"
}The anchor joint keeps its place across the body. Heights are scaled about the anchor's height in the build's standing pose (the floor, for an ankle), so a pose that lifts the anchor foot, such as a walk or run keyframe, does not lift the whole scaled figure; before this was fixed, a figure at scale 0.48 rose half a unit at every step. A pose with the anchor on the floor is scaled as it always was. The 2.5D depth scale works the same way.
Several scale actions use target scale, not multiplier semantics. If a character is already at 0.7 and you set sy to 0.5, the new scale is 0.5, not 0.35.
Cast and props entries accept optional "depth" (float, 0 = on-stage plane, negative = farther back) and "rescale" (bool, opt-in perspective shrink) keys. Depth always affects z-layering; it only affects on-screen size when "rescale": true. walk_to/run_to/trot_to accept a "depth" target to animate a character moving toward or away from the camera, with occlusion updating dynamically mid-move. Scene-level perspective strength is tunable via an optional preamble {"action": "depth_config", "depth_k": 0.08}. See the reference manual, "Runtime additions in v0.9.23," for the full key/warning/limitation reference.
Any cast entry may declare an "sfx" block keyed by action type — {"sfx": {"wave": "blip.wav", "say": {"sfx": "chime.m4a", "sfx_gain": -3, "sfx_trigger": "end"}}}. Sound resolution is a three-tier ladder: per-action inline "sfx" beats the character's cast block, which beats the scene-level audio defaults; an explicit null at any tier suppresses the tiers below. Per-action parameters sfx_gain (dB), sfx_delay (seconds), sfx_trigger ("start" or "end"), and sfx_duration (seconds — cut a too-long cue, with a click-free fade at the cut) work at either tier; .m4a files are auto-converted via FFmpeg. Structured warning output is also available: set PAM_WARNINGS_JSON=warnings.json to dump every PAM warning as (array_index, action_type, message) JSON at render completion. See the reference manual §13.9–13.10.
A tic_profile attaches small motion fragments to a character and fires them on triggers such as react or sentence_end.
{
"figure_type": "alien",
"tic_profile": [
{ "fragment": "hand_twitch_r", "triggers": ["react"] },
{ "fragment": "foot_tap_l", "triggers": ["sentence_end"] }
]
}Relevant fragments include:
hand_twitch_rhand_twitch_lfoot_tap_rfoot_tap_l- dog-specific fragments such as
tail_wag
A say step may fire sentence_end tics automatically. Use suppress_tics: true on the speech step to skip them.
A react step may also name one fragment, whatever the character's profile says, and give it a length in frames; it then plays on the frame clock, also as a step of a timed block (Milestone 6):
{ "action": "react", "who": "abraham", "fragment": "count_tap_r", "frames": 4 }Milestone 6 added the fragments count_tap_r (a finger ticks off an item on the raised hand), nod, head_shake, scribble_r (a writing hand; repeat it with cycles), flick_r, finger_wag_r, shrug, startle (a little jump at a noise) and chest_pat_r.
The flat-cartoon face system is implemented in face_builder.py.
A face spec lives in an "action": "faces" block and is independent of the cast skeleton. The cast defines the body. The face spec defines the cartoon overlay attached to the head dot.
{
"action": "faces",
"characters": {
"sidel": {
"skin": "#8cc47c",
"hair": "#202020",
"hair_style": "short_male",
"eye_type": "alien",
"eye_color": "#c87820",
"brow_thick": true,
"mouth": "neutral",
"cloth_color": "#202840",
"cloth_style": "uniform"
}
}
}Only skin and hair are strictly required by the builder. Other fields have defaults.
{ "action": "attach_face", "who": "sidel", "image": "sidel", "scale": 0.35 }The image value can be:
- a
FACE_DATAkey such assidel; - an expression variant key such as
sidel_worried; - a legacy
.pngor.svgfile inpam/assets/.
{ "action": "attach_face", "who": "sidel", "image": "sidel", "view": "lside", "scale": 0.35 }Valid views:
| View | Meaning |
|---|---|
front |
Default front-facing portrait |
lside |
Profile facing left |
rside |
Profile facing right |
Use side-view faces when the skeleton is in a side pose or walking direction.
Calling attach_face again removes the previous face and attaches the new one:
[
{ "action": "attach_face", "who": "sidel", "image": "sidel", "scale": 0.35 },
{ "action": "say", "who": "sidel", "text": "The Council's decision is final." },
{ "action": "attach_face", "who": "sidel", "image": "sidel_worried", "scale": 0.35 },
{ "action": "say", "who": "sidel", "text": "This will not go well for us." }
]Keep the same scale for all expression swaps on the same character unless you deliberately want a visible size jump.
PAM v0.9.18 adds per-character geometry overrides for hair and triangle hats.
Hair overrides:
| Field | Meaning |
|---|---|
hair_width |
Override the front-view hair-cap width |
hair_height |
Override the hair-cap height |
hair_offset_y |
Raise or lower the hair cap center |
Triangle hat overrides:
| Field | Meaning |
|---|---|
hat_width |
Override triangle or inverted-triangle base width |
hat_height |
Override triangle height/span |
Example:
{
"factor": {
"skin": "#8cc47c",
"hair": "#1f1f1f",
"hair_style": "short_male",
"hat_style": "triangle",
"hat_color": "#2a6830",
"hat_width": 0.72,
"hat_height": 0.03
}
}These overrides are optional and default to previous hardcoded geometry, so existing characters should render unchanged.
Wardrobe overlays are decorative Manim mobjects attached to live characters. They are not pose data, skeleton joints, or props.
General lifecycle:
- attach once after
fade_in; - the updater tracks the character through motion;
- re-attaching the same overlay type first removes the old one;
- a matching detach action is available;
fade_outcleans up attached faces, icons, gloves, shoes, tags, and harnesses.
{
"action": "attach_torso_icon",
"who": "yannos",
"preset": "name_tag",
"text": "Y. YANNOS",
"fill": "#f0e4b8",
"stroke": "#3a2a14",
"scale": 1.0
}Detach:
{ "action": "detach_torso_icon", "who": "yannos" }{ "action": "attach_gloves", "who": "bevers", "color": "#cc3333" }{ "action": "detach_gloves", "who": "bevers" }{ "action": "attach_shoes", "who": "bevers", "color": "#1a1a1a" }{ "action": "detach_shoes", "who": "bevers" }Shoe updaters track the figure’s facing direction, so shoes mirror when a character changes walking direction.
{ "action": "attach_name_tag", "who": "chekov", "text": "CHEKOV" }For human/alien panel-clothed faces, attach the face first so the badge anchor exists:
[
{ "action": "attach_face", "who": "sidel", "image": "sidel", "scale": 0.35 },
{
"action": "attach_name_tag",
"who": "sidel",
"text": "CMDR\nSIDEL",
"font_size": 14,
"color": "#c8a020",
"dy": 0.02
}
]Dog harnesses are controlled through the dog’s style dictionary:
{
"action": "cast",
"characters": {
"chekov": {
"figure_type": "dog",
"offset": [-2, 0, 0],
"style": {
"harness_style": "standard",
"harness_color": "#2d6a4f"
}
}
}
}{
"action": "props",
"items": {
"main_desk": {
"type": "desk",
"x": 0.0,
"label": "D"
},
"exit_door": {
"type": "pocket_door",
"x": 5.5
}
}
}{
"action": "spawn_prop",
"prop": "folder",
"type": "folder",
"x": 1.0,
"y": -1.0
}Always provide type. In some older/fallback paths, a missing type may default to hat, which is rarely what was intended.
{ "action": "remove_prop", "prop": "folder", "rt": 0.3 }Some props have a state. Sliding doors, the elevator and the avatar pod are open or closed; the Governor is gold, amber or dark; a knife is intact or broken; a phone is on standby, recording or live; a scroll is rolled, unrolled, edited or trailing, and what it says changes separately; a rope is loose, tied, tightened or snapped, and its shape follows what it is attached to. One action changes the state of any of them:
{ "action": "prop_transition", "prop": "lift", "to": "open" }{ "action": "prop_transition", "prop": "knife", "to": "broken",
"parts": { "handle": { "attached": { "to": "isaac", "joint": "lwrist" } },
"blade": { "attached": { "to": "bowl", "mode": "in" } } },
"frames": 6 }{ "action": "prop_transition", "prop": "scroll", "to": "edited",
"text": { "replace": "THE KNIFE?", "with": "HIS SON." }, "frames": 24 }{ "action": "prop_transition", "prop": "rope", "to": "tied",
"attached": { "to": "isaac", "joints": ["lwrist", "rwrist"], "mode": "around" },
"frames": 18 }The older actions still work and go through the same machine:
{ "action": "elevator_open", "who": "lift" }{ "action": "elevator_close", "who": "lift" }{ "action": "open_lid", "prop": "pod" }{ "action": "close_lid", "prop": "pod" }See Stateful props and the continuity ledger.
{
"action": "prop_say",
"prop": "governor",
"text": "Processing.",
"bubble_color": "#382050",
"text_color": "#ffffff",
"border_color": "#c8a020"
}For GovernorGraph, v0.9.18 adds geometry-aware bubble placement and a y_offset key for per-call vertical adjustment:
{
"action": "prop_say",
"prop": "governor",
"text": "Please wait.",
"y_offset": 0.2
}Dog-like figures may be registered in both the cast registry and the prop registry. This allows either character-like or prop-like addressing:
[
{ "action": "fade_in", "who": "chekov" },
{ "action": "trot_to", "who": "chekov", "x": 2.0 },
{ "action": "prop_say", "prop": "chekov", "text": "Woof." },
{ "action": "react", "who": "chekov" }
]This is a practical overview. The full action reference belongs in the detailed manual.
{ "action": "say", "who": "sidel", "text": "The Governor is waiting." }{ "action": "prop_say", "prop": "phone", "text": "RING!" }{ "action": "clear_bubble", "who": "sidel" }{ "action": "clear_prop_bubble", "prop": "phone" }{ "action": "clear_all_bubbles", "rt": 0.2 }{ "action": "walk_to", "who": "sidel", "to_x": 2.0 }{ "action": "run_to", "who": "sidel", "to_x": -4.0 }{ "action": "rush_to", "who": "sidel", "to_x": 3.0 }{ "action": "walk_to_prop", "who": "sidel", "prop": "desk" }{ "action": "exit_through_doors", "who": "sidel", "door": "exit_door" }Common locomotion actions:
walk_torun_torush_torush_outsqueeze_throughwalk_to_proprun_to_propexit_throughexit_through_doorsjump_upfall_downdodgetrot_to
{ "action": "turn", "who": "sidel", "facing": "left" }{ "action": "face", "who": "sidel", "target": "governor" }{ "action": "sit_down", "who": "sidel", "target": "chair" }{ "action": "stand_up", "who": "sidel" }{ "action": "wave", "who": "bob", "cycles": 2 }{ "action": "nod", "who": "bob" }{ "action": "shake_head", "who": "bob" }{ "action": "shrug", "who": "bob" }{ "action": "react", "who": "bob", "expression": "surprised" }Common expressive actions:
wavewave_leftwave_rightnodshake_headshrugpoint_atexpressreact
{ "action": "reach_for", "who": "chava", "target": "folder" }{ "action": "grab", "who": "chava", "prop": "folder" }{ "action": "pick_up", "who": "sidel", "prop": "briefcase" }{ "action": "place_on", "who": "sidel", "prop": "briefcase", "target": "desk" }{ "action": "punch_button", "who": "bevers", "target": "elevator_button" }Common prop-interaction actions:
reach_forgrabpick_uppick_up_phonehang_upplace_onput_downpeel_from_handpunch_buttonsearch_drawerssnap_photostick_tomove_asidecarry
{ "action": "hold_hands", "who": "alice", "target": "bob" }{ "action": "pat_head", "who": "alice", "target": "bob" }Common two-figure actions:
kisshold_handspatpat_headhand_tograb_armtwist_arm_behindrelease_armreach_character
{ "action": "caption", "text": "Three hours later...", "position": "center", "duration": 3.0 }{ "action": "persistent_caption", "text": "LIVE FEED", "position": "upper-left" }{ "action": "sound_cue", "label": "KNOCK!", "display": true }{ "action": "on_screen_text", "text": "SYSTEM ERROR", "duration": 2.0 }{ "action": "wait", "rt": 1.0 }{ "action": "focus", "who": "sidel", "rt": 0.4 }{ "action": "focus_reset", "rt": 0.4 }{ "action": "flash", "who": "sidel", "color": "#ffff00", "rt": 0.2 }PAM v0.9.18 improves focus/focus-reset behavior around face-attached figures by keeping head/face overlays in front during the animation, reducing transient head-dot or neck/shoulder flicker.
parallel wraps actions that should happen together:
{
"action": "parallel",
"rt": 1.0,
"steps": [
{ "action": "walk_to", "who": "alice", "to_x": -0.5 },
{ "action": "walk_to", "who": "bob", "to_x": 0.5 }
]
}PAM uses a two-pass approach internally:
- collect/coordinate locomotion-like animations;
- collect simple parallel-safe animations;
- apply required post-pass state updates.
Not every action is parallel-safe. Actions that mutate shared scene state, speech-bubble state, prop ownership, or camera state are usually better authored sequentially.
Known caution: group_translate is documented as potentially unsafe in parallel blocks in the v0.9.x line.
pam_player.py is a Manim MovingCameraScene. The camera frame has:
- a width, controlling zoom/framing;
- a center, controlling pan/tilt;
- optional animated transitions.
PAM_SCRIPT=scene.json PAM_CAMERA_MODE=1 manim -pql pam_player.py PAMPlayerPAM_SCRIPT=scene.json \
PAM_PROMPTS=scene_prompts.json \
PAM_CAMERA_MODE=1 \
manim -pql pam_player.py PAMPlayer| Framing | Typical use |
|---|---|
wide |
Whole-stage or ensemble coverage |
medium |
Two-shot or character-medium framing |
close |
Character close-up |
insert |
Prop close-up |
A legacy insert is 7 units wide and centered at y = 1.5, which misses a prop on the floor or in a hand. Give the shot "fit": "bounds" and it is framed from its subject's bounding box instead (pam/shot_targets.py):
{"_subscene_marker": "s05_phone", "_shot_meta": {
"framing": "insert", "subject": "phone", "move": "static",
"fit": "bounds", "margin": 0.12}}- the box is that of what is visible of the subject: for a composite prop, its parts that are on stage (the broken knife: the handle in a hand and the blade in the bowl);
- it also holds where the shot takes the subject before the next cut: a
prop_transitionafter the cut that sends the subject, or a part of it, somewhere is framed where it is going (at the attachment, turned to its angle); - in a timed block, a move counts only if it is over by the block's next cut; one still under way belongs to the next shot (in Scene 2 the handle comes away in an insert on the knife, and the blade lands in the next one, on
bowl+knife.blade); - a subject held by a character who has not faded in yet is found in the hand of the character as its
fade_inwill build it, so a scene may open on an insert; margin(default 0.12) is the fraction of the frame left clear on each side;- text on the subject (a scroll's lines, a phone's screen) must be readable: when its cap height would be under 3% of the frame's height, the frame closes in on the text;
subjectmay name several things joined by+("knife+bowl"), and may be a character.
A shot without fit is framed exactly as before. In Fountain+, MARGIN=0.15 in a CAMERA note asks for it, and fountain2pam.py --project gives every insert fit.
| Move | Typical behavior |
|---|---|
static |
Instant cut/reframe |
push |
Animated move inward |
pull |
Animated move outward |
pan-follow |
Follow subject horizontally |
pan-up |
Vertical upward pan |
pan-down |
Vertical downward pan |
drift |
Slow atmospheric move |
At the default Manim frame:
- visible x-range is roughly
[-7.1, 7.1]; - visible y-range is roughly
[-4, 4]; - the practical stage is roughly
x in [-6, 6]; - a default standing character’s feet are around
y = -2.0; - a default head is around
y = 1.2; - speech bubbles extend about 2.5 units from the speaker.
Safe speech-bubble placement:
- right-side bubble: speaker should usually be at
x <= 4.0; - left-side bubble: speaker should usually be at
x >= -4.0.
PAM has two Blender paths:
| Tool | What it exports |
|---|---|
pam_trace.py + trace2blender.py |
The animation itself: every character's motion, timing, camera moves, visibility, props, and speech bubbles, as an animated .blend with solid 3D stick figures, 3D props, lights, a floor, and shadows. |
pam2blender.py |
Layout only: cameras, lights, props, and character placeholders from the screenplay JSON, as a Blender Python script. |
From the PAM folder, with the Python environment that renders PAM active:
PAM_SCRIPT=screenplay_alice-meets-bob.json python pam_trace.py alice_trace.json
blender --background --python trace2blender.py -- alice_trace.json alice.blend --female alice
blender --background alice.blend --render-animpam_trace.pyplays the screenplay in Manim's dry-run mode (no video is written) and records a motion trace (JSON). The 46-second Alice scene traces in about 10 seconds; the 100-minute TNTD feature takes about 25–40 minutes.trace2blender.pybuildsalice.blendfrom the trace, in seconds.--render-animrenders the video next to the.blend(for examplealice_0001-1390.mp4). You can also open the.blendin Blender and press the spacebar to play it.
On a Mac, blender is usually not on the PATH; use /Applications/Blender.app/Contents/MacOS/Blender, or add an alias:
echo 'alias blender=/Applications/Blender.app/Contents/MacOS/Blender' >> ~/.bash_profileTested with Blender 4.2, 4.4, 4.5.1, 5.0.1, and 5.2; written to also work with 3.x.
Blender renders at 30 fps from the 15 fps trace: trace frame f is keyed on Blender frame 1 + 2f, the frames between are interpolated, and the film ends on frame 2N for a trace of N frames, so it is exactly as long as the Manim animation.
- Smooth motion. Each move keeps the rate function PAM used (
smooth,rush_from_start, …), mapped to Blender's own easing curves where they match and baked frame by frame where they don't. Walks, runs, and carries follow a smooth spline through the keyframe poses with a steady root. - Planted feet. Feet stay put while they carry weight (no sliding), with knees solved to match, a slight hip dip so the legs can reach, and a subtle hip bob. Foot contacts come from
POSE_CONTACTSinpam/hooks.py. - A 3D look. Rounded limbs that taper from shoulder and hip to wrist and ankle, with knee and elbow joints; a solid four-cornered torso that follows the shoulders and hips and continues below the hips like a shirt (a short flared dress for female figures;
--hem), so the legs come out from under it; lights, a floor and back wall with cast shadows, and a camera tilted slightly toward the floor in wide shots. The tilt follows the framing: all of it in shots 6 units wide or more, none in shots 2 units wide or less (inserts and close-ups are framed straight on, as in Manim, so a prop in front of the figures is where Manim shows it), and in proportion between. - Gendered chests. Male chests are wide at the shoulders and narrow at the hips (male hips are pulled in to 0.65 of PAM's spread;
--hipschanges that); female chests the reverse. The cast's"gender"field is used automatically (a"narrow"build counts as female when no gender is given);--female/--maleoverride it. - Skin and clothing. Give a cast entry a
"skin"color (or"skin_color"in its"style") and the head, neck, arms, and legs take that color while the chest, shoulders, and hips keep the figure's color as clothing. PAM ignores the key, so the Manim render is unchanged.--skin nona=#7cc45a,sidel=#3f8f4adoes the same from the command line. - Shoes: a simple ellipsoid under each foot, pointing at the camera in front views and along the facing direction in side views (
--shoes HEXfor the color,--no-shoesto leave them off). - Speech bubbles, with PAM's colors, tails, phone/off-screen style, and timing, following walk-and-talk speakers. In close-ups, PAM's bubbles grow on screen with the zoom and can run past the edge of the frame (in the Manim video too); in Blender each bubble keeps the screen size it has in the opening wide shot (down to half size, shrinking toward its tail so it still points at the speaker) and is kept inside the camera frame while it is shown.
--bubbles-worldkeeps PAM's world-space size instead. A bubble stands in front of the cast, so where the camera is tilted its height is corrected to show it on the screen where Manim draws it (never closer to the edge of the frame than the margin that keeps it inside). A line that fades in or out (frames_in,frames_out) fades in Blender over the same frames. - Props and scene objects. Desks, tables, consoles (with their monitor), doors, chairs, cellphones, the knife's handle and blade, the scroll (with its text), the pieces of a rope (curves that change shape on every frame), and the Governor dodecahedron become simple 3D models; every other prop type is extruded from its 2D Manim outline, so nothing disappears. Floor-standing props are set on the floor, doors sit in the back wall, and props appear, move, and disappear when they do in Manim (
props,spawn_prop,remove_prop,place_on,reparent_prop, ...). - Held props follow the hands. Between a figure's attach and release (
carry,pick_up,grab,hand_to, ...) the prop rides on the holding wrist(s), so it moves with the Blender figure's smoothed walk. A prop placed on a table slides from the hand to the tabletop and rests there, tilted toward the camera if it is a phone. Hats and otherpam_followsaccessories ride on the head or torso. - Faces, wardrobe, labels, and on-screen text. Each face (
attach_face) becomes a 3D head: an ellipsoid in the face's skin color, sized to its head shape, with the eyes, brows, mouth, and hair wrapped onto its front and the ears at its sides; the neck and bib lie flat on the chest (--flat-faceskeeps the whole face flat). Torso icons and name tags (attach_torso_icon,attach_name_tag), dog harnesses, and head labels are flat decals traced from their Manim outlines, riding on the torso, head, or spine; the head ball hides while a face replaces it. Gloves become small 3D mitts on the wrists,attach_shoessets the 3D shoes' color and length, and clothed limbs (clothed_limbsin a cast style) become tapered sleeves and trouser legs in the band colors, withtorso_coloron the chest. On-screen text, captions, and title text appear where they sit in the Manim frame, even with--camera wide, without their dark backing panel (--card-bgbrings it back, fully or partly see-through). - The Governor spins slowly (when its
spawn_propasks for"animate": "spin", the default), glows gold, flares word by word while it speaks, and dims to amber and slows down in its low-power state (prop_colorwith#d47b00). - Fade-ins and fade-outs, camera moves, and background colors from the Manim scene. In a version 5 trace a fade keeps its frames: a prop fading in, a word card fading in and out, and the
screen_fadeto black at the end of a scene fade in Blender as they do in Manim (the trace's"opacity"lists, keyed as a see-through mix on the materials).
Options go after the .blend name.
| Option | Effect |
|---|---|
--look eevee |
Default: solid rounded figures, lights, shadows (EEVEE). |
--look studio |
Same figures with fast Workbench shading. |
--look flat |
The original thin, unlit look. |
--female A,B / --male A,B |
Override a character's chest shape. |
--bust |
Add a bust to female chests (off by default). |
--tilt DEG |
Camera tilt toward the floor in wide shots (default 8; 0 for a straight-on view). The tilt follows the framing: all of it in shots at least 6 units wide, none in shots 2 units wide or less, in proportion between; with --camera wide all of it. |
--parity |
Blender parity (Milestone 8): turn off everything that moves something away from the Manim animation. The same as --exact --locomotion exact --no-footlock --bob 0 --hips 1 --tilt 0 --bubbles-world, with bubbles not kept inside the frame and no props or ropes lifted onto the floor. Appearance (the look, solid chests, joint balls, shoes, mouths, fades) does not change. Options after --parity override it. |
--no-bubbles |
Leave out speech bubbles. |
--no-mouths |
Leave out the talking mouths. By default each character gets a small dark mouth on the lower half of the head that opens and shuts while that character's speech bubble is showing. The mouths stay when --no-bubbles is given, so a film with a voice track still shows who is speaking. Dogs, and heads replaced by an attached face, get none. |
--camera wide |
Hold the widest framing the scene uses for the whole film, instead of following PAM's camera moves and cuts. |
--bubble-lift V |
Raise very dark bubble backgrounds (like the Governor's navy) to brightness V so they stand out on the stage (default 0.5; 0 keeps PAM's colors). |
--no-overlays |
Leave out faces, torso icons, name tags, gloves, PAM's shoes, and on-screen cards. |
--no-labels |
Leave out the head labels. |
--card-bg A |
Opacity of the dark panel behind on-screen text and captions (default 0, see-through; 1 as in Manim). |
--flat-faces |
Draw faces as flat decals instead of 3D heads. |
--hem F |
Length of the torso below the hips, times the default (0: the torso ends at the hips). |
--bubbles-world |
Keep PAM's bubble size in close-ups (bubbles are still kept inside the frame). |
--no-props |
Leave out props and scene objects. |
--skin A=#hex,... |
Skin color for these characters' head and limbs (overrides the cast's "skin"). |
--hips F |
Male hip spread as a fraction of PAM's (default 0.65; 1 keeps PAM's). |
--shoes HEX / --no-shoes |
Shoe color (default brown #4a3020), or no shoes. |
--res WxH, --fps N |
Render size (default 1280x720) and frame rate (default 30). |
--no-footlock, --bob S |
Turn off foot locking; scale or (with 0) remove the hip bob. |
--locomotion exact |
Walks use PAM's per-keyframe easing instead of the spline. |
--exact |
Bake every eased move instead of using Blender's easing curves. |
--tol T |
How closely a Blender easing curve must match a PAM rate function to be used (default 0.015). |
pam/hooks.py lets an outside script listen to PAM while a screenplay plays. PAM emits events for motion segments (from morph_to, set_pose, turn, and _pose_anims), figure creation, fade-ins and fade-outs, action begin/end, prop attach/release, speech bubbles, every top-level step as it starts (step) and every camera marker as it is applied (shot), and, for stateful props, prop_declared, prop_state_changed, prop_attached, prop_display, prop_text and prop_shape:
from pam import hooks
def listener(event, data):
if event == "segment":
print(data["t0"], data["pose_name"], data["rate_name"], data["contacts"])
hooks.subscribe(listener)The hooks are a no-op unless something subscribes: every emit site is guarded by if hooks.active():, and a normal pam-render produces exactly the same video with or without them. The trace format is documented at the top of pam_trace.py; old version-1 and version-2 traces still build (without props).
Prop events carry a mode (hooks version 2) that says what kind of hand-off each one is: "carry", "grab", "place", "put_down", "handoff", and so on. carry ends with "carry_end", a soft release: the figure still has the prop at its wrists, and usually a place_on or put_down follows and does the real release. The tracer keeps the hold going through a soft release when the next event for that prop is a release by the same figure with no walking in between; otherwise the prop stays where the carry left it, as in the Manim render.
- A face's neck and bib, and the other decals, are flat: in side views a near arm passes behind a bib instead of in front of it (Manim draws it on top). Hair or a hat reaching past the head's outline stays flat beyond it. Image-file faces (
.png) are skipped. - A figure's colors are taken from its first appearance; a later
change_uniformis not followed yet. - Props without a 3D model (TV monitors, letter graphs, backdrops, satchels, rocks, ...) are flat extrusions of their Manim outline, and a prop that changes shape inside itself (a laptop opening, a pod lid, sliding doors) keeps the shape it first appeared with; the trace records such a prop's state, but the builder does not animate it yet.
- A prop resting on or in another shares that prop's lift onto the floor and sits just in front of it; it does not ride along if the other prop is itself carried.
- In Manim, desks and doors are drawn from y = −2.6, about half a unit below the characters' feet; Blender lifts them onto the floor, together with anything resting on them.
- Dogs get smooth motion but no foot locking.
- Characters standing at different screen heights in the same shot share one floor, so some may hover slightly (in Manim, lower on screen reads as nearer the camera).
- Scaled characters (for example
"scale": {"sy": 0.7}) take overlong strides for their size, so their first and last steps lift the foot early.
PAM-specific configuration is passed through environment variables because Manim owns the command line.
| Variable | Required? | Meaning |
|---|---|---|
PAM_SCRIPT |
yes | Path to the PAM JSON screenplay |
PAM_CAMERA_MODE |
no | 1 enables camera mode; unset or 0 skips _subscene_marker camera handling |
PAM_PROMPTS |
no | Path to prompts JSON; default is normally based on the PAM_SCRIPT stem |
PAM_SHOW_CLOCK |
no | 1 displays an elapsed-time overlay for preview renders |
PAM_SCRIPT=scene.json PAM_SHOW_CLOCK=1 manim -pql pam_player.py PAMPlayerThe clock displays elapsed scene time as M:SS.ss. It is intended for low-quality timing previews, not final renders.
| Flag | Quality | Resolution | FPS |
|---|---|---|---|
-ql |
low | 480p | 15 |
-qm |
medium | 720p | 30 |
-qh |
high | 1080p | 60 |
-qk |
4K | 2160p | 60 |
-p |
preview after render | — | — |
Most authoring iteration uses:
PAM_SCRIPT=scene.json manim -pql pam_player.py PAMPlayerReference layout:
pam/
├── __init__.py public API exports
├── pam_player.py main Manim scene, camera, bubbles, registries, dispatcher
├── actions.py character-targeting action handlers and ACTION_REGISTRY
├── characters.py HumanGraph, AlienGraph, DogGraph, GovernorGraph
├── figure.py shared figure infrastructure, bubbles, scale anchors
├── poses.py named poses, cycles, expression glyphs
├── paired_poses.py multi-character interaction templates
├── builds.py body proportions and build presets
├── face_builder.py JSON-driven flat-cartoon face generation
├── tics.py tic fragments and triggered micro-motion helpers
├── props.py thin prop dispatcher / re-export layer
├── props_core.py shared prop infrastructure
├── props_furniture.py chair, desk, pocket door, elevator, avatar pod, TV monitor
├── props_carried.py hat, briefcase, folder, phone, backpack, laptop, bug,
│ knife, satchel, scroll, quill, rope
├── props_flora.py flowers and floral arrangements
├── props_environment.py buildings, sun, moon, dodecahedron, backdrop, panels
├── props_accessories.py accessory builders such as silver hair
├── character_gallery.py visual regression / documentation utility
├── hooks.py optional events for outside tools (pam.hooks)
├── shot_targets.py frames a shot from its subject's bounding box (Milestone 5)
├── fountain2pam.py Fountain+ to PAM JSON converter (cues, projects)
├── pam_trace.py records a motion trace for the Blender export
├── trace2blender.py builds an animated .blend from a motion trace
├── trace_replay.py replays a motion trace frame by frame (reference
│ reader; no Manim, no Blender)
├── pam2blender.py PAM JSON to Blender layout exporter
└── tntd_characters.json canonical TNTD character registry
| Problem area | Start here |
|---|---|
| Character-only action | actions.py |
| Action dispatch / main loop | pam_player.py |
| Cast registration | pam_player.py |
| Prop registration | pam_player.py, props_*.py |
| Camera behavior | pam_player.py |
| Speech bubbles | pam_player.py, figure.py, characters.py |
| Face attachment | face_builder.py, pam_player.py |
| Wardrobe overlays | actions.py, figure.py, characters.py |
| Pose shape | poses.py |
| Body proportions | builds.py |
| Prop geometry | props_*.py |
| Fountain parsing | fountain2pam.py |
| Blender export (motion) | pam_trace.py, trace2blender.py, trace_replay.py, pam/hooks.py |
| Blender export (layout) | pam2blender.py |
Most character-targeting actions belong in actions.py.
General pattern:
- implement a handler function;
- follow the existing handler signature convention;
- register it in
ACTION_REGISTRY; - decide whether it belongs in
_CANNOT_PARALLEL; - add a minimal JSON example;
- document the action.
Sketch:
def do_salute(fig, step, scene, name, *, props=None, cast=None):
rt = float(step.get("rt", 0.4))
# Build Manim animations.
# Update figure state if needed.
# Return animations if step requests _collect_anims.
...
ACTION_REGISTRY["salute"] = do_saluteAsk whether the action mutates:
- the cast registry;
- the prop registry;
- the bubble registry;
- camera state;
- prop ownership;
- z-order;
- attached updaters.
If it does, it may need special handling in pam_player.py or may not be parallel-safe.
Most prop builders belong in a props_*.py module.
General pattern:
- choose the correct prop module;
- implement a
build_*function returning a ManimVGroup; - assign stable metadata such as
pam_name,pam_type, and surface information; - define attachment points if relevant;
- register the builder;
- add a JSON example;
- document creation-time fields and runtime behavior.
Build presets belong in builds.py or the relevant figure-construction module.
Checklist:
- define body proportions;
- verify named pose compatibility;
- test front and side orientations;
- test speech bubble placement;
- test face attachment if the build uses faces;
- add a character-gallery sample;
- document the build.
Parser changes belong in fountain2pam.py.
Checklist:
- define syntax;
- decide whether the key emits executable actions, shot metadata, prompt metadata, cast metadata, or human-only notes;
- add parser support;
- update generated JSON examples;
- add a small screenplay test case;
- document the key.
This is the vertical slice of the Blender roadmap: one gag, Abraham's failed pull on Isaac's wrist, taken through every layer. It is opt-in. A screenplay that uses none of the syntax below plays and traces exactly as before.
{"action": "sequence", "id": "s02_wrist_pull", "do": [
{"action": "constrain", "id": "isaac_root", "type": "root_lock", "who": "isaac"},
{"action": "constrain", "id": "grip", "type": "joint_to_joint",
"who": "abraham", "joint": "rwrist",
"target": "isaac", "target_joint": "lwrist", "blend": 6},
{"action": "wait", "frames": 6, "beat": "grab"},
{"action": "wait", "frames": 6, "beat": "nothing_moves"},
{"action": "morph", "who": "abraham", "pose": "pull_lean", "frames": 12, "beat": "pull"},
{"action": "wait", "frames": 6, "beat": "strain"},
{"action": "release", "id": "grip"},
{"action": "slip_on_back", "who": "abraham", "frames": 4, "beat": "slip"},
{"action": "wait", "frames": 9, "beat": "comic_hold"}
]}The full scene is abe-isaac_wrist-pull_slice.json; render it with ./pam-render --script abe-isaac_wrist-pull_slice.json.
| Syntax | Meaning |
|---|---|
"frames": n |
The step lasts exactly n frames at 15 per second. Supported on wait, morph, turn, scale, slip_on_back, fade_out, and say, and on more actions inside a timed parallel block (next section). Use it in place of the seconds key, not with it. |
sequence |
A named run of steps (do) on the frame clock. The console reports the frames it ran on and any step that missed its count. Constraints started in a sequence end with it. |
"beat": "name" |
Names a step of a sequence. Beats and their frames are reported and written to the trace. |
constrain, type joint_to_joint |
Keeps who's wrist or ankle (joint) on target's target_joint. The elbow or knee is solved each frame; bone lengths do not change and the joint never flips side. blend is the number of frames the hand takes to get there. If the target is out of reach the limb straightens toward it, and the shortfall is reported. |
constrain, type root_lock |
Keeps who where it stands, whatever else tries to move it. |
constrain, type joint_to_prop |
Keeps who's wrist or ankle on a prop (prop), at point: center, top, bottom, left, right, or [dx, dy] from its center. The prop is measured as drawn on every frame, so the hand follows it when it moves. |
constrain, type joint_to_point |
Keeps who's wrist or ankle on a fixed stage position, "point": [x, y], while the rest of the body moves. |
"frames": n on constrain |
Releases the constraint by itself after n frames, even in the middle of a step. |
release |
Ends the constraint with that id on the current frame. |
slip_on_back |
The feet shoot out and the figure lands flat on its back, on the ground its feet were standing on. Works at any character scale. |
pull_immovable, cork_pop_up, mismatched_hug |
Choreography routines for two figures; see the next section. |
pose pull_lean |
Leaning back hard against something immovable. |
A scene that uses any of this is traced as trace version 5: it adds "fps": 15, whole-frame f0/f1 on every piece, the sequences with their beats, the constraint intervals, and a sampled piece holding the constrained limb's joints on every frame. trace2blender.py keys those samples directly, so the hand stays on the wrist in Blender. Other scenes are still written as version 4, unchanged.
Milestone 3 of the Blender roadmap. A routine is an action that works out its own blocking from the figures as they stand, so a physical gag survives a change of character size or position without being re-blocked. Every position is measured from the figures' resolved joints (after body scale, depth rescale and rotation) on the frame the routine starts; no routine contains a stage coordinate.
{"action": "sequence", "id": "s02_pull", "do": [
{"action": "pull_immovable", "id": "pull", "who": "abraham", "target": "isaac",
"frames_reach": 6, "frames_pull": 12, "frames_strain": 12},
{"action": "slip_on_back", "who": "abraham", "frames": 4, "beat": "slip"},
{"action": "wait", "frames": 9, "beat": "comic_hold"}
]},
{"action": "parallel", "id": "s02_cork", "frames": 42, "do": [
{"action": "cork_pop_up", "id": "cork", "who": "isaac", "target": "abraham", "at": 3},
{"action": "say", "who": "isaac", "text": "Up you get.", "at": 0, "frames": 18},
{"_subscene_marker": "s02_cork_medium", "at": 15,
"_shot_meta": {"framing": "medium", "subject": "abraham", "move": "static"}}
]},
{"action": "mismatched_hug", "id": "hug", "who": "abraham", "target": "isaac"}The full scene is abe-isaac_scene2-gags.json; render it with ./pam-render --script abe-isaac_scene2-gags.json.
| Routine | What happens | What it measures |
|---|---|---|
pull_immovable |
who takes hold of target, leans back until his arm is taut, and heaves. target is root-locked. Phases: reach 6, pull 12, strain 12 frames. |
who's arm and the joint he grips. He stands where the full lean leaves the arm just short of straight. If the nearest wrist is out of his reach he takes the knee, then the ankle. |
slip_on_back |
The feet shoot out and the figure lands flat on its back. | Leg length (for the slide) and the ground under the feet. |
cork_pop_up |
who bends and offers a hand to target, who is lying down; target takes it and is pulled onto his feet and off the ground. Phases: offer 6, accept 6, pop 3, land 2, hold 9. |
Both arms. The hand is offered where target can reach it; who bends only as far as his own arm needs. The hop grows if who is very tall. |
mismatched_hug |
who steps in and throws his arms around target. Phases: approach 6, reach 6, squeeze 12, release 6. |
target's width at the height of who's shoulders, against who's arm. Arms that are too short straighten and stop short, and the shortfall is reported. |
catch_by_collar (Milestone 6, Stage 6b) |
target pitches forward; who catches him by the collar with one hand, holds him up in the air at arm's length while he kicks and hangs, and sets him down. Phases: slip 3, catch 3, dangle 18, set_down 9. |
who's arm and shoulder, and how far target's collar is above his feet when he hangs. He is held at the height of who's shoulder, or higher if his feet would not clear the ground; who does not take a step. |
tie_wrist_loop (Milestone 6, Stage 6b) |
who steps up to target's held-out wrists and winds his hands round them in loops that get bigger and wilder, fiddles at the knot, yanks it tight and lets go. Phases: approach 6, wind 18, knot 9, yank 3, let_go 6. |
target's wrists on every frame, and who's arms: he stands on the far side of the wrists from target, and the loops are as big as his reach allows. |
| Key | Meaning |
|---|---|
who, target |
The two figures. |
id |
Names the routine in reports, its beats (<id>.<phase>) and its constraints (<id>.grip, ...). Default <action>_<who>. |
"frames": n |
The whole routine lasts n frames, shared over the phases in proportion to their defaults. |
"frames_<phase>": n |
One phase lasts n frames ("frames_strain": 20); 0 skips it. |
joint, target_joint |
pull_immovable, cork_pop_up: the hand that is used, and what it takes hold of. Chosen from the figures when omitted. |
cycles |
pull_immovable, mismatched_hug, catch_by_collar, tie_wrist_loop: number of heaves, squeezes, kicks (default 2) or loops (default 3). |
release |
pull_immovable, mismatched_hug, catch_by_collar, tie_wrist_loop: false keeps the contact after the routine, until a release step (or, for the two Stage 6b routines, a later step of the same routine with only its last phase). |
target_joint, lift, pose |
catch_by_collar: what the hand takes hold of (default neck, the collar); how far the hanging feet clear the ground at least (fraction of target's leg length, default 0.25); the pose he is set down in. |
lock |
pull_immovable: false leaves target free to move. |
hop, pose |
cork_pop_up: how high target leaves the ground (fraction of his leg length, default 0.25), and the pose he lands in (default standing_side). |
A routine can stand at the top level, in a sequence, or in a timed parallel block with at. Its contacts are ordinary constraints, so the solver's rules hold: bones keep their length, an elbow or knee never flips, and a target out of reach is reported, not an error. The trace lists each routine with its frames, its phases and what it measured ("routines"), and trace2blender.py plays the result with nothing to solve.
The roadmap's completion test is automated in tests/test_choreography.py: the scene is traced again with Isaac's scale raised from 1.15 to 1.30, and every gag must still read on the same frames, with no elbow or knee flipping.
The modules are pam/timeline.py, pam/constraints.py, and pam/choreography.py; each starts with a description of what it does and why. The key-by-key reference for all of this, and for the timed parallel blocks below, is section 9 of pam-player_manual.md.
Milestone 4 (Stages 4a, 4b and 4c) of the Blender roadmap. A prop can have a state, be made of parts that keep their own identity, have a display, bear text, change shape on every frame, and be kept on an attachment. All of it is opt-in: a prop is stateful when its item says so or a prop_transition names it.
[
{"action": "props", "items": {
"bowl": {"type": "bowl", "x": -0.55},
"knife": {"type": "knife",
"attached": {"to": "abraham", "joint": "lhip", "hidden": true}}}},
{"action": "prop_transition", "prop": "knife",
"attached": {"to": "abraham", "joint": "rwrist", "by": "blade", "angle": 180}},
{"action": "constrain", "id": "take", "type": "joint_to_prop",
"who": "isaac", "joint": "lwrist", "prop": "knife.handle", "blend": 6},
{"action": "parallel", "id": "s02_break", "frames": 30, "do": [
{"action": "release", "id": "take", "at": 3},
{"action": "prop_transition", "prop": "knife", "to": "broken", "at": 3, "frames": 6,
"parts": {"handle": {"attached": {"to": "isaac", "joint": "lwrist"}},
"blade": {"attached": {"to": "bowl", "point": "top", "mode": "in"},
"rate": "rush_into"}}},
{"action": "morph", "who": "isaac", "pose": "standing_front", "at": 3, "frames": 9}
]}
]The full scene is abe-isaac_knife-break.json.
| New syntax | What it does |
|---|---|
prop_transition |
Puts prop in the state to, moves it (or, with parts, its parts) to a new attached, and changes its display or (a scroll) its text; any one of these or all. With frames the move, a number that climbs, and writing take that long, on the frame clock, also as a step of a timed parallel block. rate eases the move (smooth, linear, rush_into, rush_from). |
"prop": "knife.blade" |
Names one part of a composite prop, in prop_transition, in a constrain step, as an attachment's to, or as a camera subject. |
attached (in a prop item, in prop_transition, in parts) |
Where a prop is kept on every frame: to (a character, a prop, or null), joint or joints (Stage 4c: several joints of a character), point, by, offset, x, y, angle, mode (held, on, in, embedded, free, and from Stage 4c around), hidden. |
state, display, parts in a prop item |
The state, display values and part attachments a stateful prop starts with. |
states, initial_state, transitions in a prop item |
A state machine of the item's own. |
Prop types knife, knife_handle, knife_blade, composite_prop |
The knife is a composite prop: states intact, broken, blade_carried, blade_embedded; parts knife.handle and knife.blade, two props from the start. composite_prop builds one from the parts its item lists. |
Prop type phone: states and display |
standby, recording (a red LIVE button), live (LIVE badge, viewers, comment). The screen changes independently of where the phone is. |
Prop types satchel, bowl, rock, altar |
Plain props for the others to go into, rest on, or stick in. |
Prop type scroll: states and text (Stage 4b) |
rolled, unrolled, edited (open and being written on), trailing (streaming out from its grip like a banner). Its text is a second dimension of its state: it changes only with a text step, and only while the scroll is edited; rolling, unrolling and trailing leave it alone. Every revision is kept, with the scene it was made in. The scroll is kept on an attachment by its grip ("by": "grip", the default), its near roller. |
text in a prop_transition |
One op or a list: {"write": "..."} (a new last line), {"write": "...", "line": n} (at the end of line n), {"cross_out": "..."}, {"replace": "...", "with": "..."}; line and occurrence say which, when a phrase is said more than once. With frames the letters appear one by one and the line through crossed-out words grows, on the frame clock, also as a step of a timed parallel block. |
text in a scroll item |
What the scroll says before any revision: a list of lines. |
Prop type quill |
A plain prop, to write with. |
Prop types rope, rope_piece (Stage 4c) |
A deformable composite prop: states loose, tied, tightened, snapped; pieces rope.piece_a and rope.piece_b, joined end to end, two props from the start. Its shape is worked out on every frame from its attachment: a coil hanging from a shoulder or lying on the ground; a loop with a knot round what it is around, following the wrists as they move; after the snap, two pieces that recoil and lie where they fall. tied and tightened need mode around. attrs.scale sizes it. |
"joints": ["lwrist", "rwrist"] in an attachment (Stage 4c) |
Several joints of a character: a rope around them goes round all of them; any other prop stays on their middle. |
"mode": "around" in an attachment (Stage 4c) |
Wound round the joints, or round a prop. |
continuity block in the sidecar |
The continuity ledger: scenes (playing order), props (what carries over, as before the first scene), and ledger (written by PAM). |
pam-validate --project P, --no-ledger |
Validates every scene of a project in order, opening each from the entry the one before wrote; --no-ledger reads the ledger and writes nothing. |
Doors, the elevator, the avatar pod's lid and the Governor already had states. They are machines of the same module now, bound to the flag and the methods they always had, so their old actions and prop_transition do the same thing through the same code.
The continuity ledger is one JSON file per project, the same file as the cast-and-props sidecar (pam_sidecar.json). Its continuity block lists the scenes in order and the props whose state carries over. A listed scene opens with those props as the scene before left them; playing or validating it writes its closing entry (state, parts, attachments, display, text and its revisions). A scene may override the ledger explicitly, and pam-validate reports every override. ./pam-validate --project projects/abe-isaac walks all six scenes of the example without rendering, and the roadmap's completion test for the knife (every component in its expected state and place in every scene, none lost, none twice) is test_knife_completion in tests/test_prop_states.py. The scroll's (its expected state, text and place at the end of every scene) is test_scroll_completion in tests/test_scroll.py, and the rope's (its expected state, pieces and place at the end of every scene) is test_rope_completion in tests/test_rope.py.
In the trace (version 5), "prop_states" gives each stateful prop's identity (the prop objects of its parts), its states and its display frame by frame, and "prop_events" lists every prop_state_changed. trace2blender.py builds each part once from that, follows its attachments, and gives the phone its screens. A scroll's text is in the trace frame by frame ("text" in its "prop_states" record): every letter as it is written and every line through struck text as it grows. trace2blender.py builds the scroll's roll, sheet and ribbon, shows each in its state, and sets the text in the same columns, keyed on the same frames. abe-isaac_scroll-revision.json is the scroll by itself. A rope's pieces carry their shape in the trace frame by frame, as control points ("shape" on each piece's prop object: sampled pieces, as for constrained limbs), and trace2blender.py builds each piece as a curve object whose points are keyed on the same frames; abe-isaac_rope-snap.json is the rope by itself. A hand held on a prop (joint_to_prop) now holds in Blender too: where the builder puts the prop somewhere other than Manim did (set on the floor, riding on a hand), the hand's samples are moved with it and the elbow solved again by the same rules.
The key-by-key reference is section 9 of pam-player_manual.md ("Stateful props"), and the first page of pam/prop_states.py.
Milestone 5 of the Blender roadmap. The screenplay stays a screenplay; choreography that cannot be read off its prose lives in a separate cue file, keyed by a beat identifier in a Fountain note next to the action line (or line of dialogue) it belongs to:
Abraham draws a battered knife from his satchel. Isaac takes it by the handle. [[beat: s02_draws_knife]]
[[ CAMERA: FRAMING=insert | SUBJECT=knife | MOVE=static | TRANSITION=cut ]]
The handle comes away in Isaac's fingers. The blade drops into a wooden bowl with a CLANG. [[beat: s02_knife_breaks]]
{"cue_format": 1,
"scenes": {"scene2": {"before": [{"action": "set_background", "color": "#a9c8e6"}],
"after": []}},
"cues": {"s02_draws_knife": {"scene": "scene2", "steps": [ ... ]},
"s02_knife_breaks": {"scene": "scene2", "steps": [ ... ]},
"s02_short_ceremony": []}}python fountain2pam.py script.fountain --cues cues.json -o script.json # one file
python fountain2pam.py --project projects/abe-isaac # a project's scenes
python fountain2pam.py --project projects/abe-isaac --check # are they up to date?Familiar actions still compile automatically. An element with a cued beat compiles to its cue's steps, copied as they are, so recompiling the Fountain never overwrites hand-authored choreography; an empty cue compiles to nothing (the line is spoken inside another cue). The compiler reports every cue whose beat no longer appears in the screenplay, every beat with no cue, beats that appear twice, notes that are not identifiers, and cues filed under another scene. Without --cues or --project, beat notes are ignored, as they always were, and the output is unchanged.
--project DIR reads DIR/project.json: the screenplay (a copy of the authoritative script, with the commit it was taken from), the cue file, the sidecar, and the scene files, one per scene heading. In project mode the cast and props come from the project (no invented chairs or doors: a line that would need one is left for review), a camera cut is placed where each CAMERA note is, every insert is framed from its subject (fit, above), and each scene starts and ends with the cue file's before and after steps. projects/abe-isaac is laid out this way; its six scene files are compiler output, and the hand-authored Milestone 4 blocking lives in cues/animation_cues.json.
| New syntax | What it does |
|---|---|
[[beat: id]] (Fountain+) |
Names the action paragraph or line of dialogue it is next to (on the same line, or on its own line just before). An identifier is a letter, then letters, digits, _, - or .. |
MARGIN=0.15 in CAMERA (Fountain+) |
The fraction of the frame clear on each side; the shot is framed from its subject's bounding box. |
--cues PATH, --project DIR, --check (fountain2pam.py) |
Compile with a cue file; compile a project's scenes; with --project, write nothing and fail if a scene is out of date or the cue report finds anything. |
Cue file (cue_format: 1) |
cues: {id: [steps]} or {id: {"steps", "scene", "note"}}; scenes: {scene: {"before", "after"}}. |
project.json |
source (a path, or {"file", "copy_of": {"repository", "path", "commit", "sha256"}}), cues, sidecar, scenes. |
"fit": "bounds", "margin" in _shot_meta |
Frame the shot from its subject's bounding box (see "Camera system"). |
"subject": "knife+bowl" |
A fitted shot frames all of them. |
The roadmap's completion test is in tests/test_fountain_cues.py: recompiling the screenplay keeps every cue verbatim and the six scenes write the Milestone 4 ledger byte for byte; on every frame of the scroll, broken-knife and phone inserts the subject is in the frame and its text is readable; and orphaned cues are reported. The reference is section 13 of fountain2pam-manual.md and section 11 of pam-player_manual.md.
Milestone 6 of the Blender roadmap turns the project's scenes into a performance a viewer can follow without the script. Stage 6a does Scenes 1 and 2 of Abraham and Isaac, Revisited, Stage 6b Scenes 3 and 4, and Stage 6c Scenes 5 and 6. Everything is opt-in: a screenplay that uses none of the syntax below plays exactly as before, and the nine golden traces are unchanged.
An action that matters is acted in four phases, anticipation, action, reaction, recovery. The perform action holds the length of each phase, in frames, in one table, and places its steps by phase, so that a phase can be retimed by changing one number:
{"action": "perform", "id": "s02_pull",
"phases": {"anticipation": 6, "action": 30, "reaction": 4, "recovery": 15},
"do": [
{"phase": "anticipation", "action": "morph", "who": "abraham",
"pose": "standing_side", "until": "anticipation"},
{"phase": "action", "action": "pull_immovable", "id": "pull",
"who": "abraham", "target": "isaac",
"frames_reach": "action", "frames_pull": "action", "frames_strain": "action"},
{"phase": "reaction", "action": "slip_on_back", "who": "abraham",
"until": "reaction", "beat": "slip"},
{"phase": "recovery", "action": "wait", "until": "recovery", "beat": "comic_hold"},
{"phase": "recovery", "at": 4, "action": "morph", "who": "isaac",
"pose": "look_down_l", "until": "recovery"}
]}A perform is a timed parallel block (it is expanded into one when the screenplay is loaded), so everything a timed block may hold may be a step of it. Each phase is a beat (s02_pull.anticipation, ...). Changing "action": 30 to 36 makes the pull six frames longer, shared by its three phases in proportion, and moves the fall and the comic hold six frames later; nothing in do changes.
Recurring mannerisms are tics (pam/tics.py), played on the frame clock with react and fragment (see "Tic profiles"). Poses for acting (count_hand, stare_hand, point_up, palms_up, hold_up_r, lift_overhead, sit_write, ...) are built on each figure's own build, so a broad or narrow figure keeps its proportions, and each has a mirror facing left (<name>_left; also standing_side_left).
| New syntax | What it does |
|---|---|
perform |
A timed block placed by acting phase. id, phases ({"anticipation", "action", "reaction", "recovery"}: frames; a phase not given has none), do. |
phase (on a step of a perform) |
The phase the step starts in; at then counts from the start of that phase. |
until (on a step of a perform) |
The step lasts to the end of the named phase, in place of frames. |
"frames_<routine phase>": "<acting phase>" (a routine in a perform) |
That acting phase is shared by every routine phase that names it, in proportion to their defaults ("frames_offer": "anticipation", "frames_accept": "anticipation", "frames_pop": "action"). |
fragment, frames, cycles on react |
One tic, on the frame clock, also in a timed block (cycles: how many times its cycle repeats). |
sound_cue in a timed block |
A word such as THUD! on exact frames: frames (the whole), frames_in, frames_out; with at in a block. New keys everywhere: font_size (default 22), color. |
Acting poses (pam/acting_poses.py) |
Pose names; see section 9 of pam-player_manual.md. |
| Tic fragments | count_tap_r, nod, head_shake, scribble_r, flick_r, finger_wag_r, shrug, startle, chest_pat_r. |
Prop types barbell, magazine |
Two boulders and a log (left and right grips), a composite prop with states assembled and altar (the parts apart: Isaac builds the altar from it); a magazine with cover words, or a pile of them (stack). |
scenes.<scene>.say (cue file) |
Keys that every uncued line of a character gets in that scene, such as {"abraham": {"side": "left"}}. |
A fitted shot (fit, Milestone 5) may now be framed on a character: on the figure as it is drawn, or, before it has faded in, as its next fade_in will draw it.
The completion checks for Stage 6a are in tests/test_performance.py: a phase's frame count changes the timing exactly as it should, and the key pose of each gag of Scenes 1 and 2 is in the trace. Whether a gag is funny is still for someone watching the render.
Stage 6b does Scenes 3 and 4. In Scene 3 Isaac strides up the path with the barbell riding on his shoulders while Abraham staggers after him and stops, bent double, to pant; Isaac bounds over a rock in one leap and Abraham climbs it on his hands and knees; Abraham stands up on top, slips, and Isaac catches him by the collar without putting down the barbell and holds him up in the air through five lines of dialogue. In Scene 4 Isaac drops the barbell, steps to its end and builds the altar beside him, props his phone on a rock, and strikes a heroic pose that Abraham gets wrong; he sits on the altar, Abraham winds the rope round his wrists and yanks the knot tight, and Isaac lies back on his elbows while Abraham fetches the phone. The roadmap's two remaining routines for these scenes are new, and so are mannerisms and poses for them:
| New syntax (Stage 6b) | What it does |
|---|---|
catch_by_collar |
A routine (see "Choreography routines"): phases slip, catch, dangle, set_down; keys joint, target_joint, cycles, lift, pose, release. |
tie_wrist_loop |
A routine: phases approach, wind, knot, yank, let_go; keys cycles, release. |
| A routine's phases given 0 frames | The two Stage 6b routines start every phase from the figures as they are, so a step with only some phases plays just those: catch_by_collar with only set_down puts down a man it left hanging; tie_wrist_loop with only knot and let_go fiddles at the knot. |
| Tic fragments | pant, leg_kick, tremble, bar_bounce, wrist_tug. |
| Acting poses | stagger, catch_breath, climb_reach, crawl_a, crawl_b, proud, topple, dangle, dangle_point_up, hop_crouch, hop_tuck, foot_nudge, crouch_reach_r, crouch_reach_l, sit_side, sit_wrists_out, recline_elbows, recline_point, headline, hero, hero_shade (each with its _left mirror). |
The checks for Stage 6b are in tests/test_performance_6b.py: the two routines at four combinations of character sizes, and the key pose of each gag of Scenes 3 and 4 in the trace (for example, that Isaac moves forward on every frame of his stride while Abraham stops, that Isaac does not move a joint while his father pants, that the hand is on the collar and the feet off the ground on every frame of the dangle, and that the altar is built beside Isaac's feet rather than between them).
Stage 6c does Scenes 5 and 6 and completes the milestone. Scene 5 opens where Scene 4 ends, with Isaac lying back on the altar and Abraham crouched at the rock. The phone slips in Abraham's shaking hands, and his thumb lands on LIVE as he catches it. He props it on the rock and backs away. Isaac points at it with his tied hands and the knot cinches tighter. Abraham faces the phone, raises the knife handle and counts off God's instructions. The satchel slips, the blade clatters across into the log beside Isaac, and nothing moves for more than four seconds: a medium shot on Isaac, the comment IS THAT A REAL KNIFE on the phone, a medium shot on Abraham. He runs out of fingers, looks at the blade, at his son, at the phone, and Isaac asks "And then?" quietly. In Scene 6 Abraham lays the handle down, cannot open the knot with his hands or his teeth, and hugs his son. Isaac flexes, the rope snaps, and they tumble off the front of the altar, Abraham on his back and Isaac on top of him. Isaac recovers the phone, Abraham revises the scroll, and Isaac hoists his father overhead like a championship belt and runs off with him, the scroll trailing behind them, as the frame fades out. The wide shots of Scenes 5 and 6 are framed on the action, so that the phone and the blade read in them as well as in the inserts.
| New syntax (Stage 6c) | What it does |
|---|---|
reach_and_tighten |
A routine: phases reach, cinch, tug, settle; keys target (a figure or a prop), lean, tighten, cycles, pose, release. Isaac points with tied hands and the knot cinches; only he moves. |
altar_tumble_hug |
A routine: phases embrace, flex, close, tumble, land, hold, let_go; key release. One man hugs the other, who is sitting; the seated man flexes, hugs back, and they tumble off the seat, still hugging. Both move. |
hoist_overhead |
A routine: phases grab, lift, carry; keys x, release. One man hoists the other overhead, lying flat, and runs with him. Both move. |
screen_fade |
The whole frame fades to a color, or back: frames (or rt), to (out or in), color; also a step of a timed block. |
bubble_scale on say |
The bubble drawn at that size (text, padding, height above the head, tail); default 1, as before. For shots framed closer than the full width. |
| Tic fragments | fumble_l, count_off_l, gnaw. |
| Acting poses | raise_count, raise_high, back_step, look_down, recline_stare, bite_knot, hold_write, sit_ground, pile_on (each with its _left mirror; pile_on is built on lying_flat_right). |
The checks for Stage 6c are in tests/test_performance_6c.py: the three routines at four combinations of character sizes, and the key pose of each gag of Scenes 5 and 6 in the trace. For example, each scene opens as the one before ends. No joint of either figure moves in the 78 frames between the blade sticking in the log and "And then...". The wrists come together as the knot cinches. Abraham lands on his back with Isaac on top of him, clear of the altar. His back is over Isaac's head on every frame of the carry. Every bubble is inside the frame when it is shown. The props end each scene as the continuity ledger says.
Milestone 7 of the Blender roadmap completes trace version 5, the format pam_trace.py writes for a screenplay that uses the timeline. Nothing in a screenplay changes: there is no new screenplay syntax, a version 4 trace is written byte for byte as before, and the new keys appear only in version 5 traces. The format is documented at the top of pam_trace.py.
What a version 5 trace now also holds:
| Key | What it says |
|---|---|
"events" |
The trace's meaning as one list in frame order: {"frame", "event", "frames"?, ...}. The types are step, sequence, block, beat, routine, constraint (its active interval), shot, camera_cut, camera_move, background, figure_shown, figure_hidden, prop_created (a new prop component), prop_shown, prop_hidden, prop_state_changed, prop_attached, display_changed, text_changed (the words on a surface), line (dialogue), tic, sound and screen_fade (pam_trace.EVENT_TYPES). |
"params" on each item of "blocks" |
The step's own keys, so a tic's fragment, a sound cue's word or a fade's color is in the trace. |
"opacity" |
How opaque a figure (at the top), a prop object or an overlay is, frame by frame, as camera-style moves {"t0", "t1", "f0", "f1", "rate", "from", "to"}. Measured on every frame Manim draws, and written only where it says more than the visibility rows. |
trace_replay.py is a reference reader: it needs neither Manim nor Blender, and given a trace it says where every joint, the camera and every prop is on any frame, what each stateful prop shows, what is on screen and how opaque it is, and which events happen on which frame. python trace_replay.py scene6.trace.json prints the event stream; --frame F prints one frame's events.
To check a replay, run the tracer with the frame probe on:
PAM_TRACE_FRAMES=scene6.frames.json PAM_SCRIPT=scene6.json \
python pam_trace.py scene6.trace.jsonThe probe writes, beside the trace, what Manim drew on every frame; the trace itself is the same with or without it. tests/test_replay.py does this for all six scenes of projects/abe-isaac and holds the replay to trace_replay.TOLERANCES: every joint within 0.002 units on every frame, the camera within 0.002 (cuts included), props within 0.005 (sizes within 2 %, a rope's points within 0.002), opacity within 0.002, and exactly what is on screen, every prop state, display and text, the number of frames, and the frame of every event that shows. The one exception is a known open item: a prop placed while its holder fades in is recorded where it was built for the frames of that play.
Two hooks were added for the event stream, both no-ops without a listener: step (a top-level step is about to run) and shot (a camera marker is applied, with the shot it describes).
Milestone 8 of the Blender roadmap checks that the Blender build reproduces the Manim animation (movement, staging, prop identity and timing) before any embellishment. Nothing in a screenplay changes.
tests/test_blender_parity.py traces the six scenes of projects/abe-isaac, builds each twice with trace2blender.py (with --parity, and as built by default), evaluates the built scenes with bpy on the keyed frames, and compares them with trace_replay.py (which Milestone 7 holds to what Manim drew), within trace2blender.PARITY_TOLERANCES:
| What | Tolerance |
|---|---|
| every joint of every figure on screen | 0.002 units |
| the camera's center and width, cuts included | 0.002 units |
| joints, props and bubbles on the screen (through the Blender camera, against Manim's frame) | 0.5 % of the frame |
| a prop's position; its turn; a scaled prop's size; a rope's points | 0.005 units; 0.1°; 2 %; 0.002 units |
a speech bubble's position (--parity) |
0.005 units |
| the opacity of figures, props, cards and bubbles | 0.002 |
| what is on screen, prop states, phone displays, the scroll's text and strike lines, the background, the number of keyed frames and the film's length, one Blender object per figure and per prop object | exact |
The --parity build is held to all of it. The default build keeps the departures that make it look better, as stated exceptions: Blender's own easing curves may put a joint or a held prop off by 1.5 % of its move (--tol), the narrower male hips are compared by their midpoint (props carried on a hip are not compared), bubbles kept inside the frame are compared for timing and opacity only, and the screen is compared only in level (close) shots. Cards without their backing panel are an appearance choice and are compared for place, timing and fades. The six scenes have no spline locomotion and no props lifted onto the floor (their moves are steps of timed blocks, and their props stand on the floor), and a test checks that.
Building the scenes for the test fixed two things in the builder: a prop held until the end of a scene no longer drifts from the hand over the whole hold (the phone and the scroll in Scene 6), and a camera cut on the first frame of a constrained limb shows the limb's pose after the cut. Speech bubbles' fades (frames_in, frames_out) are now recorded in version 5 traces (each bubble's "opacity") and played in Blender.
Milestone 2 of the Blender roadmap. A parallel block has always played its steps together, all with one run time. Give its steps at and frames and each one starts on its own frame and lasts its own number of frames. Dialogue is one of the things such a block can run, so a line can begin on an exact frame while two actors are moving and the camera cuts.
{"action": "parallel", "id": "s02_overlap", "frames": 84, "do": [
{"action": "sequence", "id": "abraham_arrives", "do": [
{"action": "walk_to", "who": "abraham", "x": 0.8, "frames": 30, "beat": "walk_in"},
{"action": "morph", "who": "abraham", "pose": "look_up_point", "frames": 6},
{"action": "wait", "frames": 12},
{"action": "morph", "who": "abraham", "pose": "reach_forward", "frames": 9}
]},
{"action": "turn", "who": "isaac", "pose": "standing_side", "at": 6, "frames": 9},
{"action": "say", "who": "isaac", "text": "You walked all this way?", "at": 12, "frames": 30},
{"_subscene_marker": "s02_overlap_medium", "at": 30,
"_shot_meta": {"framing": "medium", "subject": "isaac", "move": "static"}},
{"action": "constrain", "id": "grip", "type": "joint_to_joint", "at": 48,
"who": "abraham", "joint": "rwrist",
"target": "isaac", "target_joint": "lwrist", "blend": 4, "frames": 18},
{"action": "wait", "at": 75, "frames": 9, "beat": "comic_hold"}
]}The full scene is abe-isaac_overlap_timeline.json; render it with ./pam-render --script abe-isaac_overlap_timeline.json. The console lists the frames every step ran on.
When is a parallel block timed? When the block has frames, or any step in its do list has at, frames, frames_in or frames_out, is a sequence, or is a camera marker. Every other parallel block plays exactly as before, and so does every say without frames.
| Syntax | Meaning |
|---|---|
"at": n |
The step starts n frames after the block starts (default 0). Only for steps written directly in the block. |
"frames": n on a step |
The step lasts exactly n frames. Without it, the step's seconds key (rt, hold, ...) is used, then the block's rt, then 6 frames (0.4 s). Seconds are rounded to the nearest whole frame, halves up, never less than one frame. |
"frames": n on the block |
The block lasts exactly n frames; what is left after its last step is stillness. Without it the block ends when its last step ends. |
sequence in the block |
A track: its steps follow one another, the first starting on the sequence's at. Use one track per actor. |
"beat": "name" |
Names the frame a step starts on; reported and written to the trace. |
morph, turn, scale, slip_on_back, fade_out |
One move over the step's frames. |
walk_to, run_to, trot_to |
With frames, the whole move takes exactly that long. Without, each keyframe takes 3 frames (rt_per_kf) and the length depends on the distance. |
say |
The bubble fades in, holds, and fades out as three timed pieces. frames is the whole line; frames_in and frames_out are the fades (defaults 6 and 5). With "persist": true there is no fade-out. Human, alien and dog characters. |
wait |
Stillness. With a sound key and no duration it is a sound effect on an exact frame. |
constrain, release |
The contact starts or ends on that frame. |
prop_transition |
A prop changes state on that frame; with frames its move, or a climbing number on its display, takes that long. |
_subscene_marker with _shot_meta |
A camera cut on that frame. With frames (or an animated move: push, pull, pan-follow, drift, zoom) the camera travels for that long. |
A step's sound (and its character's sfx) starts on the frame the step starts, so sound effects stay in step with the movement.
What cannot be a step of a timed block yet: actions that play several animations of their own (wave, nod, shrug, carry, sit_down, stand_up, prop_say, the camera moves pan-up, pan-down, descend, push-into, ...). Put them before or after the block. pam-validate rejects them inside one, and the player skips them with a message. The list of what can run is in pam/action_specs.py; the validator and the player both read it.
Things to know:
- Two steps must not move the same figure on the same frames.
morph,turn,scale,slip_on_back, the walks and runs, and the choreography routines each set the figure's whole pose, so two at once make the figure jump where they meet. The player plays it anyway (the one written later wins on the shared frames);pam-validatereports an error. Put the two in onesequence. A contact constraint may run under any move. - A step owns the frames from its first up to, not including, the one it ends on. A step that starts on the frame another ends does not overlap it.
- A block's
framesis a promise:pam-validatereports an error when the steps need more. The player plays them to the end and says how far it ran over. - A camera cut frames its subject where it is drawn on that frame, also in the middle of a walk, a sliding
morphor a routine. - A bubble shown by
saystays where it appeared. For a character who talks while walking, use"persist": true, as before. - Within one frame the order is fixed: steps that end on it are finished first, then contact constraints put held joints back on their targets, then steps that start on it are started, both in the order they are written. Two renders of the same screenplay are identical frame for frame.
- At medium and high quality (30 and 60 fps) a block takes the same time; each timeline frame is two or four rendered frames.
In the trace (version 5), a timed block is recorded frame by frame, so trace2blender.py reproduces overlapping moves, the frame a line starts on, and the frame the camera cuts on without solving or guessing anything. The trace also gets a blocks list saying which step ran on which frames.
pam-validate --frames lists every duration in a screenplay that is not a whole number of frames at 15 fps, with the value it rounds to. Inside a timed block those are reported as warnings without the flag, since there they really are rounded.
pam-validate checks PAM JSON files in a second or two, without Manim drawing anything:
./pam-validate my_scene.json # or: python pam_validate.py my_scene.json
./pam-validate scene1.json scene2.json --quiet
./pam-validate my_scene.json --strict # warnings also fail
./pam-validate my_scene.json --json # machine-readable report
./pam-validate my_scene.json --frames # also list durations that are not whole frames
./pam-validate --project projects/abe-isaac # every scene of a project, in order (continuity ledger)
./pam-validate my_scene.json --no-ledger # read the continuity ledger, write nothingIt rejects unknown actions, invalid joint names, negative durations, frame counts that are not whole numbers, malformed constraints, choreography routines without their two figures, steps of a timed parallel block that cannot run on the frame clock, prop transitions that cannot happen (an unknown state, a transition the prop's machine does not allow, an attachment to something that is not there), and references to characters or props that do not exist at that step (never defined, defined later, or already removed). It also reports, as warnings, things the player passes over in silence: unresolved # REVIEW and # PATCH comments from fountain2pam.py, and action steps that carry a _comment (the player skips those entirely). The exit status is 0 when every file is valid and 1 otherwise.
The valid action names and the checked keys are listed in pam/action_specs.py. A new handler in pam/actions.py needs no change there; a new action dispatched inline in pam_player.py must be added to PLAYER_ACTIONS, and a test fails until it is.
fountain2pam.py --warnings-json PATH writes the compiler's review comments, validation warnings, and patch-guide hints to one JSON file.
python -m pytest # everything, about two minutes
python -m pytest -k golden # only the golden-trace comparisonThe tests trace nine fixture screenplays with pam_trace.py and compare the result with stored golden traces, so a change to motion, timing, camera, or props shows up without rendering a video, and replay the six project scenes from their traces against what Manim drew on every frame (tests/test_replay.py). See tests/README.md for what is covered and for when and how to record new golden traces.
Set PAM_SCRIPT explicitly:
PAM_SCRIPT=scene.json manim -pql pam_player.py PAMPlayerRun from the repository root or use an absolute path.
Enable camera mode:
PAM_SCRIPT=scene.json PAM_CAMERA_MODE=1 manim -pql pam_player.py PAMPlayerAlso verify that the JSON contains _subscene_marker entries with _shot_meta.
Check:
- Was the Fountain file converted with a recent
fountain2pam.py? - Does the JSON contain
_subscene_markerentries? - Did you render with
PAM_CAMERA_MODE=1? - Is there a blank line between the annotation block and the next character cue?
Keep speakers inside the safe region:
- right-side bubble: speaker around
x <= 4; - left-side bubble: speaker around
x >= -4.
Use camera framing or character repositioning to keep bubbles visible.
Clear bubbles before focus reset:
[
{ "action": "clear_bubble", "who": "bevers" },
{ "action": "focus_reset", "rt": 0.4 }
]Or clear all bubbles:
[
{ "action": "clear_all_bubbles", "rt": 0.2 },
{ "action": "focus_reset", "rt": 0.4 }
]Check:
- the
"faces"block appears beforeattach_face; - the
imagekey matches a loaded face key or expression variant; skinandhairare present in the face spec;- the character exists in the cast registry;
fade_inhas occurred beforeattach_face.
For JSON-built faces, PAM uses a pam_head_ref anchor so tall hair and hats align by the head oval rather than the full bounding box. If a bitmap or SVG face mis-anchors, crop or compose the source image so its center matches the intended head center; bitmap/SVG assets do not have the pam_head_ref metadata.
For a human or alien panel-badge name tag, attach the face first:
[
{ "action": "attach_face", "who": "sidel", "image": "sidel", "scale": 0.35 },
{ "action": "attach_name_tag", "who": "sidel", "text": "CMDR\nSIDEL" }
]For a dog name tag, ensure the dog has a harness style before fade-in.
Check whether the prop was declared with hidden: true. Hidden props are registered but initially transparent; reveal them with spawn_prop or the appropriate prop action.
If it was created under scene_objects, use:
{ "action": "remove_scene_object", "prop": "skyline" }Use remove_prop only for interactive props in the prop registry.
Dog-like figures may be dual-registered as both cast members and props. Use:
whofor character-style actions such astrot_toandreact;propfor prop-style speech or prop-targeting actions such asprop_say.
The canonical registry is authoritative when using fountain2pam.py --characters. Edit tntd_characters.json or your project registry rather than relying on per-scene color overrides that may be overwritten during conversion.
Specify the prop type. A missing type may fall through to a fallback builder.
{ "action": "spawn_prop", "prop": "briefcase_1", "type": "briefcase", "x": 1.0 }Verify that Manim works:
manim --versionVerify that PAM imports in the same environment:
python - <<'PY'
import pam
print(pam)
PYIf using a virtual environment, make sure both Manim and PAM are installed in that environment.
On an Apple-silicon Mac, ImportError: ... symbol not found in flat namespace '_cairo_append_path' means pycairo was built against an Intel (x86_64) cairo from a Homebrew in /usr/local. Install the Apple-silicon Homebrew (it lives in /opt/homebrew), then rebuild the environment against it:
/opt/homebrew/bin/brew install cairo pango pkg-config
export PATH="/opt/homebrew/bin:$PATH"
export PKG_CONFIG_PATH="/opt/homebrew/lib/pkgconfig"
rm -rf .venv && python3 -m venv .venv && source .venv/bin/activate
pip install --no-cache-dir manim==0.20.1Avoid having a conda environment and a venv active at the same time (conda deactivate).
On a Mac, Blender is not on the PATH. Use /Applications/Blender.app/Contents/MacOS/Blender or add the alias shown in Blender export.
If the build step (trace2blender.py) fails, Blender renders the previous .blend. Run the build on its own and check that it ends with wrote ... .blend. After updating PAM, re-run pam_trace.py too: older traces have no speech bubbles or genders.
Headline changes:
- per-character hair geometry overrides:
hair_width,hair_height,hair_offset_y; - triangle and inverted-triangle hats now honor
hat_widthandhat_height; - alien ear and earring anchoring now uses species-correct head radius;
pam/tics.pyaddshand_twitch_l,foot_tap_r, andfoot_tap_l;GovernorGraph.saybubble placement is geometry-aware;prop_saysupportsy_offsetfor Governor vertical bubble nudging;- focus/focus-reset behavior improves face-overlay handling and reduces flicker.
Notable changes:
rotateaction for characters and props;- fixed
wavedirection-key behavior; lying_flat_rightandlying_flat_leftposes;closedparameter onbuild_laptop;paired_poses.pyfor multi-character interaction templates.
nodshake_headshrug
clear_bubbleclear_prop_bubbleclear_all_bubbles- documented focus-reset and bubble lifecycle gotchas.
change_uniform- cast-block
uniformsdictionary for named variants.
- clarified color authority chain;
fountain2pam.py --charactersapplies canonical palettes.
Major action expansion:
grabplace_onmove_asidereach_forpunch_buttonstick_tosnap_photopeel_from_handjump_updodgereactexpresspatsearch_drawerscaptionpersistent_captionsound_cuezone_shiftrush_torush_outexit_through_doors
Recommended documentation set for the repository:
| Document | Scope |
|---|---|
README.md |
Repository front door, quick start, architecture overview |
pam-reference-book.tex and its compiled PDF |
Full reference manual |
pam-player_manual.md |
Running the player, environment variables, the actions it handles, camera metadata, the timeline, stateful props and the continuity ledger |
CHARACTER_PROPERTIES.md |
Character creation fields, actions, faces, wardrobe, styles, tics |
PROP_PROPERTIES.md |
Prop creation fields, metadata, registry behavior, prop actions, prop catalog |
fountain2pam-manual.md |
Fountain+ syntax and conversion workflow |
examples/ |
Working JSON and Fountain+ scenes |
tests/ |
Smoke tests and regression checks |
The README should stay short enough to be useful on GitHub. Detailed tables belong in the reference manual and companion docs.
A useful examples/ directory might contain:
examples/
├── scene_quick_start.json
├── scene_quick_start.fountain
├── camera_demo.fountain
├── face_attachment_demo.json
├── wardrobe_overlay_demo.json
├── prop_interaction_demo.json
├── scene_object_teardown_demo.json
├── parallel_walk_demo.json
├── phone_call_demo.fountain
└── blender_export_demo.json
Each example should ideally include:
- source
.fountain, if applicable; - generated
.json; - generated
_prompts.json, if applicable; - render command;
- short description of the behavior demonstrated.
Animation libraries need both code tests and visual checks.
Useful tests include:
- import tests;
- JSON schema/smoke tests;
- action-dispatch tests;
- prop-builder construction tests;
- Fountain+ parser tests;
- camera-marker generation tests;
- short low-quality render tests;
- character-gallery snapshots;
- face-gallery snapshots;
- prop-gallery snapshots.
Minimal smoke render:
PAM_SCRIPT=examples/scene_quick_start.json manim -ql pam_player.py PAMPlayerPossible next steps:
- normalize action parameter names such as
xvs.to_x; - add a formal JSON schema;
- expand automated tests for
parallel; - improve diagnostics for unknown face keys and missing face specs;
- add visual regression snapshots for face variants and wardrobe overlays;
- add a prop-gallery generator;
- strengthen Fountain+ annotation diagnostics;
- package
pam-renderandfountain2pamas console scripts; - continue the bubble-lifecycle migration so bubbles, focus, overlays, and face attachments have simpler z-order semantics;
- Blender export: props, faces, and wardrobe; turning PAM's 2.5D depth and screen height into real depth; dog foot locking; facing-aware side views.
Useful contributions include:
- a minimal JSON or Fountain+ file that reproduces a bug;
- a before/after render clip;
- a new documented action;
- a new prop builder with attachment metadata;
- a new face style or wardrobe overlay;
- a new character build or pose;
- tests for parser or dispatcher behavior;
- documentation improvements.
When reporting a bug, include:
- PAM version or commit;
- Python version;
- Manim version;
- operating system;
- exact command used;
- relevant JSON or Fountain+ excerpt;
- traceback, if any;
- whether
PAM_CAMERA_MODE=1was enabled; - whether the scene uses faces, wardrobe overlays, or persistent bubbles.
Copyright © David Joyner.
See LICENSE for terms.
PAM is a working artifact of the Too Nice to Die production pipeline and builds on the Manim ecosystem for rendering. The reference manual and companion documents were developed alongside iterative production needs for screenplay-driven animation.