1 of 31

Movement

Matthew salmon

2 of 31

(most) games have movement

Whether the game be top down, side scroller, or a 3D experience, many games have movement

It could be controlling a player, a car, or something completely different

We are going to focus on platformer movement today

3 of 31

(most) games have movement

Whether the game be top down, side scroller, or a 3D experience, many games have movement

It could be controlling a player, a car, or something completely different

We are going to focus on platformer movement today

4 of 31

What is a platforming game?

A platforming game typically has a player who can move around a world.

Players can typically move, jump, and perform other moves such as

  • Grappling
  • Dashing
  • Double jumping

This Photo by Unknown Author is licensed under CC BY-SA

Super smash bros, Nintendo™

5 of 31

What is a platforming game?

Why focus on movement?

  • unresponsive controls
  • Imprecise movement
  • Sloppy physics

In games, especially platformers, movement is the core mechanic that players will be using.

Putting work into getting core mechanics to feel good is one of the main features that makes a platformer feel good to play.

A platforming game typically has a player who can move around a world.

Players can typically move, jump, and perform other moves such as

  • Grappling
  • Dashing
  • Double jumping

6 of 31

Movement differs

Fast & snappy

drifty & floaty

7 of 31

Parts of a platformer toolkit

moving

Jumping

There are 2 main parts to a platformer’s movement

8 of 31

Parts of a platformer toolkit

moving

Key elements:

  • Maximum Speed
    • How fast the player can go just by holding the movement input
    • (Player could go faster with other moves)

  • Acceleration
    • How fast the player can get to their maximum speed
    • If the player needs to stop and start a lot, a fast acceleration could be preferred

  • Deceleration
    • How fast the player slows down after releasing the movement input

  • Turning time
    • How quickly the player can swap directions (usually tied to deceleration)

9 of 31

Parts of a platformer toolkit

moving

Key elements:

  • Maximum Speed
    • High
  • Acceleration
    • Slow
  • Deceleration
    • Quick
  • Turning time
    • quick

10 of 31

Parts of a platformer toolkit

Jumping

Key elements:

  • Jump height
    • How high the player jumps

  • Jump speed
    • How fast the player reaches their jump height

  • Gravity
    • How fast the player falls to the ground after they reach the jump height

  • Coyote time
    • How long the player can still jump for after they leave the ground (demonstrated on the next slide)

11 of 31

Parts of a platformer toolkit

Jumping

Key elements:

  • Jump height
    • Medium
  • Jump speed
    • Quick
  • gravity
    • Quick
  • Coyote time
    • 2-3 frames

Coyote time demo

12 of 31

challenge

In groups, come up with:

  • Acceleration
  • Deceleration
  • Top speed
  • Jump height
  • Jump speed
  • Gravity

For the examples following

13 of 31

Challenge 1

Acceleration – Deceleration - Top speed - Jump height – Jump speed - Gravity

14 of 31

Challenge 1 - Solution

Acceleration – fast

Deceleration – fast

Top speed – medium

Jump height – low/med

Jump speed – medium

Gravity – med/high

15 of 31

Challenge 2

Acceleration – Deceleration - Top speed - Jump height – Jump speed - Gravity

16 of 31

Challenge 2 - Solution

Acceleration – slow

Deceleration – slow

Top speed – high

Jump height – high

Jump speed – slow

Gravity – high

17 of 31

Challenge 3

Acceleration – Deceleration - Top speed - Jump height* – Jump speed* - Gravity

18 of 31

Challenge 3 - Solution

Acceleration – Med

Deceleration – fast

Top speed – very high

Jump height – *

Jump speed – *

Gravity – Medium

*jump height and speed depend on the player’s speed in this example

19 of 31

Extra bits

  • Coyote time
  • Instant movement
    • Some games (such as Smash bros) instantly move the character when buttons are pressed, with no acceleration

  • AIR MOVEMENT
    • Air movement typically feels better if the player is slowed down in the air
    • Happens in smash bros, Mario kart, etc.

  • Jump buffering
    • The player can tap jump just before they hit the ground, and the game will jump when they hit the ground

  • Jump Squat
    • A short amount of time after the player presses “jump” before they actually jump

20 of 31

So how do I code it?

There’s a couple ways to code movement, but we will go over a very simple version.

Let’s start with some pseudocode...

21 of 31

So how do I code it?

REPEAT EVERY FRAME:

// get_x_input = value between -1 and 1

horizontal_movement = Get_X_INPUT()

// move side-to-side by this horizontal_movement

X_position = X_position + horizontal_movement

22 of 31

Let’s Try it!

23 of 31

So how do I code it? (Part 2)

REPEAT EVERY FRAME:

// get_x_input = value between -1 and 1

horizontal_movement = Get_X_INPUT()

// move side-to-side by this horizontal_movement

X_position = X_position + horizontal_movement

24 of 31

So how do I code it? (Part 2)

X_velocity = 0

Acceleration = 1 // 1 unit/s^2

REPEAT EVERY FRAME:

// get_x_input = value between -1 and 1

horizontal_movement = Get_X_INPUT()

// move side-to-side by this horizontal_movement

X_position = X_position + horizontal_movement

25 of 31

So how do I code it? (Part 2)

X_velocity = 0

Acceleration = 1 // 1 unit/frame^2

REPEAT EVERY FRAME:

// get_x_input = value between -1 and 1

horizontal_movement = Get_X_INPUT()

// increase x_velocity by acceleration

X_velocity += (horizontal_movement * acceleration)

// move side-to-side by this horizontal_movement

X_position = X_position + horizontal_movement

26 of 31

So how do I code it? (Part 2)

X_velocity = 0

Acceleration = 1 // 1 unit/frame^2

REPEAT EVERY FRAME:

// get_x_input = value between -1 and 1

horizontal_movement = Get_X_INPUT()

// increase x_velocity by acceleration

X_velocity += (horizontal_movement * acceleration)

// move side-to-side by X VELOCITY

X_position += X_VELOCITY

27 of 31

There’s a lot to movement

Even with all the code in the example, it still feels a bit crap

This Is where all the “extra techniques” come into play.

Are there any other features you’d add to make the character feel better?

28 of 31

There is no “right” way to make your movement

It all depends on the player’s experience and what fits best with your game

All the techniques shown here can be used as tools to make player movement feel the best possible

Everything is a tool

29 of 31

that being said, knowing where to start can be quite tricky.

My best advice is to look at games that have similar movement to what you’re aiming for.

I’m stuck?

30 of 31

Another great resource is the app “platformer toolkit

It lets you play around with everything mentioned in these slides, and more (camera movement, polish, etc.)

I’m stuck?

Platformer toolkit on itch.io

31 of 31

Thank you

Any questions?