Writing perhaps the most anticipated superhero blockbuster ever would be a daunting task under any circumstance. But writing a movie that serves as the satisfying conclusion to not just a film that gave fans the most WTF cliffhanger of the previous year, but also to a series of 22 interconnected films seems nigh impossible. Yet screenwriters Christopher Markus and Stephen McFeely did it with Avengers: Endgame this year. And how did they do it? Well, according to them, it wasn’t easy.

Speaking with Jeff Goldsmith at San Diego Comic-Con's Hall H today, Markus and McFeely explained what it took to plot, write, rewrite, and film both Avengers: Infinity War and Avengers: Endgame as back-to-back productions for the history-making wrap-up of the Marvel Cinematic Universe. They also revealed some scrapped plans for the movies.

Christopher Markus and Stephen McFeely at SDCC 2019 (Photo by Don Kaye)

For example, they originally tried to put "Professor Hulk" in the third act of Infinity War, but it didn't work. Bruce Banner originally fused with Hulk, burst out of the Hulkbuster suit and started kicking ass, but it was the wrong tone for that moment in the movie. So, they had to redo that first scene in Endgame where viewers first meet the character eating breakfast.

Also in Infinity War, there was a deleted scene in which Doctor Strange sends Thanos through multiple universes in his mind. Thanos sees all his victims, and he's then dumped in front of the Livint Tribunal, who pronounce him guilty for all his crimes.

But introducing a multiverse also introduced a narrative problem. "If you tell people that there are 75 million other Tony Starks out there, then your drama suffers because the stakes are lower," Markus explained.

They also had one scenario in which Thanos went to Earth in 2014 and wiped out the Avengers. And they considered an idea early on about Captain America going to space and having to collaborate with Red Skull because Red Skull knows more about the Infinity Stones.

So, the third act of Endgame got a little complicated, if the writers' drawing board is anything to go by. (Photo by Don Kaye)

"Part of the challenge of this giant task was how do you tell everything you need to tell, weave it together and keep it light without bogging it all down?" Markus explained.

At some points, not surprisingly, the task became nearly insurmountable. In 2016 when they were working on the scripts, no one liked what they had.

"The Thor storyline sucked rocks,” said McFeely. “He had to go get the axe, but he was fighting a serpent."

"It was much too adventure related and not character based," Markus agreed.

"So Eritri and the Dyson sphere all came out of that panic," said McFeely.

But as daunting as the whole endeavor was, Marvel Studios and its president Kevin Feige kept a cool head throughout. According to Markus, Marvel itself never panics. Unlike most studios, they don't get a first draft and expect it to be a third draft.

"Kevin wants to make a good movie and doesn't want to hear you talking about box office or pressure. He just wants to talk about story,” said Markus. “So, he says, 'Just stick the landing.' … If that means cutting the Guardians, or shrinking it, then do it."

In fact, the movies were originally codenamed Mary Lou 1 & 2 in honor of Olympic gymnast Mary Lou Retton, who always said, "Stick the landing."

This led to McFeely showing convention attendees a video on his phone of Retton congratulating Feige and the Marvel executives when the picture opened, and definitely stuck its landing.

Click here for SYFY WIRE's full coverage of San Diego Comic-Con 2019, including up-to-the-minute news, exclusive interviews, and videos.