Trials of Newton is a Racing game where two tracks are present and the player may gravity switch to ride on either track. Trials of Newton offers two different types of tracks: pre-made tracks that can be mastered or a procedurally generated track for different experiences each play through.
There are 12 different cars to choose from, each with a unique stat line. Some of my favorites are the Gauss, the Optics, and the Newtz 1.0.
I developed the Artificial Intelligence for this game. The AI is done in a state machine, with the car following nodes around the track. I took many ideas from the implementation of Flow Fields for this to work well with procedural generation. Each track piece has nodes attached to the prefab, and the AI cars will follow these linearly. When the end of the track piece is reached, it automatically knows to go to the next track piece. This is done by placing each track piece in a central parent GameObject, and looping through each of the children’s central Path object. The Transforms for each path is contained in this object and get copied to a List of Transforms in GameControl, the central manager for the gameplay elements. Each car gets an id from GameControl which is used to reference the User Interface elements of the game.
Each AI has a short Raycast in front of it to know when it’s about to hit something. If it detects something in front of it, the AI will gravity switch and start to ride on the other side of the track. There is no need to slow down even for a second in this game!