THE screenplay for The Martian, in which an astronaut is accidentally left stranded on Mars, is based on the novel by former computer programmer, Andy Weir. Initially it existed as online series, then as an ebook before its hardcover publication in 2014. Meticulously researched and packed with science and maths, he'd intended it to be "a technical book for technical people. I had no idea mainstream readers would be interested, let alone like it". He based the protagonist Mark Watney on "my own personality, though he's smarter and braver than I am, and doesn't have my flaws. I guess he's what I wish I was like. He's Matt Damon."

The producer Simon Kinberg, who'd worked with Matt Damon on 2013's Elysium, sent the script to the star on a Friday and received an enthusiastic response by the Sunday. "Matt responded to the story in the same manner the studio and I did," notes Kinberg. "He thought it was original, funny, exciting, and with a uniquely different take on a survival story."

The film was originally going to be directed by Drew Goddard, who had successfully adapted the book with its rigorous scientific and mathematical problem-solving, numerous characters and layered storylines, but the scheduling reportedly didn't work out, which left the director's chair empty.

When another project was delayed, Ridley Scott, the man behind Alien and Blade Runner, became available, and the script was immediately sent to him. "I was fascinated by the near impossibility of Watney's task and the team effort required, not only from NASA, but also international partners," notes Scott, aged 77. "This is the ultimate survival story. Mark Watney's placed under unimaginable duress and isolation, and the movie is how he responds. His fate will be determined by whether he succumbs to panic and despair and accepts death as inevitable, or chooses to rely on his training, resourcefulness and sense of humour to stay calm and solve problems."

The two-time Oscar nominee Jessica Chastain appeared as a brilliant scientist in Christopher Nolan's epic Interstellar, but admits she was a little jealous to see her co-stars Matthew McConaughey and Anne Hathaway in their spacesuits. "I was like, 'Wow, they look like they're having so much fun in that zero gravity' and then a week after the release, I got a call to say Ridley Scott is making a movie and the role was to play an astronaut," recalls the 38-year-old, who plays Commander Melissa Lewis. "I thought, 'First of all, you're going to do a Ridley Scott film, awesome'. But a Ridley Scott sci-fi film? It makes it even better."

Despite her commanding performances on screen, Chastain doesn't consider herself a natural-born leader and reveals she based a lot of her character on astronaut-chemist Tracy Caldwell Dyson, a mission specialist on Space Shuttle Endeavour in August 2007, and part of the Expedition 24 crew on the International Space Station in 2010.

"She really had this very cool, mellow way of being and it made sense that this is how Melissa Lewis would be," explains Chastain, who has no desire to explore space herself. "It's fun to say in your imagination, 'Sure, I'd love to do that', but when you see how much goes into it, I'm not capable, and there are people with far greater talents for space travel than I have."

Chiwetel Ejiofor, who was Oscar nominated for his role in Twelve Years A Slave, worked with Scott on 2007's American Gangster but the 38-year-old, who plays NASA's director of Mars missions, admits, "Even though that experience was great, I was like, 'I wouldn't mind going into space with Ridley', so I was glad to get the chance to do it."

His co-star, Kristen Wiig, 42, who plays NASA's media relations director, does point out that technically-speaking, they "still didn't get to go — but we're getting there". They confess the scientific lingo was tough to get to grips with. "You have to at least look up what you're saying," says Wiig. "On Wikipedia, that's the research," adds Ejiofor.

Kate Mara, aged 32, who plays astronaut Beth Johanssen adds: "The most challenging part about the script was trying to get a good sense of what you are saying and what's going on, so you're not just saying words, you actually understand and believe it." But it was nothing compared to the physical exertion of wearing the hefty spacesuits. "The suit with the helmet was very heavy," she says of the ensemble, which had a combined weight of 40 pounds.

It was even trickier to manage during the sandstorm scene at the beginning of the movie. "We had all these wind turbines chucking dirt at us and you couldn't hear anything," adds Chastain.

Sci-fi movies are known for many things, but humour is not often one of them, which is why Ejiofor was taken aback when he read the screenplay. "I remember the first time I read it and you start off thinking, 'OK, Ridley Scott, The Martian, let's see', and then you catch yourself laughing and you realise there's a lot of humour here," he remarks. "And it's necessary humour, the tension is so high, the stress is so high and a lot of it comes from Mark Watney. Matt Damon is brilliant in this film and really captures that desperation and humour in a way that I thought was really honest and quite hard to achieve."