Wherever you look these days, editors’ submission guidelines are firm: no stories based on your D&D campaign.
This is wise for a number of reasons, I suppose, but you do come across interesting variants on the idea of gamers getting stuck in their game, and occasionally they actually are quite good – good enough to attract their own enthusiastic followings and to have sparked an entire category of their own: “LitRPG”
But this isn’t by any means a strictly modern phenomenon: indeed, fans of RPGs have speculated at the origins of some of their favourite stories at the author’s supposed gaming table more or less since games of the sort exploded in the 1970s.
For me, though, the real home of this kind of fiction lies in 1983.
Examples of strict “LitRPG” tales abound, the sub-genre being very popular in Asia. These sorts of tales are currently enjoying a great deal of popularity in Korea for example, and the concept is the basis of any number of ongoing Japanese “light novel” series. Of course the quality varies widely.
Closer to home on the LitRPG range we have the modern Caverns & Creatures series by Robert Bevan, which began with his first novel Critical Failures back in 2012. Not exactly highbrow fiction, Mr. Bevan’s series features characters that are as unfortunate at Cugel the “clever”, with a dash of Pratchett and Aspirin at their most ridiculous and a healthy dose of splattery shock value for laughs. Mr. Bevan’s books are explicitly inspired by his own love of tabletop gaming and incorporate the kind of “gonzo” wildness of the old-school which of course was itself inspired by the pulps – a curious case of coming full circle.
Verging from the strict LitRPG model are more “literary” efforts such as Tad Williams’ Otherland series, which began in 1996. And of course along the same lines is Ready Player One by Ernest Cline, which counts as the sort of “stuck in an MMORPG” tale that is so popular in the genre. 
But let’s go back to the 1980s, when the shelves of bookstores everywhere were being over-run by every sort of Tolkien pastiche imaginable, most inspired in some manner by the fantasy role-playing boom that was in full swing at the time. Inevitably, these books were all about shining heroes and heroines who quite obviously “levelled up” during the course of the tale, and represented the kind of fantasy every gamer has surely had: “wouldn’t it be cool to live in the world we play in!”
Joel Rosenberg was discussing a Dungeons and Dragons game with friends when this very topic came up, and as his wife Felicia Herman remembered it in an interview with MPR News shortly after his death the concept hit him like a stroke of lightning: No, it wouldn’t be cool to live in a fantasy world, he realised.
And so he started work on his first novel, The Sleeping Dragon (1983), which became what Ms. Herman describes as “basically a million-word love letter to the industrial revolution.”
This really is a brilliant concept, one that takes the whole idea of a story about kids who get sucked into their game world and gives it a run for its money. In this series you won’t find a bunch of teenagers who discover in themselves “natural heroes” – or rather you will, but perhaps not in the usual ways. Yes, they (predictably) use their “real world” knowledge to advantage in the faux mediaeval world they find themselves in, but it’s not pursued – as it is so often – as a kind of alternative magic. Instead, Rosenberg engages directly with the social and economic consequences of sudden industrialization, and embarks on what is actually a rather sophisticated exploration of themes like freedom and heroism and personal responsibility in government.
The opening volumes of the series are, to me, the most interesting. Serious gamers will be interested to see the little game details he offers in the beginning – and will perhaps be curious to work out what system Mr. Rosenberg based his fictional game on. Others will find themselves caught up in the gritty details and dedication to realism in his exploration of just how the technologies we know so well might be transplanted into a fantasy world, and what effects they might have. Related to this is another truly interesting facet of the books: the effort Mr. Rosenberg put into imagining just how certain institutions and economic forces would develop in a world where magic is real.
But the real pull here is definitely the unapologetic heroism: the protagonists are faced with hardship, certainly, and some ugly things happen to them in the course of the first novel in particular, but they pull together to dedicate themselves to a cause they truly believe in, for which they find themselves fighting against sinister and powerful forces with not only enormous resources but the implicit support of society at large.
In addition to the Guardians of the Flame series that The Sleeping Dragon begins, Rosenberg wrote quite a few other books, delving into science fiction as well as other fantasy worlds, and even starting a modern thriller/mystery series.
It’s a shame, really, that Rosenberg burst onto the scene in the 1980s when the shelves were overflowing with copycats and near-LitRPG: he did acquire a following (and the kudos of contemporaries such as Mike Resnick and Raymond Feist), and in fact some of his books – including the Guardians of the Flame series – still rank respectably on sales lists, despite his passing in 2011 and his relative invisibility in fandom for some years before.
These days, he seems to be fairly obscure, but if you’re a fan of fantasy fiction that draws on RPGs for inspiration, Guardians of the Flame is definitely a series you want to look at.
 Mr. Bevan, incidentally, is a poster boy for self-publishing success, having gone from working long days in Korea and hacking words on the side in 2012 to making enough off his writing to move back to his native US and buy a house where he now writes full time from home.
 And was ironically adapted as a MMORPG!
 Both these of course are more stories about VR that have their roots firmly in the cyberpunk era, but as the framework is “gamified” I class them as cousins to the LitRPG trend, especially since so many of the Asian series of this kind revolve around MMORPGs.
 I never managed it.