Roland Emmerich’s 1994 sci-fi adventure “Stargate” ended up grossing over $196 million worldwide, but the path to becoming a hit wasn’t easy. The independently-made film that opened 25 years ago this week spawned TV series including the 1997-2007 “Stargate SG-1,” direct to video movies, video games and comic books, but it was not well-received with audiences in early test screenings.

The problem was with Jaye Davidson’s character, Ra, a powerful and ruthless alien in human form who had enslaved people from Earth and taken them to another planet via the Stargate, an ancient, ring-shaped device that creates a wormhole.

“He wasn’t originally an alien in the movie,” says producer and co-writer Dean Devlin. “He was originally an Egyptian who worked for the aliens. He was the boss of the humans, but he was still slave to the aliens. One day I’ll never forget, Roland and I were in the car together and we went, ‘Wait a minute! He doesn’t work for the aliens. He is an alien!'”

So, Devlin says, “We messed with his voice and made his eyes glow. We did all of these things to make him scarier and more intimidating.”

Davidson had been a handful on the set. “He was having a drug and alcohol problem,” remembers Devlin. “He was having a hard time remembering his lines. We had these giant cue cards, but he couldn’t read them.”

The American-born British model, who earned an Oscar nomination as a trans woman in 1992’s “The Crying Game,” had demanded — and received — $1 million for playing Ra.

“Mario Kassar, who was our executive producer, was doing all the foreign sales,” Devlin recalls. “Jaye was not really what we saw in our heads when we wrote it, but if it helped to finance the movie, great.”

Emmerich recalls when he came to the set “the first bad sign was when his personal assistant, who was the bass player from Frankie Goes to Hollywood, disappeared on the second day with Jaye’s phone, all his petty cash and his methadone. First he was hysterical, then it got really bad. I could write a book about it.”

When Devlin told Davidson about the changes prior to the opening of the film on Oct. 28, 1994, “he was so grateful that we had not cut him out of the movie. At that point, he had had been sober for a little bit. He was really trying to put his life together.”

“Stargate” marked the beginning of partnership between Emmerich and Devlin, who also went on to make the 1996 blockbuster “Independence Day,” 1998’s “Godzilla,” 2000’s “The Patriot” and 2015’s “Independence Day: Resurgence.”

James Spader stars as Egyptologist and linguist Daniel Jackson, who is asked by Catherine Langford (Viveca Lindfors) to translate Egyptian hieroglyphics on cover stones (stones placed to cover tombs) her father had found in Giza years before. The stones, which are located at a U.S. Air Force base, refer to a gate to the stars, which Langford reveals her father also discovered and is located on the same base. When Jackson lines up all seven markings on the outside of the ancient device, a wormhole opens. Jackson joins no-nonsense Special Ops Colonel Jack O’Neil (Kurt Russell) and his team on a life-changing adventure through the stargate to a distant desert planet replete with pyramid structures.

Emmerich notes that the idea for “Stargate” originated with the 1970 documentary “Chariots of the Gods,” which he saw while in film school in Munich. Based on the book by Erik von Daniken, the doc theorizes that “aliens created all civilizations,” he says. “That got me thinking I could make a movie about that.”

When he came out to Los Angeles, Emmerich discussed his idea with Devlin, who, as an actor, appeared in Emmerich’s last German production, 1990’s “Moon 44.”

“Together we came up with this idea that they’re going through a gate,” he says. “Then we started writing.” Canal Plus stepped in to finance the film, which was made for $55 million in Yuma, Ariz. and the Spruce Goose hangar in Long Beach, Calif., and MGM distributed the film worldwide.

The production hired an Egyptologist from UCLA to “recreate our best guess of what ancient Egyptian sounded like,” notes Devlin. “And we went through pains to teach the actors to recreate the language. I’ll never forget, our executive producer at the time was screaming at us saying, ‘Why are you spending all this money and time creating a language that not a single person on Earth will know whether it’s accurate or not?’ I kept saying, the sci-fi fans will know.”

And they did. “I remember six months before the movie came out, I hit every single sci-fi convention in the country,” Devlin recalls. “I set up a little booth to promote the movie.”

The inclusion of “Star” in the title initially hit sci-fi fans the wrong way. “They thought, ‘They’re ripping off “Star Wars,”‘ but once we started talking and as soon as they found out about us recreating the language, it changed everything. They felt like ‘Oh, they are one of us. They would go to that extra length for sci-fi.'”

