Two by 4 Racing


  • C#, Unity3D, Phidgets, Arduino

  • Programmers: Keyin Wu, Ezra Hill
    Artists: Yuxi Li, Yuxuan Wu
    Sound/Producer: Derek Williams

  • Nov, 2022 - Dec, 2022

Two by 4 Racing is a fast-paced cooperative racing game that focuses on speed. Two players will sit back to back, each with their own bike tire steering wheels to maneuver their TrashBoatMobile (tm) down a mountain path, avoiding local flora, fauna, cows, and fences to break the track record. The player in front will steer the contraption, while the person in back controls the gas pedal, and the players can switch roles at will to match gates to get more fuel.

This game is also accepted by alt.ctrl.gdc 2023

Contribution

Programming: GameManager, ResourceManager (Fuel, Props), AudioManager, Random Name Generator, Online Leaderboard, Hardware Dev (Arduino, Button, Serial Port), UI Dev

Game Design: Game Flow, Multiplayer Mechanism

Detailed Work

Forward Direction Check

When it comes to checking whether vehicle is moving towards the right direction, One traditional method is to calculate the angle between the vehicle direction and the track tagent vector. However, in Two by 4 Racing, I calculated the intersection angle composed by a reference line and the moving vehicle in order to simplify the process. As shown in the figure below, the highlighted angle should increase if the vehicle is moving in the right direction.

Image-1

Since our track is not a standard circle, I cut the track into several segments with different reference lines (in blue). Each reference line also has a different detecting range (in grey), which can be easily adjusted in the editor.

Image-3 Image-4

Reference lines and its detecting ranges are visualized with Unity editor scripting. For each line, it has a float (MaxDetectAngle) to determine the range and an additional boolean value (isChecked) to check if players have traveled around the track for completion.

Image-2