As a prisoner at the Jixi labour camp, Liu Dali would slog through tough days breaking rocks and digging trenches in the open cast coalmines of north-east China. By night, he would slay demons, battle goblins and cast spells.

Liu says he was one of scores of prisoners forced to play online games to build up credits that prison guards would then trade for real money. The 54-year-old, a former prison guard who was jailed for three years in 2004 for "illegally petitioning" the central government about corruption in his hometown, reckons the operation was even more lucrative than the physical labour that prisoners were also forced to do.

"Prison bosses made more money forcing inmates to play games than they do forcing people to do manual labour," Liu told the Guardian. "There were 300 prisoners forced to play games. We worked 12-hour shifts in the camp. I heard them say they could earn 5,000-6,000rmb [£470-570] a day. We didn't see any of the money. The computers were never turned off."

Memories from his detention at Jixi re-education-through-labour camp in Heilongjiang province from 2004 still haunt Liu. As well as backbreaking mining toil, he carved chopsticks and toothpicks out of planks of wood until his hands were raw and assembled car seat covers that the prison exported to South Korea and Japan. He was also made to memorise communist literature to pay off his debt to society.

But it was the forced online gaming that was the most surreal part of his imprisonment. The hard slog may have been virtual, but the punishment for falling behind was real.

"If I couldn't complete my work quota, they would punish me physically. They would make me stand with my hands raised in the air and after I returned to my dormitory they would beat me with plastic pipes. We kept playing until we could barely see things," he said.

It is known as "gold farming", the practice of building up credits and online value through the monotonous repetition of basic tasks in online games such as World of Warcraft. The trade in virtual assets is very real, and outside the control of the games' makers. Millions of gamers around the world are prepared to pay real money for such online credits, which they can use to progress in the online games.

The trading of virtual currencies in multiplayer games has become so rampant in China that it is increasingly difficult to regulate. In April, the Sichuan provincial government in central China launched a court case against a gamer who stole credits online worth about 3000rmb.

The lack of regulations has meant that even prisoners can be exploited in this virtual world for profit.

According to figures from the China Internet Centre, nearly £1.2bn of make- believe currencies were traded in China in 2008 and the number of gamers who play to earn and trade credits are on the rise.

It is estimated that 80% of all gold farmers are in China and with the largest internet population in the world there are thought to be 100,000 full-time gold farmers in the country.

In 2009 the central government issued a directive defining how fictional currencies could be traded, making it illegal for businesses without licences to trade. But Liu, who was released from prison before 2009 believes that the practice of prisoners being forced to earn online currency in multiplayer games is still widespread.

"Many prisons across the north-east of China also forced inmates to play games. It must still be happening," he said.

"China is the factory of virtual goods," said Jin Ge, a researcher from the University of California San Diego who has been documenting the gold farming phenomenon in China. "You would see some exploitation where employers would make workers play 12 hours a day. They would have no rest through the year. These are not just problems for this industry but they are general social problems. The pay is better than what they would get for working in a factory. It's very different," said Jin.

"The buyers of virtual goods have mixed feelings … it saves them time buying online credits from China," said Jin.

The emergence of gold farming as a business in China – whether in prisons or sweatshops could raise new questions over the exporting of goods real or virtual from the country.

"Prison labour is still very widespread – it's just that goods travel a much more complex route to come to the US these days. And it is not illegal to export prison goods to Europe, said Nicole Kempton from the Laogai foundation, a Washington-based group which opposes the forced labour camp system in China.

Liu Dali's name has been changed