top of page

Momentum Systems

Momentum Systems and Dash Fundamentals




10/04/2024


Hey everyone. Today was all about getting my momentum decay working. When building my game, I had issues with the player not maintaing speed in the correct way.

There are 2 main things to I had to consider when building a momentum system. I had to stay true to the vision of a rhythm game that facilitates control and flow, while also creating a network of mechanics that were approcahable and didnt move too fast initially. Early in my development, I gave my project ot a few of my peers, and the major piece of feedback I found was, while mostly fine, the player simply moved too fast for less adept players to manage.

This created an awkward situation wherein I wanted to push the limits of speed to really indulge the fantasy, but also couldnt balance that with necessity for skillfull play. If I made the decay of momentum too lenient, the player never really slowed down and also made the game unapproachable for newer players. While if I made it too fast the player lost speed too quickly and the flow was affected.

The decay at the time worked linearly. Everytime the player wallran, they would instantly gain a burst of momentum and then instantly lose it again at a steady rate. This wasnt adaptable enough of a system. It also happened to feel unfeasable/bad as it gave no breathing room after jumping, just an instant loss of speed.


The solution was to make an exponential decay system that punished the player with more decay over time, while giving them less decay initially. The initial decay equation was simply: y = x^2.5 Where, y is the decay amount per loop and x is a term counter that increases over time. We can think of x as representative of time.


This worked up until I realised that at higher speeds, the decay was still the same amount. In other words, the decay was small initially but increased over time, but worked completely independant of speed. So at a speed of 1 m/s for example, the loss of speed would still be the same as at 100 m/s.

This didnt feel feasable at all, so to correct this I introduced the momentum value as a co-effecient with an exponent tied to it.

This gave me: y = n^1.5(x^2.5)


We can think of n as the speed of the player. What it actually represents is the momentum value of the player, which in my component very closely resembles speed.

What do we end up with?

A system of momentum that acts in a deceleratory way, with greater loss at higher speed.


The finished fucntion is on display ehre if you would like to see it!


It's definietely worth noting that there are alot of arbitrary numbers in here. A few I could probably do without, but they serve to appropriate the values I'm getting out of my function into the ranges I need. It was the shape of the curve I cared most about.


bottom of page