Week 1 - Player Movement


Hello and welcome to my first devlog for this project.

In this devlog, I shall talk about my implementation of movement. This was significantly harder than it probably should have been, as while I understood the basics of how to create car-like movement (I.E, forwards and rotational velocity), what I did not account for was how to actually make the car handle like a car. 

Friction is a very important element of making a moving object feel like it's in contact with the ground, and not floating through space. My initial implementation of movement had no friction, so any speed gained in one direction would stay, meaning trying to turn would just keep you flying in the same direction. 


 My second attempt at creating movement was to apply a constant stopping force to the car in any direction it was going. While a better solution, as your velocity essentially lag behind where you were pointing, it meant that to drive around corners your had to drift. While it might be a good solution for another game, it's not the style of driving a open-wheeled race car would take around a corner.

My final solution involves having a value called "drift angle". This value is how much speed is kept in the original direction compared to the new direction that the car is pointing to. I.E, what percentage of momentum is used to push the car to the side, vs continuing in the new direction.

A visualisation of the forces acted upon the car. The green arrow shows the direction the car wants to go towards, the red arrow shows the direction the car "drifts" outward due to the previous direction the car was travelling in

This allows understeer* to occur, forcing the player to slow down for sharp corners. This system still needs fine tuning, as i think the way the car decelerates still feels unnatural, but it is still a very strong foundation for my game.


*Understeer: the process of a vehicle losing traction at the front, therefore not turning as sharply as it would otherwise.

Files

109GameBuild2.zip Play in browser
51 days ago

Leave a comment

Log in with itch.io to leave a comment.