Movement


Movement

My focus since the start of the dev process has been on the character controller and the movement system that we use. When we started this project one of my two main goals was to have an 2D platformer with a movement system that felt amazing in mobility and in combat. My desire is for the player to have a ton of fun just moving around the map. Some of my main inspirations are Hollow Knight, Ori and the Blind Forest, Dishonored, and Destiny. I know that this list is seemingly disconnected as it has two 2D metroidvania, a 3D RPG with stealth elements, and an FPS MMO, but that's what makes it interesting! What if when you were playing a 2D platformer you had movement that felt as incredible as the movement can be in Destiny or Dishonored (fun and with a learning curve that means that you get better as you play). How would this impact level design? How does it change the way the player interacts with combat?

My initial implementation of the movement system is still a little bare bones, but I think that it is a great foundation for the rest of the game. The character carries momentum when they move, meaning that it can take a little  bit to turn around. This means that originally the platforming could feel a little like you a walking on ice, but we spent some time adjusting the deceleration of the character which has made a huge difference. There is still a "weight" behind the movement, but it doesn't ever feel like it is out of the player's control. Additionally, I noticed that we the character is trying to turn around, but fighting momentum, that it reminded me of skidding on the ground (a character digging in their heels to try to spin as quickly as possible) which gave me the idea that we could use this brief window of time to modify the normal utility of certain character actions! What if when the player attacks while skidding, they immediately lose momentum and perform a spinning attack, changing their direction? What if when the player dodge rolls while skidding they no longer deal with the time to turn around and instead immediately roll in the new direction (what if this dodge was actually faster than the normal dodge!). These are the kinds of interesting and subtle mechanics that I find a lot of joy playing with and so I want to give them to the player.  I think it also starts to give the player a lot of freedom of expression just in the movement of the character.

Initial Movement Showcase

Implementation

At first, I attempted to manually calculate the distance the player should move on each frame, but I ended up finding that if I wanted to make full use of the Rigidbody of the player it was much more convenient to go one integral higher and instead calculate the speed on each frame.

velocity = v0 + acceleration * time
vs
distance = d0 + v0 * time + 1/2 * acceleration^2
time in this instance is Time.deltaTime, or the amount of time between each frame.

 This allows us to just set the velocity on the Rigidbody and allow it to handle the actual movement of the sprite. It also means that we have a direct reference to the player's velocity which we want to manage with a bunch of different movement effects. For instance, we wanted the dodge roll to immediately set the player velocity to a specific value for its duration which was much harder to do when we were manually calculating distance moved.

Refactor

Recently we have been finding it a little difficult to manage the interactions between each of the different movement mechanics or the player state (are they airborne, are they grounded, are they rolling, etc) so we went through a complete restructure of the code. This was an effort lead by Chris who saw a lot of potential in changing our if/else conditional tree that we had in an Update method into a state based design. I'll allow him to speak more to the process he went through, but after getting through the refactor it is now much easier to determine what a player should and should not be able to do at any given time (Can they jump while dodging? Can they airstall if they are airborne, but didn't jump?). The refactor has also made it much easier to integrate with our coming combat system which will be adding a lot of complexity to the player states.


I am so happy with the progress that we've managed to make here and I can't wait to see what our finished product will look like! Look forward to the next update!

Brian

Get After The End

Leave a comment

Log in with itch.io to leave a comment.