RIVER EDGE, N.J. – It's the stuff of e-mail spam: Teen earns $50,000 coding an online game, funds college education and makes parents proud.

But in this case, it's true. Fifteen-year-old Andrew Bereza developed a game called "Two Player Gun Factory Tycoon," which has attracted nearly 9 million visits on the children's gaming website called Roblox and earned him, yes, $50,000 since its release in June.

"It's pretty ridiculous," Andrew said, trying to fathom the game's success. "People really liked it, and I really didn't expect for it to explode the way it did."

His father, Pavel Bereza, couldn't believe it, either. "I thought it was a joke," he said.

That such a website exists might be surprising in its own right. The site is a platform for game developers and players where all the games are created by the Roblox community using the coding and design tools built into the site.

While it's virtually unheard of among adults, it attracted 4.5 million players — mostly kids 8 to 18 — and 80 million hours of play time in December. In terms of page hits and engagement time, that puts Roblox in the same class as such Internet stalwarts as LinkedIn, Reddit, Pinterest and Match.com, according to the Internet analytics company comScore.

The "engine" that's driving interest in the site, Roblox CEO David Baszucki said, is a feature that allows developers to sell virtual items within their games using a virtual currency called Robux. In a murder mystery game, for example, the player might be able to purchase a flashlight. In a game simulating a pizza parlor, the player can invest in a pizza delivery vehicle.

Once the developer has amassed a fortune of Robux, he or she can exchange it for real dollars at an exchange rate of 400 Robux to $1. This exchange program has paid out nearly $1 million to a few hundred developers since its launch in October 2013, Baszucki said.

"It creates the incentive to build and create interesting games," he said.

But Andrew said he never expected to make real money off of Roblox. Rather, putting together his game was a product of boredom.

"I started toying around with Lua, the programming language on there," he said. "I eventually got interested in making a game, spent a couple weeks putting it together, and when it was released I was just surprised to see it hit the charts."

Advanced math as reward

It wasn't not quite as simple as he makes it sound. Despite his age, Andrew has a wealth of programming experience gleaned from parents, who work in the programming field. After his mother bought him his first laptop when he was 9 or 10, she taught him the basics of Java script and started presenting him with bite-size coding challenges on a weekly basis.

"When he was little, I rewarded his good behavior by teaching him advanced math," said his mother, Irina Rapoport. "I was trying to get him to play ball, but he always had a lot of interest in technology and science."

It became clear by the time he was 12 that he had a knack for programming, said Pavel, who works as a software architect for Western Union. "He has a kind of sharp, logical mind," he said.

Coding updates to "Two Player Gun Factory Tycoon" — in which each player builds factories that mine the resources needed to buy weapons to attack the other's mining installations — has become a part-time job for Andrew. He estimates he spends a couple of hours each school night designing enhancements to the game, then pushes out the updates on weekends, when he has more time to dedicate to fixing bugs.

But unlike most high school hobbies, this one pays well. Andrew said he recently splurged on a new computer but otherwise is saving his earnings for a computer science degree.

"I want to take a serious direction with it and see what I can do," he said about programming, adding that he likes being able to create something out of nothing. "My game started as an empty void and turned into what it is today."

Andrew has time before he has to make any big decisions about his future. In the meantime, he's a hurdler on the junior high track team and likes to get pizza with friends, especially now, his father said, because he can pay for it himself.