Platformer movement feel (coyote time, jump buffering, wall jumps)
platformerphysicsgame-feelcoyote-timejump-bufferflame
How a 2D platformer character should move so that it feels responsive and fair. Most of "game feel" in a precision platformer comes from a handful of small forgiveness rules and well-chosen constants, not from a physics engine. These were researched and tuned for Run, Justin's Flutter/Flame speedrun platformer.
Use custom kinematic physics, not a rigid-body engine
- Rigid-body engines (Box2D, Forge2D) simulate physically accurate bodies; platformer characters need
exaggerated, hand-tuned motion. Run explicitly rejected Forge2D in favor of custom AABB
physics in a pure-Dart
MovementSystemwith no engine dependencies, so it is unit-testable. - Keep the movement math free of engine types; the engine component just calls into it.
Baseline constants (pixels, 32 px tiles, tune from here)
| Constant | Value |
|---|---|
| maxRunSpeed | 400 px/s |
| runAcceleration | 3000 px/s^2 |
| runDecel | 2000 px/s^2 |
| airAccel | 1800 px/s^2 |
| jumpVelocity | -720 px/s |
| gravity | 2200 px/s^2 |
| terminalVelocity | 1200 px/s |
Acceleration should be a quick initial response that tapers toward max speed (neither linear nor purely exponential).
The forgiveness rules
- Coyote time: the player can still jump for 100-150 ms (6-8 frames at 60 fps) after walking off a ledge. Run uses 0.116 s. Do not exceed ~150 ms or jumps feel delayed.
- Jump buffering: a jump pressed up to ~100-150 ms before landing fires on landing. Run uses 0.116 s as well.
- Variable jump height: cut upward velocity when the button is released. Essential on touch screens.
- Asymmetric gravity: 2-3x gravity while falling vs rising makes jumps snappy.
- Air control: strong air acceleration for mid-jump correction (matters more on mobile).
- Corner correction (Celeste): nudge the player past a barely clipped corner instead of stopping them dead.
- Hitboxes: shrink the player's hazard hitbox to ~70-80% of the sprite, grow pickup hitboxes to ~120%, but keep platform collision exact (forgiving platform edges feel floaty).
- Touch input adds ~30-50 ms of latency on its own; with 116 ms coyote + 116 ms buffer the total forgiveness (~160-180 ms) is fine for mobile, so do not add extra coyote time there.
Dash and wall jump
- Dash: ~0.15 s, 8-directional, ~0.8 s cooldown, no gravity, brief i-frames; resets only on landing (not on wall touch).
- Wall jump lessons from Run:
- Requiring the player to hold into the wall (or blocking jumps while pressing away) made wall jumps fail constantly. Allow the kick regardless of stick direction; only wall slide needs "holding into the wall".
- Check
coyoteTimer <= 0before a wall jump, or coyote time steals it as a ground jump. - Kick: 350 px/s horizontal with a 125 ms input lock (250 ms felt too long).
- Use three sensors: a solid body hitbox, a ground sensor ~2 px below the feet, and a wall sensor ~2 px beside the body.
Camera
- Look-ahead in the movement direction, growing with speed (Run:
velocity.x * 0.08, research suggests* 0.12at sprint). Lerp the look-ahead (Run: rate3.0 * dt, ~0.3 s ramp); an instant look-ahead jitters on quick left/right changes. - Horizontal follow fast (lerp factor ~20), vertical slow (~6). Do not track jumps vertically in real time; re-baseline when the player lands. Clamp to level bounds.
- More in Platformer camera, viewport size, and aspect ratios.
Other tunings for comparison
Two other projects landed on similar rules with different numbers:
- Fall (Godot 4, endless descent, 1920x1080): jump velocity -850, coyote 0.08 s,
buffer 0.1 s, variable height via 2x gravity while the button is held on the upswing and a
5x cut on release. Gravity 680 normal, 340 gliding, 1360 diving; terminal velocity 800
(960 while diving). Horizontal accel 2000, decel 800 px/s^2 for a deliberately floaty,
leaf-like feel (decel 1600 felt too tight, 400 too slippery). Glide actively decelerates
to 30% of terminal velocity at 600 px/s^2 rather than just lowering gravity.
- Fight (Godot 4.4 side-scroller shooter, 1280x720, gravity 980): speed 300, jump -520,
air speed 85% of ground, coyote 0.12 s, buffer 0.1 s, one double jump, dash 600 px/s for
0.15 s with a 0.8 s cooldown and invincibility.
- Clear the jump buffer when unpausing. In Fall, pressing A to pick "Resume" was still
buffered and caused a jump; zero the buffer in NOTIFICATION_UNPAUSED (pausable nodes
do receive it).
- Use separate actions for jump and glide (one key for both was confusing) and a dedicated
jump action instead of the built-in ui_up, so it can be remapped.
- Thick platforms beat clever collision margins: Fall's 16 to 30 px branches let a player
falling at 800 px/s clip through; 40 to 60 px fixed it, with a 24 px one-way collision
margin (48 px blocked sideways movement).
Gotchas
- Never write physics in "per frame" units (
delta * 60, cooldowns in frame counts). It silently changes behavior off 60 fps. See Fixed-timestep game loop for browser games. - Fast movement through thin platforms is a separate problem: Collision tunneling (fast objects passing through walls).
See also
- Speedrun platformer level design
- Game juice and polish techniques
- Touch controls for mobile action and platformer games
- Sonic-style loop-the-loop physics
- Godot 4 and GDScript gotchas (2D)
Linked from
- Collision tunneling (fast objects passing through walls)
- Fixed-timestep game loop for browser games
- Game juice and polish techniques
- Game juice checklist (feedback layers that make a game feel good)
- Godot 4 and GDScript gotchas (2D)
- Platformer camera, viewport size, and aspect ratios
- Run (runrunrunrun.run), Justin's speedrun platformer
- Sonic-style loop-the-loop physics
- Speedrun platformer level design
- Touch controls for mobile action and platformer games