Last year saw a bloodbath on the high street. Debenhams closed 50 shops, Toys R Us, Maplin and Poundworld went into administration, and more retail space was lost than in any year since 2008, with 1.9m sq metres closing, according to the property analysts EG. But one retailer beat this trend, reporting profits of £40m in the final six months of the year. In 2017, the same company was the publicly traded British stock that outperformed every other: Games Workshop, a high-street retailer of science fiction and fantasy miniatures, now carries a market capitalisation of more than £1bn.

But how did a company founded 40 years ago with one shop in Hammersmith, west London, become so successful? The answer lies in Warhammer 40,000 – 40k, as it is usually known; a sprawling tabletop conflict game in which two players fight with collectible armies, including the space marines of the fascist human Imperium and the ancient fallen angels of the Eldar, using rules found in a library of 30 or so source books.

If this sounds surprising, it is worth noting that Games Workshop isn’t the only part of nerd culture to experience a recent rush of interest. Dungeons & Dragons, the venerable role-playing game, has had its own resurgence since 2014, thanks to depictions in TV shows such as Community and Stranger Things. The rise in “actual play” podcasts such as the Adventure Zone and Critical Role has also helped, as has a focus on attracting new players for its fifth edition.

Tabletop gaming in general is doing better than ever. On Kickstarter, which has taken an influential role in the industry, the category was up 20% in 2018 year on year, raising a total of $165m (£128m). Asmodee, a global board-game publisher based in France, was sold to a private equity firm in July for €1.2bn (£1.1bn).

But Warhammer’s success stands out, and to understand why this is, there are a few things you need to know.

A Warhammer collectible. Photograph: Games Workshop Group PLC

The first is the motto of Warhammer 40,000: “In the grim darkness of the 41st millennium, there is only war.” In other words Games Workshop is a serious business, but it is not to be taken seriously. In fact, Warhammer Fantasy Battle, a goblins-and-gnomes war game, and Warhammer 40k are ridiculous, over-the-top pastiches, created by people who were bored and angry under Margaret Thatcher, and channelled that rage into worlds where everyone is the villain, and hope has been extinguished for millennia.

Each game exists in its own vast fictional universe, with the entire thing loosely connected by a narrative about the forces of chaos and a fondness for skulls. “Imagine if Disney were founded by a bunch of people who had been primarily inspired by heavy metal album covers,” says the writer Kieron Gillen, a longtime fan who has written tie-in comics for the company. “There’s a belief that less is more, but what Games Workshop argues, quite convincingly, is that, no, maybe more is more.

“A fundamental 40k thrill is probably something involving a chainsword, which is a sword crossed with a chainsaw. That is over-the-top and silly, but also, in a very heavy-metal-guitar-solo way, exciting.”

It certainly was for me. By the time I was a child, growing up around the corner from that first shop, Warhammer was already something of a phenomenon among the sort of crowd who carried 20-sided dice in their schoolbags. Tucked in the back of that small store was a vast diorama depicting an entire chapter of Ultramarines, the 9ft tall, blue-armoured shock troops of the human Imperium of the 41st millennium. The display – more than 1,000 small figurines, replete with miniature tanks, standard bearers and a detachment of motorcyclists – was my personal crown jewels: dripping with symbolism; a must-see for visitors to my area, and just as unattainable.

That’s because the second thing to know about Games Workshop is, as Gillen says, that Warhammer was what middle-class nerds did instead of heroin. It was just as expensive, and probably no better for your social life. A small squadron of space marines would cost about £20, a fortune for a 12-year-old; but a full two-player game would need almost 10 times that many units, as well as tanks, bikes and special figures – not to mention huge bipedal dreadnoughts.

I finally managed to save up for a tiny army from the Necron faction, a race of mechanical skeletons who flay their foes with a glowing green “gauss gun”. Painting, playing with, and (when I could afford it) buying those models was my life for a few years – until an inexpertly mounted shelf collapsed, smashing the whole army.

