2D Platformer game feel tips


Here are some tips to make your 2d platformer feel good.

Lets start from scratch

We have a square which can move on both side at a constant velocity and jumps up to a constant height.

Image

Fixing the basic movement

So lets change the move script so that the char accelerates to a max speed and when stopping decelerates.

These values can be played around with to get different experiences.(acceleration, deceleration, top speed) For example, if the deceleration is too slow it feels like the char is on ice.

Image

Next up is fixing the jump

Jumping is the core mechanic of all platformer games. Every game has a different jump.

But the basic variables are

jump height and jump duration (hang time)

These can be controlled by the jump velocity and the gravity/ here fall multiplier. Here fall multiplier increases the players gravity by that amount while falling down.

Also we need a variable jump. So that character jump height depends on how long the button is pressed.

Image

Okay now that the controller basic ones are done its, we can work more on the jump.


Jump input buffering

If the player presses the jump button, before actually landing. And the then the char just lands and does nothing. This feels like its the games fault and make the game feel un-resonsive. So The goal is to allow the player to input the jump button and still have a successful jump even if they mistimed their input by a tiny amount. Thus is done by giveing the player a few grace frames before landing. When they can press jump and the char will still jump after landing. So if they input jump within these frames, the char will jump afrte landing.

Image

Coyote jump/ Ledge Forgiveness

This one is important and makes a huge difference, it makes jumping over platforms much more smoother. Basically we give some grace frames after falling off the platform, during which the player can still jump.

These two tricks can make the game feel much better, but its also important to not go overboard with them and baby the player. You need to find the right balance for you platformer.

Image

Corner correction

Its pretty annoying when player tries to jump over a block but hits the corner and falls down. To fix this we basically just push the player away from the block.

Image

Corner correction was the thing that annoyed me the most. I was trying to find a good way to implement this in unity.

I ended up using raycacsts on the player and the platform to find the lenght of the corner the player is hitting and just move the player by that much. I'm sure there are better ways to this but this is working so I'm happy.

Image

There are more specific things that can be done depending on the game's mechanics like the dash in celeste. But I wanted to test out my new and improved char controller. So I made a test level. And Filled it up with

  • Ladders.
  • Soft platforms.
  • Moving platforms.
  • One way platforms.
  • And bouncy platforms.

And just kinda jumped around.

Image

And it was surprisingly kinda fun!

Its cool how fun it was without any story or specific mechanics.

Here's is the project file with the basic of the above implemented, check it out on Github.