As it continues its wildly successful rollout, “The Favourite” is garnering both popular and critical acclaim. Centered on a lesbian love triangle in the court of England’s Queen Anne (who reigned from 1707-1714), the queer dramedy is breaking box office records for indie films and recently swept the British Independent Film Awards.

Directed by Yorgos Lanthimos (“The Lobster”), “The Favourite” is an irreverent and insightful spectacle about war, power, gender, sexuality and even love. The sumptuous film stars Olivia Colman (who is about to take over the role of Elizabeth in “The Crown”) as Queen Anne and Rachel Weisz (“Disobedience,” “My Cousin Rachel”) and Emma Stone (“La La Land,” “Battle of the Sexes”) as aristocratic cousins battling for the queen’s affections and the opportunity to wield the queen’s power.

Screenwriter Tony McNamara became involved in the project seven years ago when he got a surprising call from his agent. McNamara was working as a playwright in his native Australia when his agent said, “There’s a Greek director in London and he really likes your stuff.”

McNamara watched Lanthimos’ movie “Dogtooth” in Greek (this was before Lanthimos made “The Lobster,” his first English language feature) and liked what he saw. “I thought he’s one of a kind,” McNamara says during a press junket. “Right up my alley.”

The two men started talking and Lanthimos, who usually writes his own scripts, explained why he needed a writer. He had read a script by Deborah Davis about Queen Anne. He liked the story, but wanted to do something different with the material. He wanted someone else to work on I with him on it, so he read a lot of scripts.

“Yorgos really wanted to do a period piece because he had never done one before,” McNamara says. “I had written a period piece that he liked. He thought he and I would have the same sensibility and would get on with each other and we instantly did. We really understood what we wanted to do.”

When Lanthimos finally started shooting the movie last year, McNamara was on set for rehearsals and the first few weeks of production.

“Then I went to Italy and told Yorgos, ‘Call me if you need me,’” McNamara says. “Yorgos never called.”

That’s around the time when actor Joe Alwyn started his work on the film.

“I play a young man of the court called Masham who is not the brightest person in the world,” Alwyn says. “He sees Abigail (Emma Stone) as a shiny young thing he wants to chase after. There’s a power play between the two of them in each scene, a cat-and-mouse game where he’s lusting after her and she’s using him to advance herself at court.”

Alwyn says he started to do some research into the real-life Masham, but was stopped by Lanthimos.

“Yorgos made it clear to all of us that he really didn’t want us to get out the history books and start doing our homework,” Alwyn says. “He wasn’t trying to capture a moment in time; he wasn’t making a documentary. He was far more interested in exploring the relationships between the characters. It was a relatively unconventional approach to a period film.”

“Rather than getting out the history books and talking about social etiquette and character and intentions, we did a whole series of strange exercises,” he says. “Reading the script like a play and switching characters and rolling around on the floor and singing and dancing and doing all sorts of things to the point of humiliation which pleased Yorgos a lot. It meant that by the time we started shooting, we all felt very close to each other and were completely willing to jump in without any inhibitions or feeling stupid.”

Alwyn found that the gender reversals in the movie were fun.

“It’s refreshing to see a film that has three strong female leads. The male characters are very much trampled on and walked over and humiliated. What’s funny about it is they seem themselves as the ones with all the answers, but they’re pretty secondary. Yorgos turns all those stereotypes on their head.”

When they’re not making red carpet appearances for “The Favourite,” both men are involved in new projects that also based in history.

Drawing on the play which led to his involvement with “The Favourite,” McNamara is writing “The Queen” for Hulu. Elle Fanning will play Catherine and Alwyn’s castmate Nicholas Hoult will play her husband Peter.

Alwyn, whose recent credits include “Boy Erased,” “Operational Finale” and “Mary Queen of Scots,” is at work on “Harriet,” the Harriet Tubman biopic which also stars Cynthia Erivo, Janelle Monáe and Leslie Odom Jr. He’s also been dating singer Taylor Swift for over two years, but he told People magazine they’ve been “successfully very private” in their relationship.

Screenwriter Tony McNanara was chosen by director Yorgos Lanthimos for ‘The Favourite’ because of his skill with period writing. (Photo by James Gilham for Stillmoving LTD; courtesy 20th Century Fox)