It is both loved and maligned. The iconic fantasy game Dungeons & Dragons is turning 40. That's a long time for anything to stay relevant— especially a game— and that poses challenges for the game's owner, Rhode Island-based Hasbro.

What can Hasbro do to try to reclaim its successful brand?

For Rhode Island residents John and Danielle Neary, Dungeons & Dragons is more than a game.

"This is the big joke of the family, that D&D saved our marriage," Danielle said.

She started playing Dungeons and Dragons 22 years ago, when she was 12.

"It was under the bleachers at summer camp, second edition, and I was the girl in the group," she said. "It actually wasn’t the best first D&D experience. But it had me hooked."

D&D, owned by Pawtucket-based Hasbro, is a role playing game, which is different from other Hasbro games like Monopoly or Scrabble. Players take the role of characters in a fantasy world orchestrated by a game master. Their actions are limited only by loose rules, and it plays a little like an improvisational play.

Seven years ago, Danielle introduced her husband, John, to D&D.

"I like creating the characters and living them, living them in the different stories," he said. "It’s a great escape and I just love it."

But in 2008, Danielle and John stopped buying new D&D products.

That year, Hasbro, who bought the D&D brand in 1999, released a new, fourth edition of the game. This version focused on battle, and felt more like a video game.

"If you look at the Amazon review of it, people either loved it or they really hated it," said Mike Mearls, senior manager of Dungeons & Dragons research and development. "What we found was people who liked battling monsters like the combat portion of the game. For people who were more into D&D for the storytelling aspect of it, they weren’t anywhere near as happy."

After Hasbro released the fourth edition, Mearls watched sales of D&D products drop.

According to data collected by website ICV2, Pathfinder surpassed D&D as the best-selling role playing game in the second quarter of 2011. In the fall of 2012, D&D fell to third place.

For Hasbro, those lost sales translated to a loss of brand-value.

"When D&D started, fantasy was really a niche genre," Mearls said. "What we’ve seen in the 40 years since is that fantasy is everywhere, 'Game of Thrones' being one of the most popular TV shows. The 'Lord of the Rings' movies, and 'The Hobbit' and 'Harry Potter' topping the bestseller lists and the box office charts. So, in looking at fantasy as a whole and looking at D&D, what we’re really looking to do is expand into those areas."

Today, D&D fans experience the brand through board games, novels and online video games, but the value of those products depends on D&D maintaining and growing its core audience.

So, Hasbro moved quickly. In 2012, the company announced it was working on a fifth edition. Hasbro even published a beta set of rules online, and the unit responsible for the game promised to consider player feedback.

"The process of developing fifth edition, it was kind of like going on a quest with the adventuring party being everybody who plays D&D," Mearls said.

In total, the company recruited more than 175,000 play-testers to help guide the game back toward its roots. This week, during Gen Con, a gaming convention in Indiana, Mearls and Hasbro learned whether or not their quest succeeded.

"If players liked Hasbro’s new version, D&D would return with renewed strength," he said. "If they didn’t, the brand could be in jeopardy."

How did it do?

"I played a fifth edition PVP last night, and it was absolutely incredible," Danielle said. "We did an adventure-league, fifth-edition four-hour game today and it was just simple to jump into without reading the players handbook cover to cover."

And Danielle wasn’t alone. Players from around the country gathered at tables inside a D&D castle to adventure in the new version of the game.

"The reaction so far has been great," Mearls said. "People use the word 'elegant,' which to me is the best thing you can say about a game. If a game’s elegant, that’s like, 'Yes! Victory.'"

And that victory could keep the D&D brand going for another 40 years.

Watch Ethan Gilsdorf, the author of "Fantasy Freaks and Gaming Geeks," on Greater Boston.