Andy Weir owns a house in Massachusetts, he said, which he rents out, but lives in a condo he rents from a friend in Mountain View.

“For what I pay to live in the Bay Area,” he said during a phone interview on July 20, “I could have a really nice house in Nebraska. But I don”t have any friends in Nebraska.

“I ended up in Mountain View because it was near where I worked, and I ended up liking it and having a group a friends within a short radius. How much I like a place is how much I like my friends.”

Weir is a significantly bright fellow who started programming for the Sandia National Laboratories in Livermore when he was 15, studied programming for a while at UC-San Diego without graduating, worked for a number of years as a programmer for various high-tech companies, and wrote a science-fiction novel called “The Martian” that is a huge hit. He also sold the movie rights to “The Martian,” and has been invited to the premiere of the film version starring Matt Damon when it opens in October.

“The Martian” is a terrific story about an astronaut who is stranded on Mars when the rest of his crew thinks he”s dead and has to take off without him in an emergency.

The astronaut, Mark Watney, has no ready means to make contact with the spaceship that left him stranded or with Earth, and knows it will be a very long time till anybody can come get him. He knows how little food and water he has, and knows he is in big trouble.

But, he, like Weir, is a clever fellow, and the fun of the book is watching him figure out, for instance, how to create farmable soil and grow food crops in his tiny Mars living unit.

“The Martian” began with Weir sitting in the living room of his Mountain View home, entertaining himself with “thought exercises” about a trip to Mars.

“That became the Ares program [the project that puts his astronaut on Mars in the book], and then I was thinking, what would we do if this happens? If that happens? What could go wrong, how would people deal with it?

“It started to sound like a pretty good story, and then I created this one unfortunate protagonist and subjected him to all of those bad things.”

Watney is a scientist and an engineer, and his cleverness at finding ways to survive is impressive, but Weir said, “I always want to draw this distinction — I am an enthusiast, not an expert. I just have to write something that seems plausible to readers.

“I am not even in their league,” he said, of the real NASA engineers and scientists who work on space missions.

Still, NASA liked his book — and the positive light it shines on the agency — well enough to invite Weir down to the Johnson Space Center in Houston for a tour.

Getting there required medication, because this man whose imagination soars mightily is afraid of flying.

“I have general anxiety problems across the board,” he said.

He had been invited by the production company to Budapest to watch some of the filming of “The Martian,” but passed on it.

But an invitation to the Space Center could not be ignored, so he took some meds and went, followed by a flight soon after to San Diego for ComicCon.

“My shrink said I should just keep flying,” he said. “If you go without it for a time, you”ll re-establish the fear.”

So, maybe he can get on an airplane to attend the premiere of the movie.

In the meantime, between press interviews, Weir is working on a new novel.

“It should come out in mid-2016,” he said. “It”s more traditional science fiction, with faster-than-light travel, aliens, stuff like that.”

Weir may not be an expert, as he said, but he likes doing research, so it”s likely that his explanation of faster-than-light travel will resonate with plausibility — it will at least be consistent inside the fiction he is creating, he said.

“As for the aliens, I don”t want to give away too many plot points, but I think people will be happy with that part of it,” he said.

When he”s not writing or being interviewed, he hangs out with those local friends in Mountain View, usually meeting at somebody”s house to play board games.

“We”re indoorsy geeks,” he said. “We hang out, play board games … games for games geeks. Games that the dorks play.”