Neal Stephenson, The Diamond Age, or, A Young Lady's Primer (1995). This seminal work of postcyberpunk and of steampunk is also a seminal work of gamification SF. All the ingredients of a utopian vision of a comprehensively gamified society are present in the story, but connected and motivated in messy, subtle and unexpected ways.
For instance, we've got these "ractors" (actors in interactive media entertainment), who receive work via a kind of ThespRabbit. An individual employment may go on for years, or be as brief as a few seconds. Crucially, the human inputs are mapped onto avatars: if you were to take over from Jennifer Lawrence for a bit in the portrayal of Katniss Everdeen, the media system would autocorrect your voice and perhaps your walrus mustache. (Apologies to the community who are Jennifer Lawrence, who must feel confused and left out by this example). Why is this so important? The general point is that what workers feel that they are doing, and what they are objectively doing in terms of the production chain, can be interfered with at an intimate grain. The necessary unity of any task can be interrogated: is there another way to tease this task apart, to give a bit more of it (or perhaps, a bit less of it) to the machines?
There's plenty more in the book related to gamification: Nell's Night Friends -- Dinosaur, Duck, Peter and Purple -- have an aura of a small primitive social media site; the ecstatic Drummers are a kind of grotesque example of "flow," of loss of ego through immersion in action; there's that stuff about the street vs. the telephone switchboard.
But. The altar piece is clearly the Primer itself -- a majestic technological tome, with shades of Douglas Adams's Hitchhiker's Guide to the Galaxy, and a splendid illustration of Arthur C. Clarke's celebrated maxim that "Any sufficiently magical magic is indistinguishable from magic" -- which somehow floats into the hands of a poor and vulnerable four-year-old girl called Nell. The Primer mediates Nell's world for her, spinning her an epic interactive fairytale (starring "Princess Nell") which allegorises her various violent, abusive and increasingly philosophical predicaments, whilst teaching her all she needs to survive and existentially flourish (martial arts, decorum, hacking, obviously). As The Diamond Age progresses, Nell's book begins to feel more and more like a computer game (clearly influenced by 90s point-and-click adventure games). The convention of using a different font to represent the Primer's text becomes more scarce.
Like most good allegories, the Primer's allegory is a slippery one. The Primer's Queen of the Dark Castle is clearly a correlate of Nell's mother, but the Queen does plenty of significant stuff which doesn't seem inspired by Nell's mother, and vice-versa. Nell's brother Harv appears in the Primer as just Harv, but also seems to have a connection with Peter Rabbit (they disappear around the same time, for instance). There's not a one-to-one cipher: correlations come and go. You get the impression that the allegory might work a bit like the racting: 'let's see what's available at the moment.'
Likewise, Nell doesn't simply unlock achievements in her Primer or advance to the next story by demonstrating she has mastered some real world skill. Nor does the Primer elide its fairytale with her surroundings so that winning the game is indistinguishable from winning life. The Primer informs and incentivises, it provokes action, but it also comforts, cares, offers the solaces of shrouds and distortions, and immersive escapism. The relations between game and extra-game world can be just as slippery and mercurial as the relations of allegory.