After watching Gustav Dahl’s video about movement and flow in game I noticed how it drew up a speed curve with made it much clearer to me how movement values look.
Because of this I took and drawn a few graphs to show how a simple movement system could work. Both to explain my current mindset when it comes to movement and how different approaches actually looks. These graphs will show how the horizontal speed changes when the dpad is pressed left or right with different approaches.
The easiest way to program movement is to set a fix speed when a button is pushed and due to it’s simplicity it’s the way most people are teacher how to make a movement system.
However this don’t feel that good and not very correct to real life. Try walking and running and then stop. You’ll notice that you don’t start as fast your full speed and you won’t stop immediately, especially if you are trying to run.
The way I usually does it and (I think) most game developers do is accelerate the avatar until the max speed is reached in that direction. Pressing nothing slows you down to zero and pressing the opposite direction will quickly get you into the opposite direction.
This looks indeed much smoother, however one thing I realized yesterday when looking at Gustav Dahl’s video is how the acceleration and deceleration is quite linear. That made my mind think of how more smooth animation would look like and in my mind I got this.
Luckily Unity has support for making curves so I can easily make smoother movement with a class called AnimationCurve. I learned the basics how to work with it today so hopefully I will be able to implement it into a movement system soon and see how it fares.