Devlin has been a sci-fi fan since he was a child. His actress mother, Pilar Seurat, appeared in the “Wolf in the Fold” episode of the original “Star Trek.” “She came home with a phaser from the set and gave it to me,” he notes. “I’ve always said that was the crack that started my addiction.”

Russell, says Devlin, turned down “Stargate” several times. The film’s executive producer really wanted the “Escape From New York” star because, says Devlin, “He would be a really great name for foreign sales since we were doing the movie independently.”

But Russell didn’t like the script. Eventually, he agreed after producers hit the right salary number. “But then what we found out is that he had been given the wrong script,” Devlin remembers. “He was given a very early draft of the script that should never have gotten out. So, when he actually saw the shooting script he went, ‘Oh, this isn’t so bad.”’

Spader wasn’t happy with a lot of the dialogue in Emmerich and Devlin’s script, even the supposedly final version. “There was one day where he wouldn’t come out of his trailer until we rewrote the scenes,” says Devlin. “Kurt Russell got very upset with him. He burst into his trailer and said ‘What are you doing?’ And Jim said, ‘Come on, admit it. The dialogue is horrible.’ Kurt Russell said, ‘Of course, it’s horrible. That’s why they pay you a million dollars. If it was brilliant, you’d do it for free.'”

The cast, he says, didn’t really get the tone of the film until later in the production. “The movie always had a certain, not exactly tongue-in-cheek, but a wink to all the science fiction fans about what we were trying to do and the kinds of movies we were referencing,” says Devlin.

“Once they started to understand the tone, they started to really get it. When the movie was finished, both actors were really pleased with it. They were really happy, but I think it just took them a while to get where we were going with it.”

“Stargate” also changed the career of young British composer David Arnold, who won an Emmy for his music for the series “Sherlock” and has since scored movies including “Independence Day” and 2006’s “Casino Royale.”

“I heard a score [he wrote], ‘Young Americans,'” says Emmerich. “It blew me away, so I wrote to him and asked him to do my story. It’s one of the best scores of my movies, by far.”

The job couldn’t have come at a better time for Arnold. “I had an applied for a job in a shop renting videos out,” Arnold recalls via email interview, “I was mainly working on student movies for free and there wasn’t really any money left after paying for an orchestra for my first feature. So, any temp work I could get in-between I would do.”

Emmerich and Devlin had a long chat with Arnold at the start of the project about style and feel of the score. But they basically left him alone. “I’d sent them theme ideas and I think they felt that I was heading in the right direction. Their films were painted very large and demanded a spectacular score to match what we were being a lot of. There’s a lot of freedom in fantasy. They trusted my instinct and didn’t tell me what to do, only what to try to make me feel.”

Once “Stargate” hit theaters, reviews for the film were decidedly mixed. One of the most scathing came from Roger Ebert: “The movie ‘Ed Wood,’ about the worst director of all time, was made to prepare us for ‘Stargate.'” He gave the film one star.

“He was not a big fan of mine,” says Devlin.

Writer-producer Steven Jay Rubin, author of “The Twilight Zone Encyclopedia,” believes “Stargate” is one of the most imaginative science fiction films of the 1990s. “It just soared in terms of its atmosphere and dynamism. I really loved it. I think David Arnold’s music was very much a part of it and gave the story majesty and elevated it.”

Though “Stargate” proved to have legs with the creation of “Stargate SG-1,” MGM didn’t want Emmerich and Devlin involved in the TV series “and basically took it from us. They said we hadn’t done TV and they wanted to bring TV guys in,” Devlin says.

“So, for many years, I was really angry about the series and wouldn’t watch it. The irony is that after many years of being upset about it, I finally made my peace with it.”

He also became good friends with Jonathan Glassner, who was one of the creators and executive producers of the series. “He and I are doing a TV series together called ‘The Outpost.'”

Devlin and Emmerich had originally envisioned “Stargate” as a trilogy. “We tried to get it going a couple of years ago,” Devlin says, “Just before we did the ‘Independence Day’ sequel, but afterwards, it kind of fell apart. Honestly, I’m so much happier working independently. That’s how we did the first movie. I am not really anxious to go work in a studio again. So, I think that may have also been a factor in why it fell apart.”

Matt Donnelly contributed to this story.