Final Technology

Audio/Game Logic Enhancement

By Charlie Shaeffer

Technology implemented


  • Audio: New sounds and tracks
  • Audio: Position-based audio
  • Game Logic: Power up recognition
  • Game Logic: Player position reset

What it does


  • Every power up and each phase of the game has sound!
  • Sounds are relative to the player, so you only hears things that happen around you!
  • Power ups are fully implemented and are stored on each kart for use!
  • Whether you fall off a bridge, into a pit, or get too crazy, you can now get back on track!

How it works, and how I did it


Audio code
Game Logic code
In-depth Explanation

Audio: Sound effects are played throughout the race. Such sounds include when a kart picks up an item, uses a boost, or is hit/shot by a missile. Every frame a check is done to see if a sound should be played for the specified kart. If so, the location of the kart is provided and the sound is played at that location, scaling logarithmically based on distance to the player. This allows the player to hear sounds coming from behind, in front, or to the side of their kart. In addition, due to attenuation any sounds in the player's immediate vicinity will be significantly more audible than sounds triggered further away.

Game Logic: When a kart falls off the track, there is a check to see if it is far below their current spline point or if they have requested to be placed back on the map (in case they get stuck or some other incident occurs). If so, they are placed back on track! Elsewhere, a Uniform Spatial Subdivision tracks the power ups on the map, and checks if any kart is within range of a power up. At that point, they are given a power up to use. When used, GameLogic triggers the appropriate power up code and the power up is removed from the kart's inventory. Lastly, an addition to the game logic was made such that if someone chooses to go all the way around the map in reverse, they still have to make up that lap. Because those people are troublemakers.

Example:


Audio and Game Logic