Skip to main content

Coyote Time & Jump Input Buffer Cliff Sandbox

Why do Celeste, Mario, and Hollow Knight let you jump a split second after walking off a cliff? Play this 60fps platformer physics lab to X-ray the hidden Coyote Time air bridge, test +65ms late cliff jumps & -75ms early landing buffers, and run a live 200-trial human-jitter benchmark.

LIVE 60HZ PHYSICS INSPECTOR
coyoteTimerMs
110ms
jumpBufferMs
0ms
Last Trigger
READY
Clear / Fall
0 / 0

200-TRIAL HUMAN JITTER BENCHMARK

💀 Raw 0ms Naive22% (156 eaten)
🏔️ Current Config100% (156 saved)
01

X-Ray Coyote Air Bridge: visualize the exact 110ms (+31px) invisible grace ledge past the cliff edge

02

1-click deterministic proofs: +65ms late off-cliff jump (Coyote) & -75ms early pre-landing press (Jump Buffer)

03

0.35x slow-motion + ghost imprint freezes the exact mid-air takeoff frame & millisecond delta

04

Live 200-trial human jitter benchmark proves Naive 0ms fails >55% while Production clears >95%

Installable Agent Skill · Free

Drop straight into Claude Code, Cursor, or Codex

Paste into your AI agent chat
Read https://gameskill.dev/labs/coyote-time-jump-buffer/skill.md and apply this skill to my game
Go Deeper · Companion GameSkill Pro Kit

Companion pack "2D Combat Feel & Card UX Kit" ships runnable JS/TS + Godot 4 (.gd) + Unity (.cs) source code — unlock all 12 multi-engine Pro packs + 84 commercial WAV SFX + 8 2D VFX shaders from $8.25/mo ($99/yr, save 36%) or $12.9/mo.

Full SKILL.md Specification & Verification Checklist

Coyote Time & Jump Input Buffer (EP32)

Core Problem: Why Raw if (isGrounded && jumpPressed) Feels Broken

When AI coding agents implement platformer jumping naively (if (isGrounded && jumpPressed) vy = JUMP_VEL), players fail 50%+ of fast cliff jumps:

  1. Late cliff press (+20ms to +100ms after leaving edge): Visually the character's toes just left the cliff, so the player expects a jump — raw isGrounded is already false, eating the input and dropping the player straight into the chasm.
  2. Early landing press (-20ms to -110ms before touchdown): Players instinctively tap Jump a few frames before their feet touch the ground for continuous platforming flow — raw code discards the tap, forcing an awkward flat run off the next ledge.

4 Production Rules (Ship-Ready Platformer Feel)

  1. Rule 01 — Coyote Time Timer (coyoteWindowMs = 85..145ms, Celeste default 110ms):
    • While grounded === true, reset coyoteTimerMs = coyoteWindowMs and hasJumpedThisAirborne = false.
    • Once airborne without jumping, count down coyoteTimerMs -= dtMs.
    • Allow jumping whenever (grounded || coyoteTimerMs > 0) && !hasJumpedThisAirborne, immediately resetting vy = JUMP_VEL (clearing any downward fall velocity!) and setting coyoteTimerMs = 0 so players can never double-jump inside the grace window.
  2. Rule 02 — Jump Input Buffer (jumpBufferMs = 100..150ms, Celeste default 120ms):
    • On every Jump button press, set jumpBufferTimerMs = jumpBufferMs, then count down jumpBufferTimerMs -= dtMs each tick.
    • Whenever (grounded || coyoteTimerMs > 0) && jumpBufferTimerMs > 0, fire the jump immediately on frame 1 of touchdown and clear both timers (jumpBufferTimerMs = 0, coyoteTimerMs = 0).
  3. Rule 03 — Asymmetric Gravity + Variable Jump Cut (vy *= 0.48):
    • Apply heavier gravity on descent (gravityFall ≈ 1.2× gravityRise) so jumps feel crisp instead of floaty.
    • On early button release while rising (vy < -140), scale vy *= 0.48 for surgical short-hop control.
  4. Rule 04 — Ledge Edge Nudge (6..12px):
    • If the player's feet graze within edgeNudgePx below a far platform's top lip while moving horizontally toward it, smoothly snap/mantle them up onto the top surface instead of bonking their shins into the abyss.

