When Ubisoft first approached “It’s Always Sunny in Philadelphia” stars Rob McElhenney and Charlie Day about creating a new show set in the video game industry, McElhenney said they weren’t interested — at least not initially.

“Anything that we had ever seen in the past, from a movie or television show perspective, the industry was always presented in such a negative light,” he told me. “It was the butt of the joke. The characters themselves were derided, and it was very specific to geek culture…. We just had no interest in that.”

And yet McElhenney, Day and “It’s Always Sunny” writer Megan Ganz ended up creating “Mythic Quest: Raven’s Banquet,” which premieres on Apple TV+ this weekend. McElhenney explained that a visit to the Montreal offices of Ubisoft — publisher of “Assassin’s Creed,” “Prince of Persia” and other major game franchises — changed his mind.

“Once we went to Montreal and met all of the devs that worked at Ubisoft, that all work in communion to make these games, [we realized] how many different, disparate personalities there really were and how much they were all united by their love of games,” he said.

So McElhenney decided that “this just seemed like a really interesting and new place to set those kinds of stories.” And just as he assumes most “Sunny” viewers aren’t tuning in to learn the fate of Paddy’s Pub (the Philadelphia bar run by the show’s main characters), “The approach we took was, the general audience is not going to care about the success or failure of a video game; they’re going to care about the interpersonal dynamics of the characters themselves.”

Ganz also said she didn’t know much about video game development when McElhenney first approached her about collaborating on the show, but she started to see parallels between that world and a TV writers’ room.

“Except that instead of everyone being a writer, they all have very specialized jobs that they care about, like just the writing or just the design or just the money that’s being made,” she said. “And I thought, well, that’s really fun because that presents something that’s even more complex than your typical writers’ room — you have all these sort of Greek gods that all control their very specific part of the world.”

Of course, “Mythic Quest” had a writers’ room of its own, which Ganz said was divided evenly between people with deep knowledge of the industry (like Ashly Burch, who’s done extensive voiceover work on games like “Team Fortress 2” and “Fortnite,” and who also plays a game tester on the show), and those like Ganz who may have casually played games but didn’t really know much about that world.

“We did that because ultimately, if you come up with a script or a joke that satisfies both of those people, then you’re going to satisfy as much of the audience as you possibly can,” she said.

The goal, she added, was not “pandering to the video game community” but rather “to be authentic and not make fun of them, but also be authentic in terms of talking about some of the toxicity that happens in the video game space, the gender dynamics that are at play.”

It wasn’t just a learning process for the writers. F. Murray Abraham (who won an Oscar for playing Salieri in “Amadeus”) plays an eccentric science fiction writer who works on the game, and he told me that when it came to video games, “I had no idea. I knew something, I was aware of it, but not the size of it, the success of it, the reach of it, my God.”

All the “Mythic Quest” writers and actors I spoke to said that their approach has evolved significantly from the original pilot script. For example, there’s McElhenney’s character Ian Grimm, the creative director of the massively multiplayer online roleplaying game that gives the show its name.

“In the first draft of the script, we made Ian a little bit more of just a straight buffoon,” McElhenney said. “We read through it and we realized it just felt false. It was missing something, that if we didn’t want this to feel like a live action cartoon — like ‘Sunny’ often does, which is by design — and we wanted these people to feel real and authentic, that we needed to believe that he really should have that position.”

The question, then, was how to make him competent in a funny way. This led to a pilot episode where Ian and lead engineer Poppy (played by Charlotte Nicdao) end up in a passionate debate about the properties of the game’s brand new shovel. While that debate will probably seem silly to most viewers, McElhenney said it also conveys “that thing that so many people in the creative arts have, or don’t have — the ability to see the most minor detail; the reason why something is going to work or why it might not work.”

Throughout that process, the writers also tapped Ubisoft for advice. Jason Altman, Ubisoft’s head of film and television, is an executive producer on the show. He recalled bringing in different team members to help the writers understand everything that goes into the development process.

In addition, Ubisoft Red Storm (the studio behind the Tom Clancy game franchise) pitched in by building the game segments that we actually see on the show.

“What they created were actually small gameplay sandboxes that we could bring to set, and the actors could sit and play with them and it would actually inform their performances,” Altman said.

He acknowledged that there were challenges, like helping the “Mythic Quest” writers realize that the developers needed time to do their work. But ultimately, he said, the Red Storm team had “a great time” creating something that gave the show “a real sense of authenticity.”

Ganz and McElhenney also had plenty of praise for the developers, particularly for their openness to adding silly comedic elements like ridiculous gouts of blood. McElhenney pointed to one episode that required them to create “a really believable Sieg Heil Nazi salute.”

“There’s no way they’re going to go for that; it’s going to take a follow-up phone call,” he recalled thinking. “And they were like, ‘Okay great.’ And I was like, ‘Wait, what do you mean, okay great?’ They said, ‘No, we do Nazis all the time’ — and we put this in the show — ‘because Nazis make the best villains, everybody hates Nazis.'”

I was also curious about why the show focuses on the development of an ongoing MMORPG, rather than launching a new game. Altman had an answer for me: “I think it represents what’s happening within the game industry. You don’t just launch a game and forget it. The development team lives with it, you’ve got live services and live events. It’s the way games are operated right now.”

Plus, he said it reflects another aspect of development — the fact that teams “don’t just spend six months together, they spend years together, and the success that they create together binds them together.”

David Hornsby — who, like McElhenney, is both a writer, executive producer and actor on the show — told me that the writers’ understanding of the show’s distribution plan also evolved, since Apple TV+ hadn’t launched (or even been officially announced) when “Mythic Quest” first got picked up.

“We weren’t sure if it wasn’t going to be binge-able from the start, we heard incrementally,” Hornsby said. “Apple is good at keeping secrets.”

Ultimately, they did find out that all nine episodes of the first season would drop at once, which Hornsby said led them to structure the season “like a movie — we know where we are going to be in the middle of the season, the story arcs for each of our characters.”

I also brought up Apple TV+ with McElhenney, who said the team had offers from a number of studios.

“It was scary,” he said. “And I remember we were discussing it, we were like, do we go with a known quantity? Or do we jump into the waters of mystery, because even though it’s the biggest company in the world, you don’t know if it’s going to work.”

So why choose Apple? “We just felt like, if you’re gonna bet on somebody, why not bet on a trillion dollars? They seem to have the resources and something figured out.”