A decision tree and a line of waypoints turned a solo template into a race.

A racing game with nobody to race gets old fast. That was the problem with a Unity karting template a team of developers picked up in 2021. It could only be played alone, because it shipped without an opponent. Their fix was to build a non player character that drives the course and competes for position.

The work split into two separate problems. The kart has to move around the track without clipping walls or barriers, and it has to choose what to do when the track ahead changes. Both need to run cheaply enough that the frame rate holds.
For movement, the team placed waypoints along the track and let the NPC steer between them. A raycast, a line cast forward from the kart to see what it touches, watches for obstacles and triggers a correction when something blocks the path.

The team ran black box testing to check behaviour from the outside, and white box testing to check the logic inside. Both passed. They also drove the NPC for ten laps to watch how it handled corners and contact with other karts.
The performance cost turned out to be small. Adding opponents in pairs cost roughly 0.2 to 0.3 frames per second, so a race can hold several of them on modest hardware without a visible drop.
On lap time, the new NPC beat the machine learning opponent that came with the template. The authors argue the decision tree is the cheaper route, since it needs no training data and its behaviour can be read straight off the rules.
One game and one track is a narrow test, so the exact figures will not carry over to another project. The structure will. Racing AI is easier to build when driving and deciding are solved separately.
Mas'udi et al. (2021). Development of Non-Player Character for 3D Kart Racing Game Using Decision Tree. Fountain of Informatics Journal.