By Matthew Renaud on Monday, March 12th, 2012 11:24 AM PST

Innovation.  It was our goal when we started designing Dream PetHouse, and one of the areas we focused on was the social experience.  In Dream PetHouse, now available on iOS, you can collect, feed and grow some of the cutest pets on mobile, all in your own unique treehouse.

A core component of the game is visiting friends. In other mobile games, we noticed it was a chore to visit friends, so we sought to build a seamless, efficient social mechanic. We knew our players would be eager to share their trees with their friends, so we placed an emphasis on improving social performance.

There was just one problem. Providing social engagement on mobile is difficult. Mobile players are on the move, they’re multi-tasking, they’re distracted, there’s no browser tab to jump to and they don’t have much time or patience to wait for a social visit. The only way to encourage more social interaction was to make it nearly instantaneous.  After all, that stoplight is turning green in 3..2..1..*

Achieving instantaneous social visits is challenging. It’s even harder when complying with Apple’s 3G download limit.  We needed to find a way to expedite social visits, download normal gameplay assets and keep the bundle under 20MB.

In the spirit of Zynga’s canine roots, we created “Smart Fetch”. Here’s how it works:

When players download Dream PetHouse, our bundle only includes the first six pets, one tree and one set of fruit.  Not only do we rely on background downloading for game assets, we thought we could use it as an opportunity to improve the speed of social visits.

Since it takes several seconds to get data about your neighbor every time you visit, we pre-fetch user information for neighbors in the background and during normal gameplay. Initially, we were worried about performance issues and network bottlenecking.  However, in our tests, Zynga’s asynchronous server model proved resilient under this method. We also enhanced it to put in protections so that Smart Fetch works as seamlessly as possible. When a player’s session starts, session data is loaded first and the social data is secondary.

Following the session data, the social data for Chipper, our wuvable Dream Pethouse mascot, is loaded followed by the general social data.  The social data is broken down further into two tracks: community neighbors (random players) and actual neighbors that have previously accepted your invite or request.  On the first call, Chipper’s tree is returned as are the ZIDs (a player’s unique Zynga ID that is consistent across all Zynga games they play) of your friends.  The order of your friend’s ZIDs is randomized so you don’t always get the same friends in the same order.  Once the list of ZIDs is returned the client, it then incrementally requests subsets of friends.  The data for the subsets of friends is returned incrementally to avoid related performance issues such as a large HTTP response.  We didn’t want to grab all of your friend’s data at once and this also allows the player to visit their first few friends while downloading the data for the next group of friends. By the time players reach that next group of friends, their data will already be downloaded, and so on. When fetching community members (non-neighbors) the server decides who to send to players and knows which members players already have to avoid duplicates.

With the data pre-fetched, the second bottleneck we found was loading the “Visiting Scene” using the cached data. We decided to take an asynchronous asset loading approach. In this design, only two assets block the scene loading process – the tree and the background. Since they’re both customizable, we didn’t want users to see the placeholder tree and placeholder background loading and have them change colors to the selected tree and background.  But all other assets in the scene – pets, house, bridges – are loaded on-demand; we have placeholder assets, that are relatively low quality, which may show briefly if this process takes too long. We were willing to show these low quality images, because in practice they are only shown briefly, if at all.  Further, following conventional rules, the data amount makes it fast too. Assuming it’s a smaller tree, it will load quicker. The overall effect is that when you tap the “Next” button to go to the next tree, there will be minimal delay.

We are just now seeing the benefits of the Smart Fetch in the hands of our players.  Not only is player feedback encouraging, but the tech has held up well under multiple server spikes and increased traffic.  We are committed to using it in the future to increase social engagement across our games.  In fact, it’s even helping with the design of our next title because if we know that a slow, cumbersome social experience will not inhibit our players, we can more predictably develop and expand the social features as fundamental to the normal gameplay.

Be sure to check out Dream PetHouse here, and sound off in the comments with any questions.

Co-author: Antony Yang

William Fong also contributed to this post

*Safety disclaimer: Zynga does not condone enjoyment of Dream PetHouse while driving. At least park first.


Leave a Reply

Connect with Facebook