This post comes to you from the team’s lead programmer, Connor! He is going to give us an awesome look at some of the mechanics he’s worked on!
Hey everyone! I’m Connor Davis, the Programming Lead at BA2, and I’m here to talk a bit about what I’ve been working on for our game, Shepherd’s Sky. As the Programming Lead, I work on a lot of things for the game, but today I’m just going to focus on movement.
Movement in Shepherd’s Sky
There are three main things that control movement in Shepherd’s Sky. These are the shepherd, the balloon, and the camera.
The shepherd controls movement forwards/backwards, the balloon controls the movement up/down, and the camera is controlling what direction the farmer is facing as well as helping the balloon know when it should be moving up/down.
As I mentioned before, the shepherd controls forward and backwards movement.
This is the code that does that. All it’s really saying is if the player pushes forwards/backwards on the left stick, change the velocity of the shepherd to reflect that. That is literally all the code for moving forwards/backwards. The rest of that code is tilting the shepherd if the player is turning, and activating/deactivating different particle effects like speed lines for when the shepherd is going its top speed.
This is the code that controls the balloons up and down movement. All it does is check the angles of our camera, and then determines whether it should be moving up, down, or neither. Essentially, if the camera is pointed up, we move up, if it is pointed down, we move down. There is also some math being done to determine how fast the balloon should be moving. For instance, if the camera is only pointed slightly up, the balloon will rise slower than if it were pointed almost directly up.
The camera has quite a bit of code determining how it moves around, but we’re just going to focus on how it affects movement directly. This is done in a single line of code.
All this line does is make the shepherd face the same direction the camera is facing. If you are familiar with Linear Algebra or Unity, you may notice that I am not taking into account the y-value of the camera’s forward direction. This is because, for now, we want the shepherd’s model to always be roughly parallel to the ground, so we just ignore the y-value of the camera’s direction.
All Working Together
Here is a video of all these parts working together.
Thanks for checking out our DevBlogs. See you next time.
Thanks for reading through our developer blog posts! Be sure to check back in the coming weeks for even more content from the awesome people working on this game!