The Complete Magazine on Open Source

TensorFlow brings self-driving to Mario Kart

/ 1689 0

Mario Kart

While many automotive companies are striving to persuade customers with their self-driving concepts, open source software library for machine intelligence TensorFlow is bringing the advanced driving model even to video games like Mario Kart.

Open source developer Kevin Hughes has deployed Google’s TensorFlow to build a self-driving Mario Kart model which he called TensorKart. The developer used open source N64 emulator mupen64plus to play Mario Kart on his desktop computer and took the development support from TensorFlow and cuDNN. Also, he wrote a Python program using open source libraries such as wxPython, Pygame and Matplotlib to continuously capture screenshots from the emulator synchronised with a joystick input. This brought the basis of the training set.

Self-driving TensorKart developer Kevin Hughes

Kevin Hughes, the developer behind TensorKart

“The idea of exploring AI techniques in video games was not new, but what motivated me to do this project was to showcase complete pipeline of a machine learning system. I wanted to pick a popular game because I thought it might interest more people and expose them to how machine learning works,” reveals Hughes.

Obstacles in developing intelligent model

The combination of TensorFlow, cuDNN and some open source libraries enabled Hughes to develop the TensorKart gameplay. But the journey of providing a self-driving model in a video game had some obstacles in the initial stage.

“I had to dust off my C programming skills and spend some time remembering all the nuances of C build systems and Makefiles,” Hughes told Open Source For You, adding that he also faced issues in debugging the originally trained model when it was not moving the car correctly at the first time.

However, Hughes took support from Stack Overflow and opted for perseverance by taking a day off in the middle of the project.

“When I first hit the issue of how to send input back to the emulator, I did not think it would be difficult. I needed to take a day off and appreciate this part of the problem and then approach it with the energy required to fix it properly,” states Hughes.

Open source plays vital role

Hughes believes open source as the key to run innovations like TensorKart around the machine learning area. “I have been a believer of open source pretty much since,” he says.

“It became apparent early on how much more efficient open source was, it just felt right. I have benefited a lot from what others have shared and feel good to share my own work.”

Going forward, Hughes plans to expand his TensorKart with new developments. He also expects to get some attraction from the community.

In the meantime, you can reach GitHub to download the same input plugin that has been enabling self-driving on Mario Kart and build your own advanced gaming experience.