Frank M. Robinson, a well-regarded science fiction writer whose credits include a novel adapted for the 1974 blockbuster film “The Towering Inferno,” and who was also a speechwriter and adviser to Harvey Milk, the San Francisco city supervisor assassinated in 1978, died on Monday at his home in San Francisco. He was 87.

The cause was heart disease and pneumonia, said Robin Wayne Bailey, an author, friend and former president of the Science Fiction and Fantasy Writers of America, which announced the death.

Mr. Robinson had moved to San Francisco from Chicago in 1973 to work with a friend and fellow writer, Thomas N. Scortia, on a novel about a skyscraper fire. While writing the book he befriended Mr. Milk, who owned a camera store in the neighborhood.

RELATED COVERAGE

“The Glass Inferno,” their 1974 novel, was mined for parts in creating the final script for “The Towering Inferno,” the producer Irwin Allen’s disaster-film follow-up to “The Poseidon Adventure” (1972). Parts of Richard Martin Stern’s 1973 novel, “The Tower,” also found their way into the movie. All three authors earned screen credit and substantial paydays.

Photo

Frank Robinson, left, and Harvey Milk at the front counter of Castro Camera in 1976.CreditDaniel Nicolett

Mr. Robinson used his money to settle in San Francisco, and to help Mr. Milk in his quest to become one of the first openly gay elected officials in the country.

“It came up that I was a writer,” Mr. Robinson said in a 2008 interview with The Chicago Reader, describing the conversation that began his political partnership with Mr. Milk. “He said, ‘Hey, why don’t you be my speechwriter? It’ll be a hoot.’ ”

“I figured it would be a lot of fun,” Mr. Robinson recalled — “and I might meet somebody.”

Mr. Robinson was also gay, but not publicly. In Chicago, where he spent the first half of his life, he had earned his living as a writer and editor for men’s magazines like Rogue, Gallery and Playboy. At Playboy, where he worked from 1969 to 1973, he had ghostwritten the “Playboy Advisor” column, a colloquium of sex and lifestyle advice for men.

His reputation as a science-fiction author was established with “The Power,” a 1956 novel about a man with advanced mental powers. Considered a classic of the paranormal genre, it was made into a television special in 1956 starring Theodore Bikel and a film in 1968 starring George Hamilton and Suzanne Pleshette.

His 1991 novel, “The Dark Beyond the Stars,” a space travel reimagining of Christopher Columbus’s journey, was selected as one of The New York Times’s notable books of the year.

Frank Malcolm Robinson was born in Chicago on Aug. 9, 1926. After a tour of duty in the Navy during World War II, he graduated from Beloit College in Wisconsin and then was drafted again to serve in the Korean War. He earned a master’s degree in journalism from Northwestern University and worked in the magazine business while writing fiction.

Mr. Robinson had a small role in “Milk,” Gus Van Sant’s 2008 film about Harvey Milk, and was interviewed extensively by Sean Penn, who played the title role, for his insights about his friend. Mr. Milk was killed along with Mayor George Moscone at San Francisco’s City Hall on Nov. 27, 1978, by a disgruntled political rival, Dan White.

Mr. Robinson had little or no dialogue in most of his scenes. But at one point he improvised a line, standing at a window to shout a profane coming-out announcement about his sexuality. “I’ll tell my brothers!” he said. Mr. Van Sant liked the moment well enough to film it a second time.

Mr. Robinson had never told anyone in his family that he was gay, neither his parents nor his four brothers. And though the scene did not end up in the film, saying the words had made him tremble with emotion, he told The Chicago Reader. It had been his coming out.