Author Andy Weir is a former computer programmer who started working on a book idea in 2009 about an astronaut stranded on Mars. Six years later he’s a full-time author with a pretty crackin’ film adaptation of that book headed to theaters. We chatted with him about science-ing the shit out of the whole experience.

Inverse: You serialized the book on your website way before you published it as a novel. What made you think this would be a good idea for a book?

Andy Weir: I started out by thinking about how to do a manned mission to Mars with current technology. It wasn’t for book purposes — just speculating sitting on my couch. I came up with how to get the crew there and all the details of the mission. It was just a dorky thought experiment, and I was like, OK, any mission plan needs to account for failures. What happens if this thing breaks? You don’t want the crew to die, so what’s the backup? What if these two things break? In that case well maybe the crew could switch over to this mode, and so on.

So it was all of these types of scenarios I was going over in my head. I suddenly realized the increasingly desperate things he would need to do to stay alive if enough of this stuff broke would make a good story. So I made an unfortunate main character named Mark Watney and subjected him to all of it.

A big emphasis of The Martian is how realistic and technical the science is. Why did you want to tell the story from that approach? Were you ever tempted to throw in any overtly fictional, fanciful details — the science fiction over the science fact?

I really tried to avoid that. I had to in a few places for narrative purposes. For starters, a Martian sandstorm doesn’t cause that much damage. It can’t. The atmosphere is too thin. And I knew that at the time that I wrote it, but it was a deliberate concession for dramatic purposes. I had an alternate beginning in mind where they’re doing an MAV (Mars Ascent Vehicle) engine test and something blows up and it causes all the problems. But it just wasn’t as interesting. It wasn’t as cool. In a man versus nature story I wanted nature to get the upper hand.

What books or survival stories inspired The Martian?

Obviously Robinson Crusoe is the canonical man-stranded-alone type thing. But I was more inspired by Apollo 13, especially that one scene where they have to make the lunar module CO2 system work with the command module’s filters. It was just that scene where they’re kinda of like, “Put a bag in, put a hose here, stuff it back in this hole,” I mean I just loved it. I loved that kind of extremely resourceful problem solving stuff, and I wanted to make a whole book of it.

How difficult was it to propel the narrative of the book with real science without dumbing it down?

The challenge was in exposition. It was hard because I didn’t want to do hand-wavy science, but that means that most of the problems Mark has are caused by these details of science that people don’t know. So there had to be a lot of exposition for the reader to understand what was going on. That was a fine line. I had to give them the information but I had to resist the urge to wander off and tell them all sorts of extra crap because this stuff is really interesting to me and maybe not so interesting to the reader.

I had to be careful on that, and I also had to tell it in a way such that it didn’t read like a Wikipedia page. That’s why I end up with a smartass first-person narrator so that every few paragraphs there’s a joke to keep you interested as the exposition goes by.

It’s great the way you incorporate the epistolary form with Mark telling you his story in the form of ship’s logs.

Yeah, and I mean I didn’t invent that [laughs].

No but it works with what you were saying, and they transitioned it nicely to Matt Damon speaking to GoPro camera-type logs in the movie.

Yeah, it’s great in the movie.

There is no real villain in The Martian. The villain is ostensibly the limit of Mark’s ingenuity.

Well, the villain is Mars.

Sure, well was it difficult to create a narrative without a personified central antagonist in this case?

It’s 100 percent man versus nature. You see that in Gravity for instance. In that case it’s woman versus nature. In these stories the antagonist is the situation.

I mentioned before how you initially serialized chapters of The Martian on your website, posting one every six or eight weeks, and you wrote the whole thing over a few years. Did you not have all of the scientific research mapped out beforehand or did you take deep scientific dives while writing each chunk of the story?

That’s correct, I wrote the story and made it up as I went along.

In that case what was the ratio of time researching the complex science versus what ended up in the book?

I probably spent about half my time researching over three years. But that stuff is fun to me, I like that part. It’s how the whole project started — me just sitting around speculating. The hardest part for me was just sitting down and writing, but I think that’s the hard part for every writer.

If I’m correct, you primarily did all your research through Google searches and didn’t have any help from people in the aerospace industry, correct?

Yeah, that’s true for the whole book. It’s basically because I didn’t know anyone in aerospace. I do now! But at the time I wrote it I didn’t know anyone in the field at all so I didn’t have anybody to ask. Just Google.

Even though you didn’t know anyone in aerospace when you wrote the book, well-informed people or perhaps people involved with NASA would give you feedback to fine-tune as you went long. How vital was that in making the story what it is today?

Mostly it served as great fact-checking, so they gave me great feedback. I had a bunch of scientifically minded — that means dorks — readers on my mailing list like me. They would point out when I had errors, like if I made a mistake related to chemistry then one of the chemists would email me and say, “Nope, you got that wrong,” or if I made a mistake related to physics then a physicist would email me saying the same thing, and so on.

