SAN FRANCISCO – One of the popular games that propelled Zynga to prominence is "Mafia Wars."

Now the online-gaming company, which went public in 2011, has found a Don to run it. On July 1, Zynga said that Don Mattrick, a Microsoft executive, will replace founder Mark Pincus as its boss. Pincus will stay on as chairman and "chief product officer."

All has not been well at Zynga's San Francisco headquarters, dubbed "the doghouse" because of the giant posters of its bulldog logo hanging outside. Although the firm pioneered casual gaming on Facebook with hits such as "FarmVille," many of its offerings have been losing their appeal.

Since a chunk of Facebook's revenue has come from selling credits for use in Zynga games, that has been bad for both firms. In June Zynga fired almost a fifth of its workforce. At the close on Friday its shares languished at $3.43, just over a third of its IPO price.

Zynga (like Facebook) has been wrong-footed by a shift from desktops to smartphones and tablets, where its range is weaker. It has rushed out new products for mobile devices but has lost ground to rivals like King.com, whose "Candy Crush Saga" has soared up the app-download charts.

Zynga has also been criticized for the poor quality of some games and for overpaying for acquisitions such as OMGPOP, a firm bought last year for $200 million.

All this has raised questions over Pincus' leadership — and explains the arrival of a new boss. Mattrick has no deep casual-gaming experience, but at Microsoft he revitalized its Xbox game-console business and in a prior role at Electronic Arts, a big game developer, he oversaw wildly popular franchises such as "The Sims." He is said to have been looking for a chief executive's job. A pay package that could be worth $50 million over several years no doubt encouraged him to move.

To hit that jackpot he will have to show he can work with Pincus, who may find it hard to relinquish control. He also must find blockbuster mobile games. And he will have to steer Zynga into new markets.

The firm is eyeing online poker and casino games played for real money, and is experimenting with these in Britain. It has also bought Spooky Cool Labs, which has real-money-gaming veterans in its ranks. But the business is a regulatory minefield, and competition will be tough.

"It's going to be a very crowded field," cautions Colin Sebastian of Robert W. Baird, an investment firm.

In a blog post about Mattrick's appointment, Pincus insisted that Zynga still has the potential to become "an Internet Treasure."

That is wishful thinking. Although the company managed to eke out a $4 million profit in the first quarter of 2013, its revenue plunged by 18 percent year on year. If Mattrick can't halt this worrying slide, it will eventually be game over for Zynga.