Use of Dark AI
============================
Dark AI is implemented in the following areas:

Path finding for the opponent

Tracking of opponent positions

Adjusting the intelligence of the computer-controlled player

Defining the valid track routes using waypoints
AI FAQ
How does the computer find it’s way around?
Whenever the situation changes, a new AI path is created from the player to the token. This happens when the game starts, whenever a token is collected by either player, or when a collision occurs.
How is the path used?
The path is a series of waypoints. Each one is used in turn to get the opponent from where he is to the token. Whenever the player idles, he is assigned the next waypoint to travel to.
Why do you never see the player idle?
The idle time for the opponent is set to –1. That simply means that he doesn’t get chance to do anything for himself. As soon as the idle state is detected, he is given his next instruction.
Why don’t you just assign the entire path and let the carriage get on with it?
We could, but working out where it was at crucial moments would be difficult and time-consuming. By doing it the way it is, you always know which track part the carriage has come from and is going to. This is a grid-based system, so it’s important to know where on the grid you are.
How is the carriage kept on the track?
The carriage simply travels between waypoints. Every area that is not track is defined as an obstacle.
But each obstacle creates many waypoints, how does that work?
The waypoints created by obstacles are removed. The waypoints are recreated in a memblock, one in the centre of each track tile. Thus just one waypoint, not 2, 3 or 4 that the obstacles create, represent each tile.
The carriage never cuts corners, why not?
The obstacle radius is set to 45% of the size of a tile, and thus protrudes way beyond the visibly inaccessible areas.. This basically makes the space available to the AI system very narrow, or “Track-like”, you could say!
And why doesn’t the carriage always face the direction of the next waypoint?
The AI object is actually a hidden cube. What you see is a model which is set to follow the AI cube exactly, but turn more slowly.