But for those fans whose dream wasn’t so literally crushed, Warhammer isn’t a game, it’s a hobby. The Hobby. It’s as much about assembling and painting the models themselves, using the special paints, inks and washes created by Games Workshop. It’s about sharing your finished miniatures and reading White Dwarf, Games Workshop’s in-house magazine. (This magazine is also the only way the company communicates with the outside world; it is notoriously press-shy, and would not be interviewed for this article.) It’s about the Black Library, a collection of tie-in fiction that runs to hundreds of novels, as well as comics, video games and a new young-adult book series.

Photograph: Games Workshop Group PLC

This depth means that former fans never quite leave. Duncan, a childhood fan who returned to the game as an adult, agrees: “It’s a bit of everything. There’s an easy escapism in reading the fiction, especially now you can do it on a Kindle, and not advertise what you’re reading to other commuters. The games themselves are fun and very social.

“But I also like the modelling and painting. I used, as a teenager, to play with unpainted models, but nowadays I enjoy the process [of painting]. It’s oddly relaxing; more like meditation than a chore.”

At its worst, that fanatical dedication has made followers easy prey for a company eager to line its pockets. But Gillen, whose latest book, Die, is loosely inspired by his own experience playing the Warhammer role-playing game in his teens, says things have changed.

“I used to write these guides on how to make a Warhammer army for £60,” he says. “I stopped doing that, partly because I don’t need to. Now, you can buy one of the official £50 boxes and you have an army.”

For Gillen, the story of Games Workshop’s renaissance isn’t a story of sweeping reorganisation but a myriad of small changes that have turned a slightly fusty, vaguely mistrusted brand into one that is gaining new players, reconnecting with older ones and profiting – handsomely – from both.

Which doesn’t mean there haven’t been large changes. In 2015, the company abruptly discontinued its oldest game, Warhammer Fantasy Battle – even publishing in-game fiction that destroyed the world. The replacement, Age of Sigmar, was built to be accessible to new players, with simpler rules. It caused uproar among existing players who claimed the whole thing was dumbed down to the point of stupidity. But three years on, with most of the best changes incorporated into a new edition of Warhammer 40k, it is clear the rewrite paid off.

Anita Widdowson, 20, a student in Nottingham, is one of those newer players. She started collecting the models about two years ago, but only got round to learning to play last year, and credits the new rules with bringing more players on.

“The ‘Eighth Edition rules’ are much simpler than any previous edition,” she says. “It means that casual players and younger children can follow the game well, enticing more customers.” But, like Gillen, Widdowson says there are many reasons for the boom overall: better models, easier construction and the way Games Workshop communicates with the community through its magazine, rather than simply offering them a catalogue to buy things from.

The shops themselves have had a cosmetic overhaul (some stores were rebranded to read simply Warhammer, as the chain tried to consolidate its image), but Games Workshop has also put a huge amount of effort into building a welcoming atmosphere. “You know that old reputation of their shops being alienating? Now, it’s much more open,” Gillen says, comparing the new look to an Apple Store.

A Warhammer collectible. Photograph: Games Workshop Group PLC

Widdowson agrees. “My best experience with the hobby was buying my first ever set of models in Games Workshop in Oxford,” she says. “I was shocked by how friendly the staff were, and it really motivated me.”

But Games Workshop’s success may have a downside for small companies. Adrian Hunter, who runs the games shop Weyland’s Forge in Birmingham, says it is steamrollering competitors such as Warmachine and Malifaux. “While the success of all the Games Workshop lines is great – the company is a genuine joy to work with right now – other games … have seen a large drop-off, to the point we’re just trying to clear the stock now. And it’s not just our store, either.”

For Gillen, the only shadow on the horizon is whether the company can maintain the pace it has been setting without letting anything slip. As well as the core Warhammer games, it has been releasing spin-offs at a steady clip. But on that, Games Workshop had its own answer, in an FAQ it published before the launch of the latest edition of Warhammer 40,000. Answering a question about why it should be trusted with the rewrite, it answered: “Come on! This is New Games Workshop™.” In other words, it knows it has had its ups and downs, but the steady drip of changes will continue. As is the £16 Eldar Autarch, a winged alien commander I bought while researching this piece. Providing, that is, my shelving is better installed in 2019 than it was in 2002.