Zynga Farmville Performance Optimization

Project

I was hired by Zynga to review the Farmville game and provide consultation on how to optimize the performance for both power-users that have large complex farms and for average users as Zynga explored implementing Farmville on Mobile via Flash Player and Adobe Air.

Challenge

Farmville is a highly visual, animated game with significant full-screen motion. The Farmville game is also a very large code-base, requiring a large amount of time to review the code and do benchmarking.

Solution

After making modest gains by making code optimizations, I stepped back and looked at some of the team processes in place to see if there might be more systemic problems. Though I was hired by the engineering department, I ended up spending a large amount of my time with the art/design department. It turned out that there was no communication between design and engineering, and they had been working at cross purposes since the game was created.

Engineering had a blind spot that the assets themselves contribute to the performance issues of the game. Design had a reticence to get involved with the engineering team to find out the proper specs for building the assets.

An example of one of the issues facing the game were the quality of the core assets. These two pigs appear to be the same, however the original pig (on the left) taxes the processor with as few as 10 pigs on the screen. The re-drawn pig on the right looks the same but can have hundreds of instances on the screen without impact.

The original pig, when zoomed has jagged edges which were likely a result of a raster image being converted to vector.

The re-drawn pig appears smoother because it contains many fewer corners and curves.

This view shows the original pig with all of its lines and corners exposed. Many of these details fall below a 1px size when shown at regular size.

This view shows the re-drawn pig with fewer curves and corner leading to a more optimized playback of the game.