How did Elon Musk first get interested in programming? By playing video games. The Tesla and SpaceX founder talked about his love of video games and how they started him on his career path at a video game convention last year. 

Today, we may not think of Musk primarily as a programmer. He's the founder of three companies taking on today's most challenging engineering problems: Building affordable electric cars with great range, colonizing Mars, and tunneling under the worst urban traffic. This week, he also became the world's third richest person, beating out Mark Zuckerberg after Dow Jones Indices announced that Tesla will be added to the S&P 500 index next month and the company's share price surged. None of it would have happened if Musk hadn't learned how to code, because he loved video games so much.

It all started when he was about 10 and his father took him on a trip from South Africa (where Musk was born) to the United States. "It was a really awesome experience because the hotels all had arcades. So my number one thing, when we went to a new hotel, was to go to the arcades," Musk told astrophysicist Neil DeGrasse Tyson on an episode of Tyson's radio talk show Star Talk a few years ago. 

"I thought I could make my own."

Video games are "incredibly engaging," Musk said. "They made me want to learn how to program computers. I thought I could make my own games." Musk managed to acquire an early Commodore computer which came with a manual that explained how to program in BASIC, an early computer language. He absorbed the knowledge by reading the manual, pretty much the same technique he used to teach himself how to build rockets almost 20 years later.

At age 12, having mastered BASIC, Musk sold the code for his PC game Blastar to a PC magazine for approximately $500. Eleven years later, he and his brother founded Zip2, a company that provided city guides, maps, and yellow pages for the newspaper industry, and which they eventually sold to Compaq for $307 million. Musk says he did most of the coding for Zip2, mostly at night when the software wasn't in use.

Musk used the funds from that sale to co-found, which after a merger eventually became PayPal, which then sold to eBay in 2002 for $1.5 billion. That high-profile sale, and the millions Musk earned as PayPal's biggest shareholder, gave him both the funds and the name recognition to get rocket scientists and automotive engineers to take him seriously as he set out to build spaceships and electric cars. In other words, the domino Musk pushed over when he first fell in love with video games in those hotel arcades and decided to create one himself led directly to his phenomenal success today.

This would likely come as a surprise to the millions of parents who've harangued their children to put down the controller and talk to their family members, go out and get some fresh air, or generally find a more constructive way to spend their time. And some research suggests that most people who abandon school or work to play video games aren't doing themselves any favors. But if you, or your child, are the sort of person who goes from playing a game to wanting to create one, then spending hours on video games may be a smarter way to spend time than you might think. Just ask the world's third richest man.