(Note: This article contains spoilers regarding the fate of certain Marvel characters.)
Poised to become the highest-grossing movie of all time, Avengers: Endgame is a tough act to follow, but the Marvel Cinematic Universe staged a show-stopping encore this month when Spider-Man: Far From Home pulled in $847 million worldwide during its first two weeks of release.
Defying so-called "franchise fatigue" besetting other sequels, this superhero-as-tourist spectacle, produced in an unusual partnership between Disney-based Marvel Studios and Sony/Columbia Pictures, picks up where Endgame left off: Spider-Man discovers that his mentor, the dearly departed Tony "Iron Man" Stark (Robert Downey, Jr.), has bequeathed him access to powerful monster-fighting technologies. In a now-customary Marvel move, Far From Home uses its end-credits sequence to kick the saga forward, setting up a third Tom Holland-as-Spider-Man movie via a plot twist engineered by villainous Mysterio (Jake Gyllenhaal).
Far From Home co-writers Chris McKenna and Erik Sommers, who previously penned Ant-Man and the Wasp and Spider-Man: Homecoming for Marvel, took pains to stitch Peter Parker's journey into the firmament of MCU movies past and future. "When we start on a movie like this, the folks at Marvel have typically assembled a document and discussed internally, what they'd like to see, what bills need to be paid from the previous films and what needs to be set up," Sommers told Fortune.
In the case of Far From Home, MCU continuity centered on two through-lines, according to McKenna. "The relationship between Peter Parker and Tony Stark had been built over several movies so there was no question in anyone's mind that this movie had to deal with the aftermath of losing Tony and how that [death] would affect Peter Parker. That's why Iron Man looms so large over this story."
McKenna and Sommers, former TV comedy scribes, also used gruff Nick Fury (Samuel L. Jackson) as fish-out-of-water comic relief to leaven the heavier dramatic beats. A fixture in the Marvel Cinematic Universe, the S.H.I.E.L.D. leader also figures in a surprise end-credits reveal that hints at further Avengers adventures.
"Audiences love Nick Fury and we love Nick Fury so we were excited to put him in Far From Home," Sommers says. "He really sort of grounds things and lets you know you're in an MCU movie."
Far From Home draws the curtain on "Phase 3"of Marvel Studios' master plan. Twenty-three movies into its mega-narrative tracking the Avengers superhero team, the Marvel Cinematic Universe shows no signs of contracting.
For "Phase 4," Marvel Studios President Kevin Feige envisions a steady stream of pictures inspired by Marvel characters both famous and obscure. "Setting a five-year path has been very beneficial to us from the beginning," Feige told the Los Angeles Times. "We've been working on [Phase 4] for the last four years… developing… the next group of films and looking to continue to surprise fans and bring characters to the screen … that people, unless they're really hardcore comic fans, may not have heard of."
Among the fresh franchise faces: The Eternals. Directed by Chinese filmmaker Chloé Zhao (The Rider) and starring Angelina Jolie, the film will introduce a secret race of immortal beings. Further down the road, martial arts project Shang-Chi, based on the 1974-1983 "Master of Kung Fu" comics, is reportedly being developed with Chinese-American writer David Callaham and director Destin Daniel Cretton (Short Term 12).
Marvel, expected to announce "Phase 4" details on Saturday at San Diego Comic-Con, continues to diversify the white guys-in-tights formula that dominated the 1960s and ‘70s comic book stories created by the late Stan Lee and his collaborators. Black Panther 2, following on Oscar-nominated blockbuster Black Panther ($1.3 billion), reunites Chadwick Boseman as Wakanda King T'Challa with director Ryan Coogler. Brie Larson will likely return as action hero Carol Danvers in a sequel to this year’s Captain Marvel ($1.1 billion worldwide). Black Widow, filming in Europe this summer, will somehow resuscitate Scarlett Johansson's Natasha Romanoff, as a standalone feature from Australian director Cate Shortland (Berlin Syndrome).
Also in the pipeline are Guardians of the Galaxy 3, again helmed by director James Gunn (following his apology for offensive tweets made in 2009 and 2010), and Doctor Strange 2 starring Benedict Cumberbatch.
Screenwriter Zack Stentz, who experienced Marvel Studios' holistic storytelling methodology firsthand when he wrote 2011 movie Thor, likens the MCU to "an incredibly expensive television show that drops two to three episodes a year." Stentz, whose credits also include TV's Fringe, told Fortune: "Feige is like the visionary showrunner who gives individual directors a lot of leeway over their own entries. That's how you can have a Cold War spy thriller like Winter Soldier and a big goofy tribute to Flash Gordon like Thor: Ragnarok existing side by side in the same universe.”
Marvel’s massive movie empire took some time to build. Feige's predecessor, Israeli-born toy designer Avi Arad, spearheaded Marvel's invasion of Hollywood after his boss Ike Perlmutter's Toy Biz company acquired the superhero assets in 1998 from a bankrupt Marvel Comics.
Arad, who'd obsessed over Marvel Comics as a kid, was convinced the characters he'd packaged as action figures deserved to be movie stars. Studios initially snubbed his pitches but in 2000, Arad finally persuaded Fox to make X-Men. Two years later, Sony produced the first Spider-Man. Suddenly, Marvel characters had heat in the form of standalone films from disparate studios including Universal Studios, which in 2003 and 2008 distributed two completely different takes on the Incredible Hulk featuring, respectively, Eric Bana and Edward Norton.
Arad's piecemeal deal-making gave way to a more cohesive approach when Feige stepped up to produce 2008's Iron Man. The inter-connections seen in MCU movies since then have been meticulously mapped out by Feige and his team at Marvel Studios, created after Disney purchased Marvel Entertainment in 2009 for $4.24 billion.
Meanwhile, the Marvel Comics-based X-Men franchise—and related titles—have operated separately under the Fox umbrella, disconnectedfrom Marvel/Disney-incubated storylines. Wade Wilson, for example, played by Ryan Reynolds, anchored R-rated Deadpool and Deadpool 2 to the tune of nearly $1.6 billion in the worldwide box office. But in April, Fox-produced X-Men movie Dark Phoenix fizzled at the box office ($249 million worldwide). Now that 21st Century Fox has been acquired by Disney, will X-Men mutants be joining the Marvel Cinematic Universe any time soon?
Don't hold your breath.
Marvel boss Feige said in an interview with io9: "The five-year plan that we’ve been working on, we were working on before any of that [acquisition] was set. For us, it’s less about specifics of when and where [the X-Men will appear] right now and more just the comfort factor and how nice it is that they’re home. That they’re all back. But it will be a very long time."
Thor writer Stentz, who also scripted X-Men: First Class, predicts that the X-Men franchise will at some point get a "hard reboot" recast with entirely new actors. "To my mind," he says, "The biggest challenge of integrating the X-Men into the Marvel Cinematic Universe is simply that the X-Men are defined by being outsiders, hated and feared, whereas in the MCU, people with superpowers are our friends who rescue us from aliens. It'll be interesting to see how they reconcile a world that likes superheroes with a world where mutants are persecuted as outsiders. But… I have no doubt [Feige] will figure out a way."
With or without X-Men, Marvel's superhero industrial complex clearly has plenty of comic book-based fuel to galvanize moviegoers for the next few years—as long as each movie excels on its own merits. As Far From Home co-writer Sommers observes, "I don't think Marvel ever wants to throw things into a movie just for the sake of connectivity. If some element is fighting the story, they're not going to sacrifice the movie for the sake of the overall whole. Marvel always wants to tell the best story they can. That's the priority."
More must-read stories from Fortune:
—The key surprises and takeaways from this year's Emmy nominations
—After two years, Netflix re-edits controversial 13 Reasons Why scene
—Listen to our new audio briefing, Fortune 500 Daily
Follow Fortune on Flipboard to stay up-to-date on the latest news and analysis.