Rebuilding Procedural Playground by hand

Rebuilding Procedural Playground by hand

A step-by-step rebuild of this project in the Godot 4.7 editor, as a series of posts: mainly the scene with Leela, the robot who walks on physics. It's for someone who knows Godot's basics (nodes, scenes, the Inspector, a little GDScript) and nothing yet about procedural animation.

Every post starts with what you'll have by its end and finishes with a checkpoint. Where a step is easier to watch than to read, a short clip beside it shows it being done in the editor.

The posts

  • What you need, how a step is written, the two habits the posts lean on, and what the clips are.
  • Stage 1The project itself, six settings, the four steering actions, and where Blender is.
  • Stage 2Her .blend file brought in and looked into, and a material for her texture.
  • Stage 3Three two-grey checkers, the level kit's Block, a low sun, and an environment with dusk fog.
  • Stage 4The spring and damper that everything here follows on: the idea, and the script.
  • Stage 5
    The camera 1 clip
    A camera with no perspective, at pixel art's 2:1 angle, following on that spring. The game runs for the first time.
  • Stage 6Three autoloads: PS1 pixels, an outline that draws nothing under this camera, and a TV tube. The camera learns to move by whole pixels.
  • Stage 7A rigid body, a collider, her model, her weight, layers and groups. No script yet, so she sinks to her knees.
  • Stage 8robot.gd: legs as springs, feet that push, the torque that holds her up, and steps by Raibert's rule.
  • Stage 9rig.gd: legs by inverse kinematics, flat feet, an upper body borrowed from the model's clips, and a head on a spring.
  • Stage 10The Parts node that finishes her scene, and robots.gd: steering from the start, Space, and the clicks.
  • Stage 11Stairs, a ramp and steps to walk on, how she gets up them, the jump, the camera's turn and zoom, and what's only named.
  • One setting, and the finished project.
  • What was done in a real editor, what was measured, and what still hasn't been seen.

What you'll build

A project of your own in which:

  • Leela stands on a checkered floor. Her body is a rigid body with real weight. Nothing holds it up but her two legs, which push like springs, and nothing moves it but what her planted feet push.
  • WASD, the arrows or a pad's left stick walk her. Her feet step one at a time, when they're left behind, and land where she's going to be.
  • Her bones follow all that. Her legs bend to reach her feet, her upper body borrows the model's own clips in time with her steps, and her head turns to the mouse.
  • A fixed-angle camera follows her on a spring, and only ever moves by whole pixels of the picture, so nothing shimmers.
  • It looks like the game: two-grey checkers, dusk fog, PS1 pixels and an old TV tube. (The look's outline is set up as well, though under this camera it draws nothing: stage 6 says why.)

What "procedural animation" means

In ordinary animation an animator poses the character at chosen moments, and the engine plays those poses back. The walk is the same whatever's underfoot. In procedural animation, code works the pose out afresh every frame from what's happening: where the ground is, how fast the body's going, where the mouse points. Leela's walk isn't played from a clip. Her feet decide when and where to step, her legs are bent to reach them, and physics carries her body.

What's left out

These are in the repo and work, but the posts only name them, with the file to read (What's only named):

  • George, the second robot, and switching between robots. (He's hidden in the repo's scene too.)
  • Knocking parts off a robot and sending them home, and what she does without them. (Stage 10 adds the node that makes it work, without walking through its scripts.)
  • Chasing the mouse on a spring.
  • The stand-in body that was here before the robots.

Covered briefly, in stage 11: more things to walk on, steps and edges, the jump, and turning and zooming the camera.

Why this order

Each stage ends with something you can see, with one exception (stage 4, which is put to work a stage later). Two choices follow from that:

  • The look's three autoloads come in the middle (stage 6), not last. The camera's pixel snapping only shows once the picture is made of big pixels, and a later script asks for the autoloads by name.
  • Leela's scripts come body first, then bones, then the player's keys (stages 8, 9, 10). Her bones can't move without her body's script. And the script that reads the keys also reads clicks for knocking parts off, which stop the game until her scene is finished. So for two stages you steer her by ticking one box in the running game.

The repository's other notes

README.md is the short description of what's here. AGENTS.md has the whole history: what was tried, what went wrong and why each thing is the way it is. These posts borrow from that history whenever they explain a choice.