AI Game Dev

Jump buffering: when an early jump should still count

In our Phaser platformer, pressing jump just before landing spent the double jump. Claude Code made the press wait for the ground. Play both versions and see what we measured.

Tested with Phaser 3.80.1 · Claude Code 2.1.311

A frame from the platformer. The orange square is rising just above the floor, 0.12 seconds after landing, on a jump that was pressed before it touched down. Five platforms with yellow coins sit above it.

Before you start

  • The platformer from the double jump tutorial, or any Phaser platformer of your own.
  • Claude Code, started in the game's folder.
  • The skill at the end of this page, in the folder's .claude/skills/platformer-feel/. Then type the prompt below.
What we asked“When I press jump just before landing, nothing happens. Make the jump still count if I press it a moment early. Test it.”

What happened

You
When I press jump just before landing, nothing happens. Make the jump still count if I press it a moment early. Test it.
  • Used the platformer-feel skill
  • Read the skill's notes on jump buffering and testing
  • Read index.html
  • Added a read-only test hook to the page
  • Wrote a test outside the project that steps the game frame by frame
  • Ran it at 60, 144 and 30 fps
  • Found it: a press 0.08 s before landing used up the air jump
  • Changed the buffer to a countdown in seconds, and made an early press wait for the ground when landing is less than 0.11 s away
Claude
Now updating the test to also check that normal mid-air double jumps still fire instantly, and to run with the buffer turned off.
  • Buffer off: every 0.08 s press fails
  • Buffer on: 0.08 s presses jump on landing, 0.30 s presses don't
  • Air jump near the top of a jump still fires on the next frame
  • Ran it at 60, 144 and 30 fps: no console errors
Claude
Pressing jump a moment before landing now gives you a ground jump. I tested it by stepping the real game frame by frame in a headless browser at 30, 60 and 144 fps, with no console errors. Why your jump was lost: the game already remembered early presses, but only after your double jump was used up. If you still had the air jump, a press just before landing was spent on the air jump, so the ground jump you meant never came. There was a smaller bug too: early presses were remembered for about one frame less than the setting, and setting the buffer to 0 broke jumping entirely. What I changed: when you press jump in the air, the game works out how long until you land on the platform below. If that's within the buffer time, the press is saved for the landing instead of using your air jump. Otherwise the air jump fires immediately, as before. The remembered press now counts down by each frame's time, so it lasts the full 0.11 s at any frame rate. JUMP_BUFFER = 0.11 and COYOTE_TIME = 0.09 are the same values as before, converted from milliseconds to seconds. Test results: a press 0.08 s early now jumps on landing, with or without the air jump left (a tap gives a short hop of 21 px, a held key 79–93 px). A press 0.30 s early uses the air jump right away, or does nothing if it's already used. A normal double jump near the top of a jump still fires on the very next frame. With JUMP_BUFFER = 0, all four 0.08 s presses fail, so the test does catch the problem. If the buffer still feels tight, try values up to 0.15. I added window.__test and window.__game to the page so the test can drive it. They show nothing on screen.

Jump buffering means the game remembers a jump you press a little too early. If you land soon after the press, the jump happens the moment you touch down.

To see it, bounce the square below and press again just before it lands, once with buffering on and once with it off.

An explainer we built for this page. It uses the real game's gravity, jump speed and 0.11 s buffer. The two games further down are the real ones from the Claude Code session.

The platformer from the double jump tutorial already remembered early presses for 0.11 s, but only after the double jump was used. While the air jump was still unused, an early press went to the air jump: the square got a small boost in the air and then landed without jumping. We asked Claude Code, with the platformer-feel skill, to fix that, and now the press waits for the ground.

To feel the difference, jump once and press jump again just as you come down onto the floor. Don’t double jump first.

Before: the game as it was. The late press fires the air jump, and you land without jumping.

After: Claude's version. The same press waits, and you jump again as soon as you land. For both games we only added the start screen and loaded Phaser from this site.

We measured both versions ourselves with Playwright in headless Chrome. The square drops onto the floor and we press jump a set time before it lands. We stepped the game with a fixed frame time so each press lands at an exact moment, and got the same results at 30, 60 and 144 fps.

PressAir jumpBeforeAfter
0.08 s earlyunusedAir jump fires, no jump on landingJumps on landing
0.30 s earlyunusedAir jump firesAir jump fires
0.08 s earlyusedJumps on landingJumps on landing
0.30 s earlyusedNothingNothing

At 30 fps the nearest frame put the 0.08 s press at 0.067 s. We also ran onto a raised platform and pressed early. The old game spent the air jump and carried the square past the platform to the floor, while the new one jumped from the platform. If you press while drifting off a platform’s edge, the new game first expects you to land on it, so the air jump fires about 0.03 s later than usual.

Claude kept the buffer at JUMP_BUFFER = 0.11 seconds, the game’s old 110 ms written in seconds. The skill’s default is 0.12, with a good range of 0.08 to 0.15. The skill also asks Claude to decide what an early press does when an air jump is left, and suggests letting the air jump take it. Claude went the other way because that was the complaint: if you will land within 0.11 s, the press is saved for the ground, and earlier presses still use the air jump.

Get the skill. It also covers coyote time and variable jump height.

Recorded with a clean Claude Code: no personal skills, plugins or MCP servers, just the skill on this page.

The skill that made it work

It tells Claude to check the double jump rule and to test the buffer with scripted presses, once with it on and once with it off.

platformer-feel
  1. Keep every movement number as a named constant at the top of the player code, in seconds and pixels per second (not frames), so the user can tune them.
  2. Add the three core helpers unless the user says not to: coyote time (a short moment to still jump after running off a ledge), jump buffering (a jump pressed just before landing still happens on landing) and variable jump height (tap for a small hop, hold for a full jump). Read each helper's reference file before you build it.
  3. Test with scripted input, not by reading the code. Each helper needs one test that fails without it and passes with it.
  4. When you finish, list each helper with its number and what the test showed, in plain words.

Save it as .claude/skills/platformer-feel/SKILL.md in your project.

Was this useful?