Minimal Engine Reference (Godot 4 / Unity C# / TypeScript)

// Fixed-timestep 60Hz update
if (grounded) {
  coyoteTimerMs = COYOTE_WINDOW_MS; // 110ms
  hasJumped = false;
} else {
  coyoteTimerMs = Math.max(0, coyoteTimerMs - dtMs);
}

if (jumpJustPressed) {
  jumpBufferTimerMs = JUMP_BUFFER_MS; // 120ms
} else {
  jumpBufferTimerMs = Math.max(0, jumpBufferTimerMs - dtMs);
}

if (jumpBufferTimerMs > 0 && coyoteTimerMs > 0 && !hasJumped) {
  vy = JUMP_VELOCITY; // Reset downward velocity cleanly!
  coyoteTimerMs = 0;
  jumpBufferTimerMs = 0;
  hasJumped = true;
}

if (jumpJustReleased && vy < -140) {
  vy *= 0.48; // Variable jump height cut
}

Verification Checklist

  • Pressing Jump +65ms after walking off a cliff clears the chasm with coyoteWindowMs = 110ms and falls with 0ms.
  • Pressing Jump -75ms before touching ground triggers a frame-1 bounce jump with jumpBufferMs = 120ms and is eaten with 0ms.
  • Triggering a Coyote Jump zeroes coyoteTimerMs immediately so no accidental double-jump occurs.
  • Across a 200-trial human-jitter test (-55ms..+105ms), Production config clears >= 90% vs < 50% for naive 0ms checks.

ENGINEERING BREAKDOWN & BENCHMARK

Why Naive AI Implementations Fail (Measured Benchmark)

Naive platformer code (`if is_on_floor() and jump_pressed`) rejects every input that arrives +20ms after walking off a cliff or -40ms before touchdown. In our 200-trial human-jitter simulation, raw `isGrounded` drops players into the chasm 78% of the time, whereas a 110ms Coyote window plus 120ms Jump Buffer recovers 156/156 mistimed inputs without feeling floaty.

200-trial cliff jitter benchmark: 0ms Naive = 22% clear rate vs 110ms Coyote + 120ms Buffer = 100% clear rate (+156 saved jumps).

PRODUCTION CODE · GODOT 4 · UNITY C# · TYPESCRIPT

Reference Implementation in Godot 4, Unity C#, and TypeScript

Godot 4 (GDScript)

player_coyote_jump.gd
extends CharacterBody2D

@export var jump_velocity: float = -420.0
@export var gravity: float = 1280.0
@export var coyote_time: float = 0.11       # 110ms post-ledge grace
@export var jump_buffer_time: float = 0.12  # 120ms pre-landing queue

var _coyote_timer: float = 0.0
var _jump_buffer_timer: float = 0.0

func _physics_process(delta: float) -> void:
	if is_on_floor():
		_coyote_timer = coyote_time
	else:
		_coyote_timer = maxf(0.0, _coyote_timer - delta)
		velocity.y += gravity * delta

	if Input.is_action_just_pressed("jump"):
		_jump_buffer_timer = jump_buffer_time
	else:
		_jump_buffer_timer = maxf(0.0, _jump_buffer_timer - delta)

	# Fire jump when BOTH a valid floor/coyote grace and buffered press overlap
	if _jump_buffer_timer > 0.0 and _coyote_timer > 0.0:
		velocity.y = jump_velocity
		_coyote_timer = 0.0
		_jump_buffer_timer = 0.0

	# Variable jump height cut when player releases early
	if Input.is_action_just_released("jump") and velocity.y < 0.0:
		velocity.y *= 0.45

	move_and_slide()

Unity (C#)

CoyoteJumpController.cs
using UnityEngine;

public class CoyoteJumpController : MonoBehaviour
{
    [SerializeField] private Rigidbody2D rb;
    [SerializeField] private float jumpVelocity = 14f;
    [SerializeField] private float coyoteTime = 0.11f;
    [SerializeField] private float jumpBufferTime = 0.12f;

    private float _coyoteCounter;
    private float _jumpBufferCounter;
    public bool IsGrounded { get; set; }

    private void Update()
    {
        _coyoteCounter = IsGrounded ? coyoteTime : Mathf.Max(0f, _coyoteCounter - Time.deltaTime);

        if (Input.GetButtonDown("Jump"))
            _jumpBufferCounter = jumpBufferTime;
        else
            _jumpBufferCounter = Mathf.Max(0f, _jumpBufferCounter - Time.deltaTime);

        if (_jumpBufferCounter > 0f && _coyoteCounter > 0f)
        {
            rb.linearVelocity = new Vector2(rb.linearVelocity.x, jumpVelocity);
            _coyoteCounter = 0f;
            _jumpBufferCounter = 0f;
        }

        if (Input.GetButtonUp("Jump") && rb.linearVelocity.y > 0f)
            rb.linearVelocity = new Vector2(rb.linearVelocity.x, rb.linearVelocity.y * 0.45f);
    }
}

TypeScript (Web / Phaser)

coyote-jump-step.ts
export interface JumpState {
  vy: number;
  grounded: boolean;
  coyoteMs: number;
  bufferMs: number;
}

export function stepCoyoteJump(
  state: JumpState,
  dtMs: number,
  jumpJustPressed: boolean,
  jumpJustReleased: boolean,
  cfg = { coyoteWindowMs: 110, bufferWindowMs: 120, jumpVel: -460 }
): boolean {
  state.coyoteMs = state.grounded ? cfg.coyoteWindowMs : Math.max(0, state.coyoteMs - dtMs);
  state.bufferMs = jumpJustPressed ? cfg.bufferWindowMs : Math.max(0, state.bufferMs - dtMs);

  let jumped = false;
  if (state.bufferMs > 0 && state.coyoteMs > 0) {
    state.vy = cfg.jumpVel;
    state.coyoteMs = 0;
    state.bufferMs = 0;
    jumped = true;
  }
  if (jumpJustReleased && state.vy < 0) state.vy *= 0.45;
  return jumped;
}

DEVELOPER FAQ

Tuning, Edge Cases & Engine Integration FAQ

What is the ideal Coyote Time duration in milliseconds for 2D platformers?

Most acclaimed 2D platformers tune Coyote Time between 85ms and 130ms (5 to 8 frames at 60fps). Celeste uses ~100–110ms. Below 60ms feels harsh; above 160ms starts looking visibly like an air-walk exploit.

How do Coyote Time and Jump Input Buffer prevent double-jumping bugs?

Always zero out both `_coyote_timer = 0` and `_jump_buffer_timer = 0` immediately on takeoff, and never refill `_coyote_timer` until the physics engine confirms `is_on_floor()` after landing.

Should Coyote Time run in `_physics_process` or `_process` in Godot 4?

Run physics timers in `_physics_process(delta)` for deterministic 60Hz behavior, or capture `Input.is_action_just_pressed("jump")` in `_input` to stamp `_jump_buffer_timer` so ultra-fast taps between physics ticks are never dropped.

Can I teach Claude Code or Cursor to implement this automatically?

Yes. Paste the one-line `/labs/coyote-time-jump-buffer/skill.md` prompt above into Claude Code, Cursor, or Codex—it enforces the exact timers, variable jump cut, and verification checklist.

Related Engine Hubs, Guides & Production Kits

More interactive labs in this track

Extracted from a real game · Zhaoshi Wulin

Every formula in these labs ships inside our upcoming Steam wuxia deckbuilder

3 martial-arts characters, 39 enemies, 70 relics, 19 kungfu finishers built in Godot with AI agents. Every time we solve a hard design or feel problem, we turn it into an interactive lab and skill here.