This summer, Der Spiegel ran several stories revealing the extent of the N.S.A.’s large-scale monitoring of European communications. At the agency’s European Cryptologic Center, in Hesse, the paper reported, agents learned to use the controversial XKeyscore software to mine Web users’ private e-mails, online chats, and browsing histories with no prior authorization. One element stands out as particularly surreal: “To create additional motivation,” according to Der Spiegel, “the NSA incorporated various features from computer games into the program.” For instance, analysts who excelled at an XKeyscore training program could acquire “skilz” points and “unlock achievements.”

For many readers, the existence of such games confirmed suspicions of the N.S.A.’s cavalier attitude toward online privacy. On the technology blog Gizmodo, Adam Clark Estes wrote, “Did analysts level up when they identified American citizens who were talking with targets? Or get extra lives for intercepting messages between citizens that include mention of one of these targets?” Other bloggers recalled Pentagon’s Plan X, a coördinated effort between game designers, animators, and security experts to make waging “cyber offense” more like a video game.

Yet despite the uneasy reactions to Der Spiegel’s report, the argument that work should feel more like a video game—complete with points, instant performance feedback, and flashy graphics—has, in the past decade, become a common refrain in Silicon Valley, and the so-called gamification of work is already under way in many industries. For some offices, that means designing sales competitions with sports-themed graphics and points systems to emulate ESPN-style action. For others, it means simulating cyber attacks to promote teamwork among a company’s security staff. Still others might use merit badges to reward employees for meeting new co-workers or even for eating healthfully.

In 1959, a Duke sociologist named Donald F. Roy joined a group of machine-line workers in Chicago to study how menial laborers, working twelve-hour shifts, coped with their factory conditions—in particular, the problem of monotony. The study, titled “Banana Time: Job Application and Informal Interaction,” describes how the workers consciously broke up their day with food breaks (“peach time,” “fish time,” “coke time”); self-imposed, if meaningless, benchmarks (“stamp a thousand green shapes in a row”); and even practical jokes, such as a daily ritual in which one employee stole and ate another’s banana, precipitating a volley of “protests and denunciations” from the victim—who nevertheless always made sure to bring another banana to work the next day. Through this kind of ritualized fun, Roy found, “the ‘beast of boredom’ was gentled to the harmlessness of a kitten.”

Roy was among a group of mid-century sociologists who were trying to figure out why factory workers did not rise up in protest against their low pay and horrible conditions, Ethan Mollick, a professor at the Wharton School of Business at the University of Pennsylvania, told me. One researcher, who happened to return to Roy’s Chicago factory many years after “Banana Time,” found that the workers there had become obsessed with a factory-wide competition to beat individual production quotas. What’s more, employees were more enthralled by the game itself than by the modest cash prize for which they were competing. Games, the researcher concluded, could divert factory workers’ energies away from collective bargaining and toward internal competition. In doing so, they encouraged workers to consent to the factory owners’ production goals.

“At a certain point, there was a transition from viewing games as something that hurt production to a tacit realization that maybe games are doing us a service,” Mollick told me. People realized that games could be “built on top of the goals of management.”

When researchers study what spurs people to work harder, they look at both “intrinsic” motivators—enjoyment of the work itself—or “extrinsic” rewards, such as money, benefits, and social events, said Nancy Rothbard, also a professor at Wharton. Increasingly, researchers have come to think of games as yet another extrinsic reward, like company picnics or managerial praise.

“What well-designed games do is to create challenges and well-measured rewards for those challenges that give frequent positive feedback, designed to make workers feel more positively,” Rothbard said. In other words, turning work into a game can make employees more satisfied and, potentially, more productive—all under the guise of having fun.

Hey, you know what kind of games are fun? Video games, which evolved around the same time as modern industrial psychology, and have since incentivized millions of children and adults to save princesses, steal cars, solve puzzles, build cities, and wage merciless wars in virtual worlds, with fun being pretty much the only salient reward. Today, some gurus in the burgeoning field of “game studies” argue that video games, in particular, can be powerful motivators.

In her influential 2012 book “Reality Is Broken,” Jane McGonigal—a game designer and TED Talk favorite—writes that this is because the non-game world falls short of our expectations and desires in ways that games never do. “The real world just doesn’t offer up as easily the carefully designed pleasures, the thrilling challenges, and the powerful social bonding afforded by virtual environments.” McGonigal, seeming like the world’s most cheerful existentialist, itemizes reality’s many flaws—that it is “hopeless,” “depressing,” and “trivial”—and suggests that games like World of Warcraft and Rock Band hold the cure. Instead of continuing to suffer in a world without meaning, she writes, “imagine a near future in which most of the real world works more like a game.”

That may not be a stretch. Today, you can track your cross-training with Nike+, become mayor of your coffee shop with Foursquare, win badges for energy conservation with Opower, level up in German, Spanish, or Italian on Duolingo, out-clean your spouse in ChoreWars, or try some of the hundreds of other apps and sites that use gaming features to help you lose weight, balance your budget, or just gamify your entire life. By 2016, M2 Research predicts that gamification will be a $2.8 billion industry.

The research firm further predicts that workplace gamification will see the greatest growth. To understand how that would look, consider Zillow, the real-estate Web site, whose salespeople win points by making cold calls and closing sales, and account managers get ahead by earning positive surveys from customers or convincing them to return for more business. If you’re a Zillow worker and a customer gives you some nice feedback, for example, TV screens across the company will light up with graphics, videos, and your own head shot—all themed according to whatever sport is in season. (Right now, it’s football.)

“The TVs are pervasive throughout the office, so that even when you’re on a call you can look over and see the screen,” Tony Small, a Zillow vice-president, told me. Workers, he said, are constantly in competition to rise to the top of each so-called leader board.

In fact, most examples of workplace gamification are competitive in nature, relying on points, badges, and leader boards to motivate performance. In the past few years, venders with names like Busification, Leaderboarded, Hoopla, and the dystopian-sounding Dopamine have emerged to offer these features. (Hoopla’s motto: “Put Fun to Work.”)