Andy Weir's new science fiction thriller, The Martian, somehow tells a pulse-pounding, page-turning story grounded in scientific research and information that'll make any reader feel smart upon finishing. Weir tells us how he did it and offers some advice.

Thanks to our modern era, facts are incredibly easy to come by. A few web searches for your subject matter and you have all the information you could dream of. You don’t have to schlep down to the library anymore or try to track down a university professor who can answer your more obscure questions. Between Google and Wikipedia, 99% of the world’s knowledge is at your fingertips.

So that makes researching a novel easy, right?

No. Not really. As I learned while working on The Martian.

The first problem you run into is the inherent unreliability of information on the internet. A lot of it is inaccurate, most of it is slanted, and some of it is deliberately misleading. Mars’s atmosphere is 0.6% the pressure of Earth’s. But when I first looked it up, I found a website that massively approximated that value to “1%”. Doesn’t seem like much, but I mention that tidbit about twenty times throughout the book. I eventually found out and corrected it, but it served as a stern warning to me: Make sure the information comes from a reliable source. And as any journalist knows, a fact’s not a fact unless you can corroborate it independently.

But there’s more to research than just looking up facts. Eventually you have to make subjective calls. If you’re writing a science fiction novel, there’s probably some speculative technology in it. You’ll have to decide how to project existing technology forward in a plausible way. But this is where being a writer comes in. I decided my characters would get to Mars on a ship powered by ion engines. Ion engine technology is in its infancy, so I got to decide how it would progress. I figured a reactor aboard the ship would provide the necessary energy, and it’s reasonable for the future-versions of those engines to be magnitudes more powerful than the current ones. Poof! They have ion engines. Being a writer is fun.

The next thing to know is when to say when. If you look up every last detail on your subject, you’ll never finish. I fell in to this trap while researching the Pathfinder Mars probe. I wanted to know some details about its construction and the next thing I knew I was pouring through obscure documents to find the boot sequence for its operating system. There’s a point at which you have to stop researching and start making things up. You are a writer, after all. Making stuff up is your job.

Eventually, while researching, you’ll learn something you didn’t want to know. Some fact that ruins a plotline you had in mind. The good news is that sometimes, learning all the facts can make for a much more interesting story than you originally had in mind.

For instance: My protagonist is stranded on Mars in a small temporary base and has to figure out how to survive for years. He has a few potatoes from his rations, so he decides to farm them inside the base. I figured he could bring Martian soil inside, then plant potatoes in it. But to do that, he needed water—and after some research, I learned that the soil where he was had almost no water in it. This led to a subplot where he had to manufacture water from materials he had on hand. And that subplot ended up becoming one of the pivotal points of the book.

This is a secret I stumbled in to. Research informs the story. At times, it almost feels like cheating. You do a few Google searches and a little math and suddenly plot comes out of nowhere. The things that ruin your ideas end up making you come up with even better ones.

Once you’ve done all the research, you move on to a much more difficult task: Informing readers without deluging them with information. You put hundreds of hours into that research and you’re incredibly proud that you came up with a story that matches all the known facts. Deep down, you really want to brag about that. You want the reader to be blown away by how much you’ve learned. You have to resist that urge. Save the bragging for when you’re writing an essay like this one—where I can’t resist telling you that for The Martian, I worked out my Mars missions’ orbital paths and necessary launch dates. It took me literally a week of hard work and I had to write my own custom software for it. But the only thing the reader saw of all that labor was “It took 124 days to get from Earth to Mars”.

That’s the trick. Identifying what should and should not be the story. To you, it’s all fascinating. It’s a subject that’s enthralling to you. Otherwise, you wouldn’t be writing a book about it. But to the reader, it can become pointless trivia and an exercise in boredom. Make sure you’re looking at the story from the reader’s point of view. Not just what you would want to read, but what the layman would want.

The truth is, research is just as subjective, creative, and difficult as every other aspect of writing, even though—if you’ve done it right—the end result should feel simple, inevitable, and indisputable. Your readers should never know it’s actually the result of complex, sometimes arbitrary choices and compromises taking place behind the curtain. And if you’re lucky, they’ll never even pause to think about it at all.

ANDY WEIR was first hired as a programmer for a national laboratory at age fifteen and has been working as a software engineer ever since. He is also a lifelong space nerd and a devoted hobbyist of subjects like relativistic physics, orbital mechanics, and the history of manned spaceflight. His first novel, The Martian, was just released by Crown.