Skip to content

Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.

fix(video): a front or back walk asks for small, calm steps that never kick out

Soohong Kim6f8c273f0b83
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0cef8c0..1c5d210 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,8 +4,8 @@ All notable public changes to `sprite-gen` are recorded here. Versions track the
## v2.13.0 - A front or back walk walks straight, and a walk loop is cut in seconds
-- A walk seen from the front or from behind, and a run seen from the front, now have their own sentence (`VIEW_MOTION_TEXT` in `sprite_gen/video/batch.py`): the steps lift and land straight forward and back under the body, toward the viewer or away from it "as if on a treadmill", and the body never turns to the side, steps sideways or crosses its feet. The walk sentence every view shared asked for "an even left-right or front-back rhythm", and a character facing the viewer read it as stepping sideways: crossed feet, side kicks, a body turned to three-quarters. A side view and a run seen from behind keep the state's sentence.
-- Measured on Grok (subscription), 480p 3 s, nine humanoid characters twice each, judged on frame sheets with the variant hidden: a front walk kept its facing and walked in 7 of 18 clips with the old sentence and 13 of 18 with the new one (none turned); a front run in 11 of 18 and 15 of 18; a back walk in 8 of 10 with either. "on a treadmill" said as a place was sometimes drawn under the feet; "as if on a treadmill" was not. A walk drawn at a three-quarter angle still turns to a side view in about half the clips with every sentence tried. Method: [docs/video-pipeline.md](docs/video-pipeline.md).
+- A walk seen from the front or from behind, and a run seen from the front, now have their own sentence (`VIEW_MOTION_TEXT` in `sprite_gen/video/batch.py`): the steps lift and land straight forward and back under the body, toward the viewer or away from it "as if on a treadmill", and the body never turns to the side, steps sideways or crosses its feet. A walk also asks for a calm, natural cycle with small, even steps that never kick a leg out to the side. The walk sentence every view shared asked for "an even left-right or front-back rhythm", and a character facing the viewer read it as stepping sideways: crossed feet, side kicks, a body turned to three-quarters. A side view and a run seen from behind keep the state's sentence.
+- Measured on Grok (subscription), 480p 3 s, nine humanoid characters twice each, judged on frame sheets with the variant hidden: a front walk kept its facing and walked in 7 of 18 clips with the old sentence and 16 of 18 with the new one (12 to 13 of 18 without the calm-steps clause, which still crossed its feet or kicked sideways in five); a back walk in 8 of 10 and 10 of 10; a front run in 11 of 18 and 15 of 18. "on a treadmill" said as a place was sometimes drawn under the feet; "as if on a treadmill" was not. A walk drawn at a three-quarter angle still turns to a side view in about half the clips with every sentence tried. Method: [docs/video-pipeline.md](docs/video-pipeline.md).
- `video-loop --anchor motion-auto` finds its two tracking regions with FFT correlations instead of copying the masked patch out once per offset. On three 3 s walk clips at 544 px the region search took 1.0 to 1.4 s of CPU instead of 22.6 to 37.4 s, and full loops from the same frames gave the same cycle and byte-identical strips. Costs agree with the direct form to about 1e-6, so two offsets that tie within that may swap. [docs/loop-review.md](docs/loop-review.md).
## v2.12.1 - The error body is masked as the provider sent it, before it is put on one line
diff --git a/docs/video-pipeline.md b/docs/video-pipeline.md
index b944a37..dc609d6 100644
--- a/docs/video-pipeline.md
+++ b/docs/video-pipeline.md
@@ -85,13 +85,16 @@ quadruped and a legless blob into a contradiction (2026-09-09).
A walk seen from the front or from behind, and a run seen from the front, take their own
sentence (`VIEW_MOTION_TEXT`) instead: the steps lift and land straight forward and back
under the body, toward the viewer or away from it "as if on a treadmill", and the body never
-turns to the side, steps sideways or crosses its feet. The body-neutral walk sentence asks for
-"an even left-right or front-back rhythm", and a character facing the viewer read that as
-stepping sideways: crossed feet, side kicks, a body turned to three-quarters. Measured on
-Grok (subscription), 480p 3 s, nine humanoid characters twice each, judged on frame sheets
-with the variant hidden: a front walk kept its facing and walked in 7 of 18 clips with the
-old sentence and 13 of 18 with the new one (none turned); a front run in 11 of 18 and 15
-of 18. A back walk did as well with either (8 of 10). "on a treadmill" said as a place was
+turns to the side, steps sideways or crosses its feet; a walk also asks for a calm, natural
+cycle with small, even steps that never kick a leg out to the side. The body-neutral walk
+sentence asks for "an even left-right or front-back rhythm", and a character facing the
+viewer read that as stepping sideways: crossed feet, side kicks, a body turned to
+three-quarters. Measured on Grok (subscription), 480p 3 s, nine humanoid characters twice
+each, judged on frame sheets with the variant hidden: a front walk kept its facing and walked
+in 7 of 18 clips with the old sentence and 16 of 18 with the new one. Without the calm-steps
+clause it was 12 to 13 of 18, and five crossed their feet or kicked sideways. A back walk: 8
+of 10 with the old sentence, 10 of 10 with the new one. A front run: 11 of 18 and 15 of 18
+(a run keeps its stride and has no calm-steps clause). "on a treadmill" said as a place was
sometimes drawn under the feet; "as if on a treadmill" was not. A side view and a run seen
from behind keep the state's sentence (the second was not measured). A walk drawn at a
three-quarter angle kept that angle in about half the clips (6 of 10) with the old sentence
diff --git a/sprite_gen/video/batch.py b/sprite_gen/video/batch.py
index 2c68bfe..9011a26 100644
--- a/sprite_gen/video/batch.py
+++ b/sprite_gen/video/batch.py
@@ -95,19 +95,22 @@ MOTION_TEXT = {
# A walk seen from the front or from behind, and a run seen from the front, in place of the body-neutral
# sentences above. Asked for "an even left-right or front-back rhythm", a walk that faces the viewer
# stepped sideways, crossed its feet or turned the body to the side in most of the takes. These say which
-# way the steps go and that the body does not turn; a side view keeps MOTION_TEXT, and so does a run seen
-# from behind, which was not measured. "as if on a treadmill" keeps the treadmill a comparison: said as a
-# place, it was sometimes drawn under the feet.
+# way the steps go and that the body does not turn. A walk also asks for small, calm steps: without them a
+# front walk still crossed its feet or kicked sideways in about a quarter of the takes. A side view keeps
+# MOTION_TEXT, and so does a run seen from behind, which was not measured. "as if on a treadmill" keeps
+# the treadmill a comparison: said as a place, it was sometimes drawn under the feet.
VIEW_MOTION_TEXT = {
("walk", "front"): (
- "walks in place toward the viewer, as if on a treadmill, without coming any closer: a steady walk cycle for "
- "this body type in which every step lifts and lands straight forward and back under the body, with clear "
- "repeating ground contacts. It never turns to the side, never steps sideways and never crosses its feet."
+ "walks in place toward the viewer, as if on a treadmill, without coming any closer: a calm, natural walk cycle "
+ "for this body type with small, even steps, each one lifting and landing straight forward and back under the "
+ "body, with clear repeating ground contacts. It never turns to the side, never steps sideways, never kicks a "
+ "leg out to the side and never crosses its feet."
),
("walk", "back"): (
- "walks in place away from the viewer, as if on a treadmill, without moving any farther away: a steady walk "
- "cycle for this body type in which every step lifts and lands straight forward and back under the body, with "
- "clear repeating ground contacts. It never turns to the side, never steps sideways and never crosses its feet."
+ "walks in place away from the viewer, as if on a treadmill, without moving any farther away: a calm, natural "
+ "walk cycle for this body type with small, even steps, each one lifting and landing straight forward and back "
+ "under the body, with clear repeating ground contacts. It never turns to the side, never steps sideways, never "
+ "kicks a leg out to the side and never crosses its feet."
),
("run", "front"): (
"runs in place toward the viewer, as if on a treadmill, without coming any closer: a fast run cycle for this "
diff --git a/tests/video/test_video_pipeline.py b/tests/video/test_video_pipeline.py
index fe69085..5dcba2b 100644
--- a/tests/video/test_video_pipeline.py
+++ b/tests/video/test_video_pipeline.py
@@ -496,8 +496,10 @@ def test_front_and_back_gaits_say_which_way_the_steps_go() -> None:
p = batch_mod.build_prompt(direction, state, None)
assert p == batch_mod.COMMON_TEXT.format(motion=sentence, view=batch_mod.VIEW_TEXT[direction])
assert f"{opening}, as if on a treadmill" in p
- assert "never turns to the side, never steps sideways and never crosses its feet" in p
+ assert "It never turns to the side, never steps sideways" in p and "never crosses its feet." in p
assert "left-right" not in p and "on a treadmill:" not in p
+ # A walk asks for small, calm steps that do not kick out; a run is fast and keeps its stride.
+ assert ("small, even steps" in p and "never kicks a leg out to the side" in p) == (state == "walk")
# A side view, a run from behind and every other front or back state keep the state's own sentence.
assert batch_mod.MOTION_TEXT["walk"] in batch_mod.build_prompt("side", "walk", None)
assert batch_mod.MOTION_TEXT["run"] in batch_mod.build_prompt("side", "run", None)