Grand Theft Auto 5
Rockstar's Grand Theft Auto 5 is being used by researchers to train their self-driving AI. Rockstar Games

Known for its violence, crime and vehicular mayhem, Rockstar Games' Grand Theft Auto 5 isn't exactly a game you'd expect to be teaching autonomous cars how to drive themselves more safely, but that's exactly what's happening.

Grand Theft Auto 5's Los Santos and San Andreas setting is a rich virtual environment with a number of factors that are helping researchers. It features 262 vehicles, 14 different weather conditions, traffic signals, bridges, tunnels and over 1000 NPCs roaming its roads.

"Just relying on data from the roads is not practical," David Bacchet of San Jose-based electric car startup Nio told Bloomberg. "With simulation, you can run the same scenario over and over again for infinite times, then test it again."

Nio plans to introduce a self-driving electric car in the US by 2020.

Alain Kornhauser, a Princeton University professor who advises its Autonomous Vehicle Engineering team, said the popular game is "the richest virtual environment that we could extract data from".

Researchers have often turned to various games to test and train their AI systems, from Atari games such as Asteroids and Pac-Man to classic board games such as Go and chess, through reinforcement learning algorithms and trial and error.

In November last year, Google's DeepMind paired up with Blizzard Entertainment to use strategy sim StarCraft 2 to train its own AI systems.

In 2016, a team of researchers from Intel Lab and Darmstadt University in Germany found a way to extract useful visual information and data from GTA to train their own automated driving system to better navigate roads.

"Annotating real-world data is an expensive operation and the current approaches do not scale up easily," Alireza Shafaei, a PhD student at the University of British Columbia who coauthored a paper on the use of video games to train computer vision systems, told MIT Technology Review.

"With artificial environments we can effortlessly gather precisely annotated data at a larger scale with a considerable amount of variation in lighting and climate settings. We showed that this synthetic data is almost as good, or sometimes even better, than using real data for training."

In February, Rockstar Games' parent company Take-Two interactive announced that GTA 5 has shipped over 75 million copies since launch in 2013.

Grand Theft Auto 5 is currently available for PS4, Xbox One and PC.