Years before Steve Bannon made Breitbart.com one of the preeminent names in online politics and led the final months of Donald Trump’s astonishing presidential upset, he was just a guy helping dudes cheat at video games.

His experience helping players navigate made-up realities, where all the news is fake and all the facts are alternative, helped him create a campaign that upended and rewrote reality.

But Bannon’s run to the White House wouldn’t have happened if it wasn’t for the lessons he learned as vice chairman of International Gaming Entertainment, according to Joshua Green in his new book “Devil’s Bargain: Steve Bannon, Donald Trump, and the Storming of the Presidency.”

Also Read: Trump's Praise of Bannon Gives Twitter the Giggles: 'Haha You're Scared He's Gonna Trash You'

Founded by Brock Pierce, a former child star of “Mighty Ducks” fame, IGE was essentially a middleman for major games like “World of Warcraft.”

As Green explained, the Hong Kong-based company specialized in “gold farming,” in which gamers would hoard “digital loot” like armor, gold and weapons to sell to players of immersive games like “WoW.” It would then sell that imaginary loot to clients who paid in real cash.

It’s almost a perfect metaphor for the way Trump’s campaign exploited fiction (like the notion that President Obama wasn’t born in the United States) to make real material gains (like winning the presidency).

When Bannon joined IGE in mid-2005, he “sought to take gold farming to industrial scale by building out a supply chain of low-wage Chinese workers who played ‘World of Warcraft’ in continuous, rotating shifts, battling monsters and dragons to produce a steady stream of virtual goods,” according to Green. These gamers would earn as little as 25 cents an hour in what the New York Times dubbed “virtual sweatshops.”

IGE would then sell the WoW accessories to western gamers at a markup. Despite operating in a grey area between the gaming studios and its customers, IGE’s plan seemed foolproof. Bannon landed $60 million in funding for the operation, spearheaded by Goldman Sachs.

However, “World of Warcraft” creator Blizzard Entertainment and the game’s passionate army of fans quickly pushed back on IGE’s business plans.

“Blizzard, under pressure from its customers, started shutting down the accounts of suspected gold farmers and sellers,” wrote Green. In a four-week stretch in early 2006, 800 gold farming accounts affiliated with IGE were shuttered. After a livid fan from Florida filed a lawsuit against IGE for “substantially impairing” the collective enjoyment of the game, IGE was in crisis mode. Pierce was forced out and Bannon was named CEO under the company’s new banner, Affinity Media.

Also Read: Steve Bannon Vows He's 'Going to War for Trump,' Returns to Breitbart

IGE’s meltdown would prove invaluable for Bannon moving forward, though.

“Bannon was captivated by what he had discovered while trying to build the business: an underworld he hadn’t known existed that was populated by millions of intense young men (most gamers were men) who disappeared for days or even weeks at a time in alternate realities,” wrote Green.

He’d leverage this knowledge as executive chair of Breitbart News, targeting “motivated gamers and message-board denizens” of sites littered with cries of “Make America Great Again,” like 4chan, 8chan, Reddit. Bannon’s intimate knowledge of gamer enthusiasm translated seamlessly to politics, where he was able to “marshal the online armies of trolls and activists that overran national politics and helped give rise to Donald Trump.”

Also Read: Michael Rapaport Predicts the Next White House Departures After Steve Bannon Ouster (Video)

Breitbart’s resurgence under Bannon — and the site’s unwavering support of the GOP nominee — caught Trump’s eye. Bannon was brought on board as chief executive of Trump’s campaign last August, where he harnessed the lessons he first learned at IGE and carried over to Breitbart to galvanize Trump’s massive online following. You know how the rest turned out.

Just after Trump’s election, the Washington Post quoted one of them: “We actually elected a meme as president.” That declaration was accompanied by an image of Pepe the Frog, a symbol of racist right-wing trolling.