In October, the cinematic adaptation of Andy Weir’s popular SF novel The Martian will land in theaters nationwide. Given the book’s immense fan base and the film’s pedigree—it’s directed by Ridley Scott and stars Matt Damon and Jessica Chastain—Hollywood has huge expectations.

All that glitz belies the book’s extremely humble beginnings. The Martian, the story of a stranded astronaut named Mark Watney struggling to survive on Mars’s uninhabitable surface, was originally serialized for free on Weir’s personal website. But the book’s cult following truly exploded when Weir complied with readers’ requests for a Kindle e-book edition, which lead Random House’s Crown Publishing Group to buy the print rights. The same week that deal closed, 20th Century Fox snapped up the film rights. Crown released the title in February 2014.

Often overlooked in The Martian’s takeoff, however, is the audiobook deal that Weir struck with Toronto upstart Podium Publishing, about 11 months before Crown’s print release. That collaboration resulted in the book becoming the top-selling title across Audible, and receiving a 2015 Audie Award for Best Science Fiction (narrator R.C. Bray was also nominated for Best Male Solo Performance), among other accolades.

“It was actually the first professional deal I made with The Martian,” Weir says. “I thought it was a nice, incremental step forward for exposure for the book.”

At the time, Podium Publishing—founded in 2010—had only published nonfiction audiobooks. But company cofounder and v-p of production Greg Lawrence, a SF/fantasy aficionado, stumbled on Weir’s website and sent the link to the author’s free edition to fellow cofounder and v-p of acquisitions James Tonn.

The Martian appealed to Lawrence because of the copious research and the hard science accentuating Weir’s survival epic. Finding a narrator was tricky. Tonn initially envisioned a “nerdy” voice, but Lawrence, who’d worked with 200 voice actors, zeroed in on Bray.

But then Bray almost declined the job. He’d just finished narrating a handful of SF books and wanted to change genres, possibly in favor of doing a thriller. “Then I took a moment to read the opening line and thought: well now, this could be interesting,” Bray says.

In fact, Bray would go on to perform the book more than once. The first time was based on Weir’s original text. But when Crown bought the print rights, it put the book through a fresh round of edits, resulting in revisions and an altered ending.

Given the audiobook’s success, it’s fair to wonder if it had impact on the print deal—and, eventually, the movie deal. But Julian Pavia, Weir’s editor at Crown, says no: “Our excitement about publishing The Martian was based on the material itself, so the audio edition wasn’t relevant to our decision making at all. But we’re of course really glad that Andy’s fans have responded so positively to it.”

“A lot of these things happened simultaneously,” Weir says. “Crown approached me before the audiobook was out yet.”

At Podium’s request, Weir removed the free version of the novel from his site and then, at Crown’s request, the Kindle e-book. So for an interval, Podium had the only available edition of The Martian—a situation that Weir believes boosted audiobook sales.

Ultimately, some kinks needed to be ironed out between Podium and Crown, as Weir had two potentially conflicting contracts. He signed his deal with Podium before he had an agent, and the contract had nonstandard elements. For instance, the audiobook deal had a seven-year expiration date, at a time when 12–18 months was the industry norm. Additionally, the contract allowed Podium to block print publication.

“They could have quashed my deal with Random House,” Weir recalls.“[But] they let me pay them a small fee and modify my contract so I no longer had that clause, making it 100% clear to bring Random House on board. That was in their interests too: the print deal helps the audiobook sales.”