Some years ago, a reporter who shall remain nameless cheated in the game Diplomacy. It was the only time he ever played, and his crime—well, he was a spy. Once revealed, his treason spawned feelings of betrayal among his peers, but whatever. To this day he feels no guilt.

And besides, those jokers should have seen it coming, according to a new study to be presented later this month at the 2015 meeting of the Association for Computational Linguistics in Beijing. That's because in between espionage missions, he was being awfully nice to the other players—a sign, the authors of the new study conclude, that he was about to stab them in the back.

While economists and other social scientists have long been interested in cases where temptation might lead to betrayal, their approaches to studying betrayal itself aren't terribly realistic, argue researchers Vlad Niculae, Srijan Kumar, Jordan Boyd-Graber, and Cristian Danescu-Niculescu-Mizil. Maybe more to the point, models that predict betrayal are usually silent on what presages treachery. For example, the Prisoner's Dilemma—a classic if simplistic model of the tension between cooperation and individual gain—simply predicts betrayal without saying anything about what leads up to it.

In the moments before they're betrayed, victims start talking more and more about future plans and become increasingly polite.

In reality, however, there's much in the way of conversation and other communication that could contain hints of what's to come, the researchers argue. To probe what such information could yield, they needed a large body of communications to analyze. For that, the team turned to the classic game Diplomacy—in particular, to transcripts of 249 online games, containing a total of around 145,000 individual communications between players. The data also included information on which players explicitly supported others, as well as signs of hostility, such as invasions or support for a player's enemies.

One of the key signals of a coming betrayal, oddly enough, is that betrayers are especially positive compared to other players before they turn on their allies, potentially a sign "the betrayer [is] overcompensating for his forthcoming actions," the team explains. Future victims, meanwhile, are more likely to talk about pending plans and are also somewhat less polite in their messages to others.

How those variables change over time matters, too. In the moments before they're betrayed, victims start talking more and more about future plans and become increasingly polite. Conversely, betrayers suddenly express positive sentiments—for example, "I will still be thrilled if it turns out you win this war"—and suddenly less polite, despite having been the nicer one for much of the game.

"While discovering betrayal in one online game is a fun and novel task, our work connects with broader research in computational social science," the authors write, including research on communication in romantic relationships, business ventures, and Wikipedia edit wars. Catching a spy? Well, we'll see.

Quick Studies is an award-winning series that sheds light on new research and discoveries that change the way we look at the world.