Interstellar Racing League

Overview

Interstellar Racing League is a high-speed, 4 player racing experience. Players are racing along gravity-defying tracks through alien planets to compete for the title of the Galaxy’s Best Racer. The project has 56 team members, 15 of which are programmers. I worked on creating the physics model for the vehicle and providing interface support for other teams to access vehicle's attributes.

  • Role: Vehicle/Gameplay Programmer

  • Genre: Arcade Racing

  • Dev Time: 16 Weeks

  • Dev Tool: Unreal Engine 4.17

  • Team Size: 56 (15 programmers)

  • Download: PC(Windows)

 

Vehicle Model Prototype

IRL_FirstAp_Structure_edited.png
IRL_FirstApproach.png

The first version of the physics model was inspired by a tutorial video created by Space Dust Racing UE4 Arcade Vehicle Physics Tour, in which it introduced the implementation of a basic 4-point hover car physics. In the first approach, I

  • Disable the built-in gravity, and always apply a force downwards to the ground to make the car running on the multi-axis track

  • Put four hover force components at each corner of the bottom of the car to simulate the hovering feel

  • Disable built-in linear damping in Unreal and use customized 3-axis linear damping

  • Move the center of mass (COM) of the vehicle below the actual model to make it behave like a tumbler so that prevents the car from flipping over

However, our team had a hard time making the experience feel smooth while driving on multi-axis tracks. I decided to research an upgraded model to provide the better game feel and, in the meantime, fulfill the following requirements:

  • Be able to drive with high speed on multi-axis tracks such as loops, cliffs, and U-turns

  • Make sure the vehicle won't fall off the track and won't flip over on the track

  • Be able to limit the bounciness while hovering on the track

  • Vehicle attributes can be adjusted conveniently by game designers

  • Allow team members to work parallelly

 

Vehicle Model 2.0

IRL_1P1F_Structure.png

The new version only applies a combined force at a single point on the vehicle, so it's called 1-point-1-force vehicle model. The benefit of using a single point model is that it provides a very intuitive way for us to understand how different forces influence the car. As you might know from the physics class, the easiest way to analyze the resultant force on one object is to destruct them on its center of mass (COM).

Also, our team refactored the vehicle blueprint to a component-based architecture, including the suspension component, the stability component, the collision component, and input control component.

 

Surface Detection Phase

  • Raycast downwards the track, and stores the hit result for later use. If raycast hits the track, also stores it as the last result

  • Raycast forward in a certain distance to predict any sudden rise of the track

Surface Detection Phase

 

Physics Simulation Phase

Suspension Component

  • Use the equation shown below to caculate up and down force

  • X-axis represents the hover height, and the intersection point is the height we want the vehicle to be stable at.

  • Y-axis represents the force value we apply to the vehicle, the red line indicates up force and the blue line indicates the down force. Also we clamp the value to prevent applying an infinite larget force when x->0 and x->∞.

IRL_FunctionGraph.png

Stability Component

InputControl Component

Combine All Forces Together

 
  • Calculate the falldown force according to the steepness of the track that the vehicle is driving on

  • Calculate the air drag force acoording to vehicle’s velocity in X, Y and Z axis

  • According to the hit result we stored in surface detection phase, set current alignment vector and calculate how much torque needed to rotate the vehicle to make it align to the track

  • Receive player's input events

  • Calculate vehicle’s horizontal linear force when player presses acclerate and brake buttons

IRL_CombinedForce.png

Track Features

IRL_BoostGate.png
IRL_ShieldGate.png
IRL_KnockGate.png

There're three types of gates in this game: boost gate, shield gate and knock gate. As player passes through each gate, they'll acquire a certain ability which can increase vehicle's speed immediately for a short amount of time, or a shield item to avoid "attack" from other players or can knock other players away from you. 

However, the boost gate is quite special - if players pressed the expertise button within 0.5 seconds, they would gain an extra boost. So the implementation is pretty much event-based, as an expertise window timer is set if the player passes through a boost gate.