Whenever I'm in an old bookstore I usually glance quickly through the old paperbacks to see if there are any fantasy or sci-fi novels I might be interested in. I also keep an eye out for vintage gamebooks.
Gamebooks were my introduction to the world of Roleplaying Games, and I was a big fan of both Choose Your Own Adventures and the Fighting Fantasy series. I guess I still am as I buy a "new" book from one series or the other every month or two.
While Dungeons & Dragons and similar RPGs didn't develop until the mid 1970s it was a blending of miniature wargaming rules with roleplaying and elements of interactive fiction, all of which are quite a bit older.
Miniature wargaming dates back to at least 1913 and H.G. Wells' "Little Wars" which he described as "a game for boys from twelve years of age to one hundred and fifty and for that more intelligent sort of girl who likes boys' games and books."
Roleplaying dates back even farther, and in all likelihood is older than written language! Pretending to be another character seems to be a natural part of human development and culture.
Interactive Fiction and gamebooks on the other hand seems to be a more modern creation, being inspired by the invention of the digital computer during the second world war.
From the 1940s to 70s there were a number of people experimenting and speculating about how to create interactive stories.
A Story as You Like It (1959) was an early work of interactive fiction by Raymond Queneau that allowed readers/players to make binary decisions to shape the plot of a fairytale about some peas.
During the 1970s the Tracker series of books was published in the UK, starting with "Mission to Planet L" in 1972. These books were in landscape format, with lots of illustrations and visual puzzles along with the interactive narrative.
Edward Packard began developing his Choose Your Own Adventure books in 1969, and these became very popular beginning with "The Cave of Time" in 1979.
In 1976 the first solitaire roleplaying game adventure was published as an interactive fiction gamebook -- Buffalo Castle (1976) for the Tunnels and Trolls system, which was itself created in 1975 as a simpler alternative to Dungeons & Dragons (1974).
Interactive fiction and gamebooks continued to have a lot of cross-over with roleplaying games. The Warlock of Firetop Mountain (1982) began the Fighting Fantasy series, which became very popular in a number of countries including Canada, the UK and the United States.
Many people, myself included, discovered roleplaying games through either Choose Your Own Adventures or Fighting Fantasy - both of which were easy to find in bookstores and libraries. An interest in these sorts of story/game activities eventually led to games with an almost unlimited number of branching paths -- the RPG.
The 1983 set of Basic Dungeons & Dragons which was revised and expanded by Frank Mentzer included an introductory adventure in the style of a short interactive fiction gamebook.This may represent a significant change in how Mentzer's "Red Box" D&D presented the way you were to play the game compared to earlier versions... or perhaps not, if Gary Gygax's own recollections are to be taken as indicative of how many other people played as well.
At any rate, by the height of Dungeons & Dragons popular culture success in the 1980s, interactive fiction and game books were important contributing factors in what lead people to the game and how they were playing it.
Other types of entertainment have also had their influence on D&D and RPGs over the years. Board Games, CCGs, Warhammer, World of Warcraft, and others have each added some element or other to the structure of the game, or simply changing the reference point that new players approach the game from.
These different reference points could be seen as the "roots" of RPGs, and some people do think of focusing more on the miniature wargaming aspect of the hobby as "getting back to the roots" of the game. However I think we all perceive the game as having roots of different importance to our own particular approaches to the game. For me the Gamebook and Interactive Fiction has always been the most important of these.