They were great fact-checkers. As for plot, their feedback mattered to me because I could see what they did and didn’t like.

Was there anything specifically in the book that you had to go back and change because of feedback?

One of the biggest ones is that at one point he accidentally generates a bunch of loose elemental hydrogen in the Hab [the “habitat” that the main character survives in], and it mixes in with the air. In the original version the hydrogen went up towards the top of the Hab and so there was this layer of hydrogen in the dome. He had to go up with a ladder and had to try and burn it off.

But in reality that’s not how gasses work. Gasses uniformly distribute. They don’t separate by density like oil and water, they distribute evenly. So I had to rewrite that scene after a chemist told me like, “Yeah, gasses don’t work that way.”

As far as you know have any of the basic science concepts that drive the story changed since you wrote the book?

A couple of things, actually. There’s been a lot of discoveries about Mars in the last few years that we didn’t know before. One thing is that Mars has a huge amount of water. We only found that out just recently. After I finished the book the Curiosity rover discovered that for every cubic meter of Martian soil there’s about 35 liters of water ice in it. So that’s really phenomenal, it’s plenty of water, but that means the whole scene where Mark’s doing this stuff to generate water is just kind of needlessly complex. He could have just grabbed dirt and heated it up.

Well that’s unfortunate.

Nah, it’s not unfortunate, I love it! People don’t realize how rapid information comes in about Mars. They think like, “Oh Mars, it’s just this planet and we know all about it.” No, no, the amount of information is incredible. Six years ago we didn’t know there was that much water on Mars. We wondered if there was that much water.

I guess it’s bittersweet in a way then. So was there any heavily-researched science you wanted to include in the book but left out?

Way too much stuff [laughs]. I could spend an entire book about the ion engines that propel the Hermes [the ship used by the crew in the story]. But I don’t think people would be interested in that kind of stuff as much as me.

Weir (bottom left) at the World Premiere of 'The Martian' at the Toronto International Film Festival.

You had a relatively hands-off approach when it came to the movie. As a writer — especially one whose book had such an unorthodox path to the big screen — how difficult was it to give up your baby, essentially?

It wasn’t hard at all because the screenwriter, Drew Goddard, was deeply engaged with me while he worked on the script. He would call me pretty much everyday and ask questions constantly. I had no authority, of course, but I got to watch the screenplay come together, and when it was done he sent me revisions of it to get feedback. There was never really a point where I was nervously waiting around about how things would be.

[Director] Ridley Scott also tends to stick to the screenplay he’s given. He doesn’t often make changes because he’s like “I’m the director, let me direct, and I’ll let the writer write.” The only time he wants changes is when he has the opportunity to make something look visually stunning. That’s when he makes minor changes. Other than that he’ll stick to the script.

I never really had an angst because I was able to watch the sausage being made.

Were you surprised at the speed with which you went from publishing the book to having a film in development?

Yeah, definitely. And I’ve been told repeatedly by everyone in the industry ever that it never goes this smoothly. They’re like, “Movie production doesn’t work like this. We don’t know why everything lined up like it did. It’s a miracle.”

Definitely. Since studios actually make movies out of a very small percentage of the books they option why do you think The Martian was one of the ones that made it to the big screen?

A lot of it is just luck and timing. I had written The Martian before I had ever even heard of Gravity. But then while they were considering whether or not to make The Martian into a movie Gravity came out and it was a huge success. So I think they were like, “Well I guess people do like technically accurate sci-fi.”

But the main thing is that Matt Damon and Ridley Scott were interested in being involved. That put two huge names on the film together, and it definitely made the studio want to do it. Once you have something like that with big name actors and actresses, a well-managed budget, and Ridley Scott involved it makes it easy.

Matt Damon reading a copy of "The Martian' between takes of shooting the film adaptation.

Did you have anybody — an actor, real person, or a fictional character — in mind when creating Mark Watney?

No, actually. Whenever I’m writing my main characters tend to be sort of a blob of protagonist. I don’t ever have a strong visual sense of what they look like. When I finished the book I couldn’t have told you what color Mark’s hair was. I just don’t get visual when I’m writing, but it’s weird because I do when I’m reading a book.

Obviously the main point of a story like this is to entertain, but it’s so science positive. Do you hope your story could play a small part in promoting the potential for manned space missions to Mars even without an explicit agenda?

I think it’s great if it has that effect. I always want to stress that I never have a point or a goal in my writing other than to entertain the reader. I hate it when books are preaching at me, so I don’t preach at my readers, just entertain them. But if it has a side effect of helping out the space program, then that’s fantastic.