This AI-Driven Trackmania Bot Can’t Be Beat

YouTuber Yosh spent three years coding a bot to teach it how to be unbeatable.

byKristin V. Shaw|
F1 photo
Yosh YouTube

In the early 1980s movie WarGames, a kid from the Pacific Northwest hacks into the US defense system and activates what he thinks is a harmless game of Global Thermonuclear War. Unwittingly, he launches what could become World War III if he can’t figure out how to disarm the supercomputer tasked with controlling nuclear missiles. Ultimately, the young hacker has to force the machine into learning through a continuous loop of Tic-Tac-Toe to understand the ultimate outcome: futility.

Decades later, a YouTuber with the channel name Yosh has tackled the lighter side of machine learning: he used artificial intelligence to train a bot to play Trackmania with reinforcement learning until he couldn't beat it.

Yosh started by teaching the bot by having it shadow his personal best. However, it tended to smash into walls for short-term reward, collecting points. Later in the game, it would learn that the long-term results were less than satisfying. Over and over, Yosh tweaked the algorithm with custom coding, using trial and error to figure out how to improve the results.

After making many small adjustments in his code, the bot stopped hitting the walls and closed the gap between its starting point and Yosh’s personal best.

“In practice, it’s been a real nightmare to get this thing working properly,” he says in the video. “This was a painful process.”

Finally, after three years, the AI-trained bot became unbeatable.

“I have to admit: after playing this game for so many years, it was a strange feeling to be outmatched like that by a computer program!” Yosh comments.

That spurred the YouTuber to challenge the bot even further; the original track was a simple series of S curves. Setting up a complex maze, Yosh tested the AI bot by programming it to spawn anywhere on the map so that it wouldn’t focus too much on the first few turns. After 35 hours of training, the machine could beat Yosh.

But wait. He wasn’t finished yet. He played with the road surface, added obstacles, and tinkered with the car’s physics. Then he taught it to drift by offering rewards in the form of additional points.

Nine-million-plus views later, this video is a fascinating 20 minutes of driver training. The bot learns how to take the shortest straight lines and find the quickest route, which is something any track fan can practice.

Send story ideas to