The software engineer turned novelist talks about his approach to writing and why he thinks getting the science right matters.

Video: Mars One candidate talks future tech for 2027 Mars mission Watch Now

Part of the joy of reading the 2014 bestselling novel The Martian lies in the detail.

Software engineer-turned-novelist Andy Weir chronicles the travails of stranded astronaut Mark Watney with such painstaking care, you really believe that botanist Watney could cultivate potatoes on Mars' inhospitable surface.

So it's little surprise that when Weir is asked if there was anything he would change about The Martian he mentions the Martian storm whose devastating winds leave Watney stricken at the start of the book.

"I would probably have the initial disaster be something else other than a sandstorm. That was the most scientifically inaccurate part of the book," he said.

Even though Mars has winds that can reach about 150mph, the density of the atmosphere is so low that gale force winds would likely feel like a gentle breeze. Weir says he has even thought of an alternate, more scientifically grounded opening.

"I now know that Mars has lightning. Maybe a lightning strike could start some sequence of events that leaves Mark stranded instead."

Image: Andy Weir / Penguin Random House

However, despite Weir being wrongfooted by the odd real-life scientific discovery since the book was written -- such as the presence of water in the Martian regolith making the extreme lengths Watney goes to synthesize water unnecessary -- in general he is known for going above and beyond to ground his stories in scientific reality.

SEE: 'Artemis': A thrilling space heist from 'The Martian' author

Part of what drew Weir to this hard-science style is a desire to write a book that he would want to read, but he has since recognized this approach has become his USP.

"I think I've carved a niche for myself in the accurate science fiction area, so I want to stick with it," he says.

"Plus there are just so many more interesting stories you can tell if you educate the reader a little bit on the science."

In his serious treatment of science, Weir is following in the footsteps of his favorite authors, the doyens of so-called hard sci-fi Robert Heinlein, Isaac Asimov and Arthur C. Clarke -- who Weir calls his "Holy Trinity of authors".

It's Weir's love of puzzling out hypothetical scientific challenges that provides him with the kernel of his novels. The Martian was born out of him analysing what it would take to mount a manned mission to Mars. Similarly Weir's latest novel Artemis -- a tale of shady dealings in the first lunar city -- sprang out of musings on just what would humanity's first off-world city look like.

"I wanted to write a book about mankind's first city that wasn't on Earth. And the moon is so convenient for colonization, I strongly believe it'll be the first off-Earth colonization we do," he said.

Weir began the book by giving serious thought as to why a city would be created on the moon, settling on it being a holiday destination for the wealthy, and how it would be built, deciding it would likely require smelting the mineral anorthite to extract aluminium and oxygen.

SEE: China and Europe's 'Moon village' could boost lunar mining, space tourism

While solving the scientific obstacles to building a city on the moon might seem like a ludicrously ambitious starting point for a novel, for Weir this science-fuelled brainstorming and world-building is the most enjoyable part of the writing process.

"It's easy," he says. "The research is the fun part for me. The hard part is character depth, interplay, and growth."

That love of problem-solving served Weir well in his previous career. Before his success with The Martian, Weir spent 20 years working as a software engineer, entering the profession aged 15 when he was hired by Sandia National Labs in Livermore.

While The Martian may have catapulted Weir to international fame, his isn't a story of overnight success, with Weir having endured enough knockbacks since writing his first novel in college to have even considered abandoning writing altogether.

"The Martian was the third book I wrote. I had already given up on getting published by then and was just treating it as a hobby."

For 10-years writing was something that Weir did as a hobby, writing short stories, web comics and serial fiction on his website. It was this site where The Martian would first appear as a serialized story, with Weir only publishing it as an ebook in 2011 due to complaints about how difficult his homemade site was to navigate.

The ebook climbed the bestsellers list on Kindle, attracting the attention of Penguin Random House, which would go on to publish the novel, and 20th Century Fox, which snapped up the film rights, and eventually leading to the critical and commercial success of the novel and Ridley Scott-directed film.

Due partly to enjoying his job and partly to the need to make money, Weir continued to work as a software engineer for longer than you might expect, recalling he was still sitting in a cubicle fixing software bugs while taking phone calls about publishing and film rights for The Martian.

While it's too early to tell if Artemis will repeat the success of The Martian, the book has already cracked The New York Times bestseller list and The Lego Movie directors Phil Lord and Chris Miller will direct a film adaptation.

Weir hopes that Artemis will be the first of several stories set in or around the lunar city.

"I want to make lots of stories that all take place in that same setting. I'd like it to be my personal sandbox," he says, adding he'd also "love to see a [TV] series or miniseries made out of one of my novels".

Beyond his personal ambitions, Weir is excited that the future he writes about is on the cusp of becoming a reality. He believes humanity is on the verge of a long overdue renaissance in space travel, one that could open the doors to tourists.

"I'm very hopeful. I think that we are finally moving forward again after decades of little to no progress," he says.

"I'm most excited by the lower and lower booster costs. Once that price point drops low enough that middle class people can afford to go into space, we'll have a new industry born, and space travel will really take off."

And while Weir might not get to see an Artemis-style lunar city become a reality, he believes the world's first lunar colonists have already been born.

"There are people alive today who will see the year 2100. I'm sure we'll have some commercial and/or tourist ventures to the moon by then."

Innovation Newsletter Be in the know about smart cities, AI, Internet of Things, VR, AR, robotics, drones, autonomous driving, and more of the coolest tech innovations. Delivered Wednesdays and Fridays Sign up today

Read more