Douglas Adams described the first ebooks “long before most commuter trains were filled with people reading them”, according to his fellow novelist Neil Gaiman, but the late author of The Hitchhiker’s Guide to the Galaxy was still optimistic about the future of the book, predicting that “no matter what happens books will survive”.

Giving the annual Douglas Adams lecture last night, Gaiman spoke at length about his memories of his friend and fellow author, revealing the details of a conversation “almost 30 years ago now”, when the two were discussing the idea of ebooks.

“We were talking about The Hitchhiker’s Guide to the Galaxy, which was something which resembled an iPad, long before it appeared. And I said when something like that happens, it’s going to be the death of the book. Douglas said no. Books are sharks,” Gaiman told a packed audience at the Royal Geographical Society in London.

“I must have looked baffled because he he looked very pleased with himself. And he carried on with his metaphor. Books are sharks … because sharks have been around for a very long time. There were sharks before there were dinosaurs, and the reason sharks are still in the ocean is that nothing is better at being a shark than a shark.”

Watch the lecture in full

Adams told Gaiman: “‘Look at a book. A book is the right size to be a book. They’re solar-powered. If you drop them, they keep on being a book. You can find your place in microseconds. Books are really good at being books and no matter what happens books will survive.’ And he was right,” said Gaiman.

“Ebooks are much better at being two or more books and a newspaper, at the same time. Ebooks are great at being bookshelves, which is why they are great on trains. It’s also why the encyclopaedia proved not to be a shark, but to be a plesiosaur.”

And stories, said Gaiman, “aren’t books. Books are simply one of the many storage mechanisms in which stories can be kept. People are one of the other storage mechanisms for stories. And stories, like life forms, change.”

Gaiman’s lecture, Immortality and Douglas Adams, is part of a series of annual talks to raise funds for two charities close to the heart of Adams, who died in 2001, aged just 49 – Save the Rhino and the Environmental Investigation Agency.

The novelist spoke of how he first met Adams, in 1983, as a 22-year-old journalist sent to interview him. “I was expecting someone sharp and smart and BBC-ish, someone who would sound like the voice of The Hitchhiker’s Guide to the Galaxy. I was met at the door by a very tall man with a big smile and a big slightly crooked nose, all gawky and coltish, as if despite his ridiculous size he was still growing,” said Gaiman.

“He was kind, he was funny, and he talked … he showed me his things. He was very keen on computers, which barely existed at that point. He was clumsy. He would back into things, trip over things, or sit down on them very suddenly and break them. He was famously late for deadlines, and did not ever appear to enjoy the act of writing very much.”

But, said the novelist, Adams came up with an idea for a radio show called The Ends of the Earth, in which the planet would be destroyed in different ways at the end of every episode. “In the first episode he was going to destroy the Earth to make way for a hyperspace bypass, but he decided this was such a good beginning that he abandoned The Ends of the Earth and followed this story into space, along with Ford Prefect, the researcher for The Hitchhiker’s Guide to the Galaxy.”

The radio series went on to become the bestselling, much-loved Hitchhiker’s Guide books, but Adams never really meant to be a novelist, said Gaiman. Writing novels “was a profession he did reluctantly, had really backed into, or stumbled over. I think perhaps what Douglas was, was a futurologist, or an explainer. One day maybe we’ll realise that the most important job there is, is someone who can explain the world to itself in ways the world can’t forget,” said the writer.

And Adams, according to Gaiman, was a genius. “I haven’t known many geniuses in my life. Some brilliantly smart people, but only a tiny handful would I class as geniuses. I would class Douglas, because he saw things differently, and he was capable of communicating the way he saw things, and once he explained things the way he saw them, it was almost impossible to see them the way you used to see them.”

Gaiman also told the audience that he once asked Adams who his literary inspiration was. “He said ‘PG Wodehouse, but nobody ever notices’, and then he quoted a sentence to me,” said Gaiman, reading out a line from The Inimitable Jeeves. “As a rule, you see, I’m not lugged into Family Rows. On the occasions when Aunt is calling to Aunt like mastodons bellowing across primeval swamps and Uncle James’s letter about Cousin Mabel’s peculiar behaviour is being shot round the family circle (‘Please read this carefully and send it on to Jane’), the clan has a tendency to ignore me. It’s one of the advantages I get from being a bachelor – and, according to my nearest and dearest, practically a half-witted bachelor at that.”

“I said, ‘didn’t you swipe that for the mattresses?’ He said ‘yes’,” said Gaiman, referring to the sentient but dim-witted mattresses of Sqornshellous Zeta, in Life, the Universe and Everything. The writer also admitted that he had stolen a joke of Adams’s, for his own novel, Neverwhere.

“What is your name, human?” Arthur Dent is asked. “Dent. Arthur Dent,” he replies, and is then addressed as “DentarthurDent”. In Neverwhere, Gaiman’s hero gives his name as “Richard. Richard Mayhew. Dick.”

“It’s the only time I’ve ever put in a joke purely and simply as an act of homage,” said the novelist. “I told Douglas I was doing it, and he approved.”

The author of bestselling novels including American Gods and Anansi Boys, and the critically acclaimed new short story collection Trigger Warning, Gaiman said that “I genuinely don’t know who I would be now if, as a 22-year-old, I hadn’t gone and interviewed Douglas”. The interview, he said, resulted in him writing the Adams celebration Don’t Panic.

“I spent a lot of time with Douglas and wrote in a style which was clean, funny, classic English humour. By the time I got to the end I said, this is really fun to write, I should do more of this. So I wrote 5,000 words and sent it to friends to read. One was Terry Pratchett, who phoned me back, eight months later, and said ‘you know that thing, are you doing anything with that?’”

The two decided to collaborate on the book – “It was an awful lot like Michelangelo phoning you up and saying do you want to do a ceiling?” said Gaiman – and it ended up as Good Omens.

Gaiman ended his lecture on a note of optimism, saying that “stories are incredibly long-lived … We have children of flesh and blood … but we also have children of stories, and that’s immortality, of a kind,” he said, later adding, in answer to a question from the audience, that he “just wished we had more” of Adams’s work.

“Douglas was a fan of PG Wodehouse. With Wodehouse you could have a shelf of books. With Douglas – we have a tiny little area of shelf, and I wish it was huge,” said Gaiman.