# Stig Kart 64

## Info

Project type: Unity Game

Timeframe: 2022

## Video

## Product Overview

A fast paced kart racer about timing your drifts and boosts just right. Play against your friends in splitscreen or the AI in singleplayer and try to get the quickest time.

## Project Overview

The game was made by a team of six people over two weeks. I spent most of that working on the input and kart physics. After the time trial mode was done, I also worked on the AI.

## Code

### Steering

For steering we had some very specific requirements. While drifting, the player needed to be able to control their direction, without being able to flip the direction of the drift or 'drift' straight forward. When drifting, the UpdateSteering function will transform the current steering input so that, if the drift was started while steering left, the possible range of steering values is within the range of -1 to -min, where min is a positive number lower than one which signifies the minimum amount of steering. When the drift is started while steering right, the range would be opposite, ranging from min to one.

### Basic AI

After we had completed the basic time trial mode, we still had about a week to add more features. So while another programmer went ahead to implement splitscreen, I wanted to try and get AI working. The player input component was already separate from the kart physics part. So the basic steering AI works by steering until it is aiming at the next invisible checkpoint on the course.

### Expanded AI

Allowing the AI to drift required it turning into the next turn rather than just aiming at the next checkpoint. To do this, i first get the next three checkpoints to calculate the total angle of the next turn. This angle is then used to decide whether to drift or not. After figuring out whether to drift or not, the AI will modify its physics in the same way as when the players presses the drift button. With the drift started, the AI needs to aim at the checkpoint after the next to drift.