22

The single biggest reason AI platformers feel bad is the jump. You get gravity, you get a jump impulse, and it's stiff and unforgiving. The magic is all the invisible assists that pro platformers ship.

My old prompt just said "add jumping with gravity." The result had no coyote time, no jump buffering, and instant max-speed movement, so it felt like driving a fridge. I now enumerate every assist with exact frame/millisecond windows and forbid instant velocity changes. The character finally feels alive.

Posting the prompt in case it saves someone the tuning pain.

THE PROMPT
Build a 2D platformer character controller in a single HTML canvas file, 60fps, no engine. One screen, a few static platforms, a player rectangle. Controls: A/D or arrows to move, Space/W to jump.

Make the jump FEEL good by implementing all of these with the given windows:
1. Coyote time: allow a jump up to 100ms (6 frames) after walking off a ledge.
2. Jump buffering: if Space is pressed up to 120ms before landing, jump immediately on land.
3. Variable jump height: releasing Space early cuts upward velocity by 50% (short hop vs full hop).
4. Asymmetric gravity: rising gravity 2000px/s^2, falling gravity 2600px/s^2 so the arc feels snappy; clamp fall speed at 900px/s.
5. Horizontal accel/decel: reach max run speed (280px/s) over ~90ms, decelerate faster than you accelerate; add a small skid when reversing direction.
6. Apex hang: near the top of the jump (|vy| < 60), reduce gravity 30% for a brief float.
7. Landing squash (0.8 height, 90ms recover) and a small dust puff of 5 particles.

Constraints: fixed-timestep physics with an accumulator, framerate-independent. Expose all tunables as named constants at the top with comments. Do NOT snap velocity instantly on input. Before the code, output a table of every assist and its time window.
asymmetric gravity is the cheat code. felt bad for months until i made falling heavier than rising.vibecoder 1 month ago
2the tunables-as-named-constants-at-top rule saves so much time when you're iterating on feel during a jam. copying that clause into all my game prompts now.hackweek_hugo 1 month ago
add a comment

1 Answer

22

This is the correct list. The one I'd add: a couple frames of input-independent 'jump grace' where you ignore ceiling bonks that only clip the corner, and corner-correction that nudges the player 1-3px sideways so they don't catch on a ledge edge. That corner nudge is invisible but it's why Mario never feels like it 'ate' your jump. I fed it a target of 'never let the player feel like a collision was their fault' and it produced surprisingly good nudge logic.

THE PROMPT
Add corner correction: if the head collides with a platform corner but shifting the player 1-3px horizontally would clear it, apply that shift and keep the upward velocity instead of stopping the jump.

Your Answer