Sponsored By

Game Feel Tips II: Speed, Gravity, Friction

Stiff movement in your game is a deadly sin, so I provide a few tips to smooth that sucker out and save your soul.

Mark Venturelli, Blogger

August 21, 2014

8 Min Read
Game Developer logo in a gray background | Game Developer

(This is a repost from my personal blog)

Hey internet, There are many things that make me sad. I’m a sensible, empathetic man, so it’s easy to ruin my entire week with a picture of a limping dog or a story about that day when you were a little kid and your balloon went flying away forever into the endless blue sky. But if there’s anything in the world that is capable of moving me into instant tears is stiff movement in your video game.

This happens when a moving thing in your game goes from full stop to full acceleration instantly, and vice-versa. For the purposes of this article, let’s call it “Stiff Nonsense”. This can be anything that receives input from the player to calculate motion, from your camera to your character.

 

stiff01

This seems to be awfully common even in big-name titles, and I’ve heard every explanation and excuse there is. And all of them are: “but my game is special - it requires perfect precision which would be ruined by a speed curve”. Let’s smash this myth to tiny pieces right here: you don’t get a boost in movement precision with Stiff Nonsense. Actually, you can gain an increase of precision if you do it as described in this article. By doing Stiff Nonsense all you get is a game that feels like grinding your teeth with sandpaper.

 

Setup

If you are moving something with direct input from your player, please don’t try any crazy tricks. No dampening or treating it ex post facto or trying to setup a “jumping time” and then adjusting the values. This is the simplest, most effective way of moving a character or a camera:

- Apply a constant Acceleration to your Speed;

- Constantly subtract Friction from that Speed;

- Limit your Speed to a maximum value;

And that’s it. The same goes for jumping, except the acceleration and friction vectors are now vertical.

Finding the Right Values

Usually what you want is something responsive that feels “round” - that is, you just want to get rid of the terrible feel of the Stiff Nonsense, but you want to keep it very responsive and not let it “slide” too much. Sure, in games like Super Meat Boy or Binding of Isaac you would want to slide as it is an integral part of the gameplay. There is no cake recipe for this, but I can share a few quick tips.

The absolute value matters, not just the ratio: a movement with 10 acceleration and 5 friction is completely different from a movement with 100/50, or even 20/10. The higher the scale, the more “violent” the movement. Lower scale values will generally feel softer and slower.

Double or cut it by half: when trying to find the right values, avoid making tiny adjustments at your first few tries. Make huge value changes to experiment and find the boundaries of what you want. Picture it like this: if you were trying to guess a random number between 1 and 100, it would be logical to start with 50 to see if the number is higher or lower, right? And if it’s lower, then you would try 25, etc. The same logic applies to your game’s values.

Intervals are measured in milliseconds: a full second is forever. If your character takes 500ms to accelerate from 0 to full speed, that’s floaty as heck. It’s ok if that’s what you want, but keep in mind that we’re often talking about scales of 50-200ms in ground movement.

Too much friction/gravity will make it feel like a rubber band: as with everything else, you must have a good eye to spot it, but if you want a comparison value I usually apply around 25-30% of the acceleration as friction.

No Transition Animation Required

Unless you’re talking about a game where you slowly accelerate (Sonic, for instance), you don’t need a transition animation. In most of my games I use around 60-100ms from 0 to full speed. For 10fps 2D games, that’s a single frame. It’s 2 frames with 24fps 3D game animation, which is usually the same time that blending would take to interpolate anyway. If you’re using that kind of timing the game will actually look worse if you try to do it. Anything longer than 200ms will probably look cooler with transition animations, though.

Dash, Jump, Knockback, Impacts in general

Exception: when you want something to have impact, you must accelerate instantly. This is actually how you jump: you don’t slowly build up speed, you get a kick from your legs which give you your maximum possible force - from that point on, it’s all gravity taking you to 0 speed (the maximum point of your jump) and then to negative acceleration until you hit the ground.

 

stiff03

The same goes for deceleration. If you want it to feel like an impact, it must come to an instant stop. If your animator can put all that deceleration time in the resulting animation, squashing the object to represent the impact force as it traverses its entire body - that’s a great impact feel right there!

---

So that was it for today. I hope it was useful, keep Stiff Nonsense away from my face and I see you next week =)

 

Game Feel Tips Series

Game Feel Tips I: The Ghost Jump

Game Feel Tips II: Speed, Gravity, Friction

Game Feel Tips III: More On Smooth Movement

Read more about:

Featured Blogs
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like