Momentum is a fast-paced racing game in a retro 80’s neon style. Move your hovercar around gravity-defying, twisting, and turning racetrack. Use your grapple hook to build up speed, take shortcuts, and other maneuvers. Beat your friends in this co-op racing game all about keeping your momentum.
This game was nominated for Student game of the year in Belgian Game Awards 21 and was a finalist in Grads in Games Student Game Award.
Try out Momentum on the itch.io page.
Features I worked on:
- Vehicle driving and hovering physics and helping with the physics of the hook.
- Input systems.
- Tools to build tracks.
- Player position system.
- Some of the moving and special effect shaders.
Vehicle Physics
The hovering physics of the vehicle is based on Hooke’s law, in this case, 4 different points were selected on the vehicle collider. At each of these points, a spring is attached that is pointed downwards. Whenever it hits the ground the spring starts to be compressed. At some point, a minimal spring distance is reached and the spring starts to decompress. Using a dampening force, the spring compression and decompression are balanced to make the vehicle balance at a set height. To keep the vehicle upright, the center of mass is artificially moved below the actual center of mass, this makes the vehicle work like some sort of pendulum where the bottom of the vehicle is the weight of the pendulum. This automatically fixes the upright direction of the vehicle whenever it is rolling sideways.
The driving physics are created by applying forces to the center of mass of the vehicle, to move forward and backward, the forces are applied in a forward or backward direction. To make the vehicle rotate, a torque is applied to the vehicle that changes the yaw of the vehicle.
When the vehicle speeds up or slows down, the vehicle pitches up or down and when the vehicle turns, it rolls left and right. These physics are faked by turning the vehicle depending on the speed of change. We chose to fake those 2 parts of the physics system as it gives us more control over the vehicle itself and it also makes collisions happen in a more controlled manner. If these physics were simulated without faking, the vehicles would sometimes launch each other when colliding and sometimes hit the track itself.
Track Tools
At first we used the spline mesh tool from Unreal Engine, in this tool it is possible to create a single segment of spline track that influences 1 piece of track, this had a lot of issues as we had to create a new spline mesh for each piece of track and the parts wouldn’t align, on top of that, the splines meshes got completely warped as the evaluation of the spline isn’t linear but can be stretched.
To mitigate all these issues, I created a tool that was based on the default spline tool from Unreal Engine. The spline tool itself could be used to draw the track itself, but another tool was created on top of it to generate a mesh that was aligned to the spline. Here each vertex of the mesh corresponded to a point on the spline that was was at the same distance. This point already contained the up vector and binormal which are necessary to align a vertex and a point to the spline.
Finally, some extra optimizations could be made, when a piece of the track didn’t have a big angle between one piece and the next, the piece could be removed to reduce the number of vertices in the track. The track was also easy to split into pieces as the default spline tool already had the necessary functionality to split splines into 2 or more pieces, this allowed us to not have the highest quality over the whole track when it was not necessary.