Andy Weir, author of the wildly popular sci-fi novel "The Martian," is living the publishing dream.

It didn't start out that way though. "The Martian" began as a series of self-published chapters on Weir's personal blog.

Then Weir decided to put the book on Amazon, selling it for the website's lowest possible price ($0.99).

And that's when things snowballed.

It topped Amazon's bestselling list of science fiction. Then it debuted at the number 12 spot on The New York Times bestseller list for hardcover fiction books. Right now it's number one for paperback trade fiction. Ridley Scott is directing the film adaptation starring Matt Damon.

More science than fiction

In a nutshell, "The Martian" is the story of astronaut Mark Watney who gets stranded on Mars when his crew is forced to leave without him. What sets this book apart from others though, and what arguably gave it it's Cinderella success story, is that Weir threads the entire plot with real science.

All the tech in the story is modeled after rockets, spacesuits, and other space travel tech that already exists, and the main character Watney has to rely on real science again and again to keep himself alive. It's a science fiction story that could actually happen in real life.

It makes sense that "The Martian" is jam-packed with science since Weir is a self-described lifetime space nerd. He's the kind of person who enjoys researching rocket technology, orbital mechanics, and physics for fun.

His earlier attempts at writing pretty much flopped, but "The Martian" took off, partly because it captures Weir's enthusiasm for science and space exploration.

Creating such a science-heavy plot was a risky move on Weir's part.

"I was afraid it was going to read like a Wikipedia article if I didn’t make it really interesting," Weir said during a discussion of "The Martian" at the recent Humans to Mars Summit in Washington D.C..

You only need to get a couple pages into "The Martian" before it becomes clear that Weir did exhaustive research. But he weaves the heavy science into a gripping plot line with a funny, smart aleck main character (who Weir says is modeled after his own personality). It strikes a perfect balance between science and fiction, and the fast-paced plot makes it hard to put down.

Sudden success

In 2009, Weir started posting the story chapter by chapter on his personal blog where anyone could read it for free. The early version of his self-published book attracted a lot of science-minded readers, and they offered feedback.

Weir is a space nerd, but he says chemistry is not his area of expertise.

"Chemists actually pointed out some problems in early drafts," Weir said. He was able to go back and correct some of the chemistry that's crucial for Watney's survival.

Word of the book spread, and readers started asking for an e-reader copy. So Weir made all the individual chapters available in one file. Some had trouble downloading it though, so Weir put it on Amazon via Kindle Direct Publishing.

That's when the floodgates opened. More people downloaded the 99-cent Amazon version than had ever downloaded the free version, Weir said, and readers started leaving positive reviews on Amazon. In just a few months it skyrocketed to the top of Amazon's best-selling science fiction list.

So a book agent got in touch with Weir. Shortly after that, the publishing company Random House called — it wanted to publish a hardcover.

Four days later, Hollywood called for the movie rights, Weir said.

So yes, he scored a book contract and a movie contract in the same week — both in the low to mid six figures, The Washington Post reports.

"In fact, it was such a sudden launch into the big leagues that I literally had a difficult time believing it," Weir said in an interview on his site. "I actually worried it could all be an elaborate scam. So I guess that was my first reaction: "Is this really happening?'"

Now he's living the space-nerd dream, too. Since the book's sudden success, Weir has toured the Jet Propulsion Lab and spent a week at NASA's Johnson Space Center where he got to meet NASA scientists and astronauts.

Weir says he is not heavily involved with the film adaptation.

"My job was basically to cash the check," Weir joked.

However, the writers did send a Weir an early copy of the screenplay and invited him to send notes.

So far it looks like the movie is going to keep the science as an integral part of the plot. NASA has consulted on the film, and the European Space Agency has been on the film set. And after all, in the movie trailer Watney (Matt Damon) says, "I'm going to have to science the shit out of this."

Weir sounds optimistic about the movie adaptation, too.

"I think it could spur interest in Mars exploration because we haven't had a lot of movies that have portrayed space travel accurately," Weir said.

The movie comes out October 2. Here's the trailer: