One day last May, James Green was in the cafeteria at NASA headquarters eating lunch when he was called out of the room by a public affairs official who had been scouring the building for him. “Can you talk to Ridley Scott today at 2 p.m.?” he asked Green.

After a moment of disbelief (“I said, ‘The Ridley Scott?!’”), Green, director of NASA’s Planetary Sciences Division, didn’t hesitate. “One of my all-time favorite movies is Alien. I think I’ve seen it 50 times,” he tells mental_floss. “I said, ‘Yes! I’ll clear my calendar!’”

Scott wanted to talk because he was directing the movie adaptation of Andy Weir’s book The Martian, in theaters today. In the film, an astronaut from a manned mission to Mars is left behind by his crewmates, who believe he's been killed in a brutal storm. But the astronaut, Mark Watney (played by Matt Damon), is very much alive—and he needs to figure out how to survive on an inhospitable planet using nothing but science and his own ingenuity.

Weir, a computer programmer who had initially self-published the book in several installments on his website over the course of three years, had really done his research on everything from planetary science to botany to physics. Helpful readers had fact-checked him to make The Martian, which was published as a complete novel in 2014, even more accurate. Scott, too, wanted to make sure his film was as accurate as possible. And to do that, he needed NASA's help. 

Green hadn’t read The Martian, but he jumped on a call with Scott and a few members of the director's team for an hour and a half. “He wanted to know what NASA was doing in developing habitats, and what our vehicles look like, so that he could model what the look and feel of the movie was all about based on what we’re really doing,” Green says. 

By the end of their phone call, Green had only answered about half of Scott’s questions, so he decided to set up tours for Scott’s team, where he could answer the rest. Meanwhile, Green read The Martian, which he loved. “When I went back to NASA headquarters on Monday,” he recalls, “I said, ‘This is a great book and we ought to help them do what I think they want to do, which is paint a picture of Mars that’s realistic.’ I was all in.”

Green set the date of the tours for early June. Though Scott couldn’t make it, one of the director’s longtime collaborators, production designer Arthur Max (who has worked with Scott on Gladiator, Black Hawk Down, Kingdom of Heaven, Robin Hood, and Prometheus, among others), made the journey to NASA’s Johnson Space Center and the Jet Propulsion Laboratory. Max examined the habitats and rovers the space agency is building, walked through a mock-up of the International Space Station (ISS), and chatted about how to grow plants in inhospitable places. “Art took, like, 2000 pictures,” Green says. “He was clicking the camera the whole day long.”

Beyond tours, NASA gave the filmmakers hundreds of photos—of Mars, of what's on a screen when scientists are commanding a satellite orbiting the planet, and of the layout of the control center. Green weighed in on what the Hermes—the spacecraft used by the Ares III crew in the film to travel between Mars and Earth—would look like. (The filmmakers went through two versions before settling on a third, which uses ion engines to get to our red neighbor.) He also read the script, jotting down notes and comments that he went over with Max when he came to NASA. Most of Green's comments “were really all about how to make the movie use some of the latest information about Mars,” he says. In most cases, though, the filmmakers decided to stick with what was in the book, which was fine with Green: “It’s cleaner. It’s easier. It is something they can fall back on,” he says.

One of the film's most pivotal scenes—the storm that strands Watney on Mars—looks different because of Green's suggestion that the filmmakers add in some lightning. Though the planet does get “gnarly-looking dust storms,” Green says, the storm in The Martian is very unrealistic: The planet doesn't have enough atmosphere to create something that severe, so Weir gave himself some dramatic leeway. In reality, by the time they blow over anybody standing on the ground, it’s very fine talcum powder-like dust that blocks out the light,” Green says. “Some of these dust storms can get very high—20 and 30 kilometers high—and they can be charged, and that charge produces an opportunity for lightning. So we have seen dust storms go by and then lightning strikes on the ground.”

Green suggested the lightning not because he thought it would be cool to see it in the film, but because it would be more realistic to have lightning strike things than to have the wind blow them over. In the end, the filmmakers added lightning strikes, but still had ferocious and unrealistic winds knock things over. 

Earlier this week, after NASA announced the discovery of liquid water on Mars, Scott told The New York Times that he had found out about the water two months ago, when there wasn't time to incorporate the discovery into the movie. But if he’d had more time between the publication of the discovery and The Martian's release, Watney “would’ve gone and dug in … He’d’ve found the edge of a glacier, definitely.” 

“He may have said [that],” Green says, “but I know exactly what he would do: He’d say ‘Go back to the book,’ and I think that is the right thing to do, because the film represents a very nice piece of science fiction that very well may become a classic in the future.” (And for what it’s worth, according to Green, the crew of the Ares III would have been on Mars in November—“the dead of winter” on the planet—and, although there’s a glacier near the site, it would be exactly the wrong season to try to get water from it.)

Twentieth Century Fox

The Martian takes place in 2035, which is just a few years before NASA actually plans to have boots on the red planet (they’re aiming for the 2040s). And there are still plenty of challenges to meet before we can make it there.

Close to the top of the pile is picking where, exactly, humans should land. “We have a list of requirements for both humans and science,” Green explains. We turned those loose to the international science community, and we said, ‘Where on Mars can you do all this?’” So far, the team has come up with 52 sites; they'll be reviewed and prioritized at an international workshop at the end of this month, “and then we’re going to go and get high-resolution imaging and data to support going to each and every one of those,” Green says.  

Next, scientists and engineers have to create a Mars ascent vehicle [PDF], which isn't as difficult as one might assume. “We develop rockets all the time, Green says, and this vehicle will be nowhere near as big as some of the stuff that we launch, so it’s going to be relatively easy to do.” 

What is hard is landing a vehicle laden with cargo. “We’re developing a series of techniques to be able to land on the surface of Mars, 10 tons at a crack,” Green says. “For us to be able to support a habitat, we think we’re going to need about 40 tons worth of material down on the surface.”

Green says they’re working on that technology now, and although they haven’t seen “any showstoppers,” he says that it’s just “a matter of designing them and implementing, testing and then trying them. We’re on the path.”

Twentieth Century Fox

Green had a blast working on The Martian, and says the filmmakers nailed everything from the scenery on Mars to the science of Watney’s survival to the interactions between NASA employees on Earth. He’s particularly excited that the film shows the public what NASA is really doing. “We are funded by the public,” he says. “It’s important to us that they see we’re making major progress in planetary science.”

Though the film is science fiction, he hopes that it will inspire kids to become more interested in science and engineering. “Science fiction is part of our culture,” Green says. “It allows us to create thoughts about the future and then helps sometimes guide us there, and the movie is really all about that.” 

And when humans finally do make it to Mars, Green says he’ll have The Martian on his mind: “When they step foot on the planet, I will think of the movie. In fact, when they step foot on the planet I will probably pull the movie out of the cloud—because DVDs won’t exist then—and I’ll watch it again and enjoy it.”