Zynga shares are up 9% so far today, for a reason no founder or CEO ever wishes for: It lost less money than everybody figured it would. 

After the close of trading on February 5, the San Francisco-based online gaming company announced it had lost $48.6 million in the last three months of 2012, or about six cents per diluted share. Analysts predicted it would lose $58.1 million. Revenue was $311 million during the quarter, flat versus a year ago, but the company also said it expected sales next quarter to come in between $255 and $265 million—a roughly 20 percent drop from 2012. 

The company’s struggles highlight the stubborn unpredictability of the social media business—and how falling one step behind changing consumer behavior allows teeming swarms of younger, nimbler startups to gobble up customers and profits.

Online gaming is a hit business, and its fans are fickle. For every Farmville, a Zynga farm simulation game that just surpassed $1 billion in revenue, chief executive and founder Mark Pincus announced yesterday, there are games like Party Friends or The Friend Game that the company will close because of unpopularity. Even established properties fizzle: On Tuesday Zynga announced that Cityville 2, the sequel to what was once the most popular game on Facebook, would close in March owing to a lack of popularity.  By the time Zynga caught on to the popularity of Draw Something, and paid $180 million to take it over, one-third of its fans had already departed for other games. It later wrote down half the purchase price.

Worse, even the most addictive games can’t attract users if they aren’t where the users are. After becoming the number one gaming company on Facebook, Zynga was slow to develop titles for mobile as players whiled away more and more time on devices like the iPhone. On Tuesday Pincus stated that since fall of 2012, the company has made mobile its number one priority. He also wishes he’d developed for mobile devices sooner. No wonder: Its bad timing on the move to mobile cost it the dominant position it had once enjoyed on Facebook. Today 21 percent of the company’s “bookings”—revenue from in-game purchases and ads—comes from mobile, a big improvement over the eight percent a year ago.

The company has made a lot of money on a few very savvy bets and lost even more on some stinkers (all told it’s down $555 million over the past five years). Perhaps it’s not surprising, then, that it now plans to move into actual gambling. The company says it is partnering with British online gambling company Bwin.Party to launch a new, real-money gambling app in the United Kingdom by the middle of the year. But how much of the game-maker’s successes and failures have been a matter of luck, and how much a matter of skill? Maybe, by playing as the house, Zynga will have better odds.