Developer Console
Amazon Developer Blogs

Amazon Developer Blogs

Showing posts tagged with GameCircle

January 22, 2014

Mike Hines

Note: Effective 08-26-2015 Free App of the Day (FAD) has been replaced with Amazon Underground.

Getting the right exposure for your app is a key ingredient to making it successful. Amazon already has several programs which developers can leverage to help drive visibility to their apps, and developers who want even more visibility think outside the box to tailor their customer experiences to increase engagement with their apps. Tribeplay is one of those game publishers who did just that, by issuing a price discount promotion that drastically increased their revenue.

The team which is based out of China has been building apps since 2012 and created the series of games under the title Dr. Panda that first appeared on iOS and Android. According to Tribeplay, making their Android Apps available on the Amazon Appstore required “little to no extra tweaking.” Tribeplay added that “one of the best things about the Amazon Appstore is that there wasn’t much work to get our apps on there. We already develop for Android, so getting our games on the Amazon Appstore was a real breeze.”

 

 

 

 

The games are available worldwide, but the team wanted to increase sales in Europe so they discounted the price of their apps by more than 50% in select countries. By doing so, Tribeplay saw their gross revenue more than double in UK, Germany, France, Italy, and Spain.

So how did the team accomplish this? Tribeplay ran banners highlighting their price promotion, which caught the attention of customers in the Amazon Appstore. When the Amazon Appstore recognized that their app was trending in customer popularity, Amazon assisted by providing more visibility for the app. “The suite of tools for promotions and sales [that Amazon provides] to help market our apps on the Amazon Appstore more effectively are very valuable.” said Tribeplay, the creators of Dr. Panda. The team saw the app’s sales more than double during the time period, when they increased the visibility of their app. 

Aside from the sales uplift, Dr. Panda was also able to reach a new and unique developer audience on Amazon. “Amazon Appstore is a fantastic platform for us and continues to get better. Through Amazon we’ve been able to reach a whole new demographic and really succeed with them. The fact that the Kindle Fire device line is so integrated to the store has also been a great benefit for both developing and marketing our apps with Amazon customers in mind.” The teams recently joined the Appstore Developer Select program and integrated the Mobile Ads API and are excited to see how the results will turn out. By participating in these programs, the team will receive additional impressions for their app, home page placements, and customized ads for their app in the US.

So how can you increase visibility? Besides having your app perform well, you can ensure your app qualifies for the Appstore Developer Select program, or get your app featured in the Free App of the Day program. If you’re looking for something similar to what Tribeplay did with their promotion, check out the Developer Promotions Console, which allows you to easily discount your apps. Getting your app onto these programs only requires a couple pre-requisites and they all aim at providing visibility for your app. For example, for your app to qualify for the Appstore Developer Select program, it must utilize relevant API’s such as Amazon In-App Purchasing, Amazon Mobile Ads, and Game Circle that all contribute to enhancing the user’s experience in your app. If you need help with these requirements we have a lot of resources available as well. “The Amazon team has always been amazing with their help and advice. Questions we ask are always answered promptly and accurately, and any problems we’ve had have been solved super quickly.” says Tribeplay.

 

January 03, 2014

Amazon Mobile App Distribution Program

Adobe AIR Native Extensions for the In-App Purchasing and GameCircle APIs are now available for mobile app developers. If you create your mobile games using Adobe’stools, you can now use these extensions to rapidly add both In-App Purchasing for virtual goods and GameCircle for leaderboards, achievements, and Whispersync for Games.

The Adobe Gaming SDK enables developers to package ActionScript code into native apps for Kindle Fire, along with other devices. The Gaming SDK and the Adobe Game Developer tools are designed to help developers create rich,interactive experiences expertly and efficiently, supporting popular features such as hardware-accelerated graphics.

Adobe-1
The new AIR Native Extensions are available today for free as part of the Amazon Mobile App SDK. You can download the latest version here. Just follow the simple instructions in the documents to get started. Of course, you’ll also need AIR in order to use the extensions.You can learn more about the Adobe Gaming SDK and Adobe Game Developer Tools  here.

December 20, 2013

Peter Heinrich

We recently released an update to the Amazon Mobile App SDK that includes improvements to GameCircle and some related components on both Android and iOS. It updates GameCircle’s dependency on the latest version of Amazon Insights, corrects a few bugs, and expands API coverage of the Unity3D plug-in. For all of these reasons, we recommend migrating to the latest SDK when convenient.

Both GameCircle and its Unity3D plug-in now take advantage of the latest version of Insights, part of Amazon’s Analytics service and the piece responsible for generating Achievements Reports. Insights SDK on iOS removed a dependency on CoreTelephony.framework, while the Android version corrected an issue specific to certain device Locales and improved support for other IAP frameworks. In addition, session timeouts now behave more consistently across platforms.

GameCircle initialization has also been optimized on both iOS and Android, and GameCircle now ensures that its Javascript components are updated when migrating to a new version of the SDK. The Unity3D plug-in supports the latest Whispersync for Games syncable type, DeveloperString, which should make it easier to store arbitrary, non-mergeable game data from your Unity3D game. The plug-in also exposes the ability to show the GameCircle sign-in page.

Check out these latest changes to the SDK, and watch this space or future updates. We’re always working to improve performance, usability, and reliability of our services for mobile apps and games.

 

September 27, 2013

Peter Heinrich

Amid all the hoopla around GameCircle’s expansion to iOS and a major update to Whispersync for Games, you may not have noticed two other powerful features were also released recently. The GameCircle team quietly added support for bulk creation of leaderboards and achievements on the Mobile App Distribution Portal, as well as the ability to internationalize them in up to eight languages besides US English. Both have been popular feature requests.

Internationalization means that GameCircle will display the title and description of your leaderboard or achievement in the language appropriate to your player’s locale, provided they have specified it in their mobile device settings. You can provide translated descriptions in any or all of these languages:

 

You enable these alternative versions by selecting them from the Add a Language dropdown list on the Leaderboard or Achievement view for your game. To view your game’s leaderboards, for example, go to the GameCircle configuration page and follow the View link in Leaderboards column.

 

Adding an additional language is not reversible, but you specify which ones to publish, so there’s no harm done if you change your mind or add the wrong one: simply don’t publish that version of the title and description.

Once you add a language, you will see a new corresponding line item for each leaderboard or achievement, which is independently editable.

Providing alternative versions for each title and description, while straightforward, may become unwieldy when you are translating for a lot of locales, or just have lots of leaderboards or achievements. In fact, as the number of leaderboards and achievements goes up, entering all of the other information required to create them definitely makes manual entry time-consuming.

This is where GameCircle’s new bulk upload facility becomes really handy. Rather than create each achievement individually, for example, you can create a file of comma-separated values (CSV) defining all of your achievements at once. From the list of Achievements for your game, click the Bulk Add Achievements button.

On the page that appears, download a CSV template via the click here link. Open the template and fill in the columns as appropriate, then save it locally. See the Create Multiple Achievements section of Implementing Achievements for more information on each column. You will notice, for example, that there are separate columns for each possible translation of title, locked description, and unlocked description. Icon ids for locked and unlocked versions of the achievement are shared across all languages.

Before you can upload the CSV file defining your achievement (or leaderboard) metadata, however, you must upload the icons it refers to. GameCircle provides an Icon Gallery for this purpose, which allows you to add, delete, and rename icons individually or by dragging and dropping them on a web page. You can view the Icon Gallery for your game from the GameCircle configuration page. See Using the Icon Gallery for more information.

Once the icons have been saved and the CSV file updated to reflect your achievement metadata, you’re ready to upload. Click Choose File and navigate to the file you just edited, and then upload it.

Mobile apps and games distributed through the Amazon Appstore for Android are available in nearly 200 countries worldwide, and now GameCircle allows you to provide title and description translations for several of them. Entering the metadata that defines your achievements and leaderboards also got easier, now that you can upload it as a CSV file. Added in response to developer feedback, these features were designed to complement each other and make working with GameCircle fast and simple.

 

August 30, 2013

Mike Hines

Note: Effective 08-26-2015 Free App of the Day (FAD) has been replaced with Amazon Underground.

Amazon Mobile Ads API developer, Games2Win, Increases Earnings by 733% on Kindle Apps with eCPM up to $2.87

"The $2.87 eCPM we saw through Amazon far exceeded our expectations. Now we're racing to get Amazon integrated in all of our apps across all Android stores," says Mahesh Khambadkone, Co-Founder of Games2Win. See how Games2Win uses the Amazon Mobile Ads API to increase their earning by 733% on their Kindle Fire apps with eCPM up to $2.87. Click here for more monetization tips.

As I was reviewing our catalog of blog posts and thinking about blog posts we should write in the coming weeks, I was impressed by the number of ways Amazon helps developers monetize their apps. I thought it would be a good idea to recap those here!

Programs and Promotions

APIs

(no coding required)

(coding required)

Amazon Coins

In App Purchasing

Free App of the Day

Mobile Ads

Test Drive

Mobile Associates

Personalized Recommendations

Game Circle

 

A|B Testing

To learn more about the items above, please continue reading below.

Reach

No development effort is required to take advantage of Amazon’s reach.

•      In nearly 200 countries - The Amazon Appstore is available in the hottest app-buying markets in the world.

•      The only store on Fire - The Amazon Appstore is the only app store on Kindle Fire, the best selling Android Tablet worldwide.

Programs and Promotions

No development effort is required to take advantage of our programs, but you do need to sign up for Free App of the Day.

•      Amazon Coins – a virtual currency that users can get for up to a 10% discount, but still pay the developer the same as actual currency

•      Free App of the Day – Just tick the checkbox when submitting your app and you will be considered for the program.

•      Test Drive – By removing friction for customers who want to try apps, the more apps they will try. Those customers are more likely to find apps they are excited to download.  In this way, Test Drive helps customers understand the value of premium apps and helps drive downloads of freemium apps. Since Test Drive launched, it has been enabled on over 16,000 apps.

•      Personalized Recommendations – Increases the chance that your app will be seen by its most likely buyers.

Revenue Producing APIs

Development is required to make money with our APIs, and we’re working hard to make that effort as easy as possible. These are the APIs I’d like to talk about now.

In-App Purchasing (IAP): If you wish to sell digital assets like game currency or access to features or data within your app, the In-App Purchase (IAP) API has three good options for you:

Selling lasting items: If you have an app in which users need ownership of something durable, say, a new sword for their dungeon crawler character, you would use an IAP entitlement transaction. If you have a productivity app that has a set of advanced features you want to sell at a premium, you don’t need to have a free and a paid version of your app in the appstore; you need only one free version with an IAP entitlement inside to purchase access to the advanced features.

Delivering content or value over time: You could even collect $0.99 every month for the advanced features of your app if your users would rather subscribe to advanced features. For this, you would use the subscription IAP item. Access to advanced features would be available while the subscription was active, and inactive otherwise. You can also use subscription IAP items so a user can subscribe to a stream of entitled items like magazines. As long as you are subscribed, you get issues that you become entitled to even after your subscription ends.

Consumable items: If you have an app in which the user spends game currency, you would want a consumable IAP transaction. In a consumable IAP transaction, users get a set quantity of something, usually power-ups, hints, un-do actions or coins that they consume during play. Once they are out, they can buy more.

Mobile Ads: If you want to collect revenue by displaying ads on your site, then the Mobile Ads service is for you. You can display a traditional banner advertisement (anywhere on your screen above the fold), you can display expandable interactive ads, and you can even pop up large views displaying our largest ads for an interstitial ad experience.

Mobile Associates: If your app is a natural compliment for a physical good, then you will like the Mobile Associates program and API. If, for example, you have a GPS phone app, you could probably earn some revenue share income by offering hiking or outdoor-related items from the Amazon.com store to your customers. Your revenue-share in the Mobile Associates program varies depending on the category of the item sold, but you can use this API set to sell one item and never have the user exit the context of your app, or you can collect a rev-share on an entire shopping-cart of items that a user will purchase in the Amazon.com UI.

Other APIs

Okay, these APIs don’t generate revenue directly, but they are so important to generating revenue I had to find a way to get them in this post.

A|B Testing: Now you can test to see what makes more money in the real world.

Have you ever wondered if placing an In-App-Purchase dialog box at the beginning of a level or at the end of a level would result in more revenue? Now you can find out which is actually best with real users. You can test any set of conditions and successes to find the combination that is most profitable for you. And you can change the variables and the mix without having to re-submit your app. (works on all Android app stores).

GameCircle: The current version of GameCircle is free, and provides your users with saved game syncing, achievements, and leaderboards that work on most Android apps sold from any Android marketplace. The cross-store capability is nice, but the big take-away here is that games with GameCircle make 83% more average revenue per user than games that don’t.

So it turns out that there are a lot of things Amazon is doing to help you make the most from your app (documentation for the APIs can be found in our dev portal here) It’s easy to start selling your apps on Amazon. Just click here to create a free account today.

August 13, 2013

Peter Heinrich

Amazon GameCircle and the other game services we offer are designed to make mobile game development easier, but knowing where to start may still be difficult. To offer a bit of guidance, I thought it might be worthwhile to take a small, simple game and walk through the process of extending its functionality, one service at a time. Together we’ll gradually add features over the course of several posts, each one focusing on a specific way Amazon services speed development or reduce code complexity. At the end of the series, we’ll have a working game application that shows these services in action and demonstrates how you might incorporate them into other projects.

As the title implies, this post will kick off the series with a look at GameCircle, which supports leaderboards, achievements, and Whispersync for Games, a powerful mechanism to synchronize local and cloud data. Games have been saving progress and celebrating player success since the beginning, so GameCircle seems like a good place to begin our journey.

Prerequisites

Note that this blog series assumes that you are comfortable developing for Android using Java and Eclipse, and that your development environment is set up and working properly with the Android Developer Tools (ADT). Some Amazon services are available only on Kindle Fire, so that will be our target device throughout the series. You must install the Kindle Fire SDK add-ons in order to use those features. For more information, see the Get Started section of Kindle Fire Development Resources.

Importing the Monster Tag Project

Before we begin, we need a simple game that will serve as the base for our experimentation and improvements. Monster Tag displays a horde of monsters and asks the player to tag them as they bounce around the screen. Every time a monster is tagged, it gets startled and speeds off in another direction. The faster a monster is moving when it’s tagged, the more points are awarded to the player.

To import the Monster Tag project into Eclipse, download and extract the source bundle to a convenient location, then choose File | New | Project… from Eclipse’s main menu. Expand Android and select Android Project from Existing Code, then click Next

Click Browse… to navigate to the temporary location where you extracted the source code, then click OK. Check Copy projects into workspace and click Finish

Once the project has been loaded successfully, you will see it in the Package Explorer:

Launch the application in the debugger for the first time by selecting the MainActivity and choosing Run | Debug As | Android Application from Eclipse’s main menu. You should see a lot of little orange guys flying around, daring to be tagged.

Establishing Trust

We have a basic game application running, but we’re still not ready to integrate GameCircle and use it to track high scores online. The GameCircle service won’t accept connections from just any mobile application—it authenticates requests to ensure they’re coming from trusted apps. Every app or game that wants to access GameCircle (and some other Amazon services) must have an “API key,” which is associated with a security profile for that app. The key tells GameCircle that our app is trustworthy.

To establish a security profile and obtain an API key, we must first let Amazon know about our game, which we do on the Mobile Application Distribution Portal. Sign in or create a developer account there if you don’t already have one. (If you’re creating an account for the first time, you’ll be asked to supply some basic information and agree to some terms and conditions. If you intend to create paid apps, you’ll have to provide some extra info, as well.)

Once you’ve logged in, go to the Apps & Services tab and hover over the Add a New App drop-down, then select Add new Android App. Now we can tell Amazon the details of our game:

Generating a Security Profile

After clicking Save we could add more details, such as pricing, icons, and screenshots, but for now we’ll skip those steps and jump right to creation of a security profile. Follow the Security Profile link that appears under the app title on the next screen, then click the Create a New Security Profile button.

You’ll be asked to name the security profile. Note that you can share security profiles between applications, which we’ll discuss in a later post. For now, we’ll assume only Monster Tag will use this one, so we’ll name it accordingly:

Creating an API Key

Now we have a security profile, but no API key has been associated with it yet. Follow the API Keys link that appears after the profile name, then fill in the required fields and click Generate.

NOTE: What you enter in the signature field, below, will depend on your own development environment; you must supply the MD5 signature of your own debug keystore. You can find information about obtaining this value in the Debug application signature section of Getting Your OAuth Credentials and API Key. Typically this involves using keytool (installed as part of the JDK) from the command line:

keytool -list -v -alias androiddebugkey -keystore /path/to/debug.keystore

You should be asked to supply a password, which is “android” by default (no quotes). Check the output for the MD5 signature, highlighted below:

...

Certificate fingerprints:

         MD5:  D4:81:0C:AA:3D:45:DE:45:59:F2:BE:DE:95:A8:E1:65
         SHA1: A1:DF:DD:0D:89:77:81:24:E0:AF:47:AA:B6:55:B6:14:58:7D:4C:E4
         SHA256: 5:50:7F:6F:43:2C:3E:CD:D6:46:F1:F7:96:F2:ED:DE:E8:DD:3A:53:00
         Signature algorithm name: SHA1withRSA
         Version: 3

Adding an API Key to an Eclipse Project

Generating the API key will result in a long base64-encoded string. This is the magic value we need to include in our project to identify our app as trustworthy.

To add it to the project, create a new file called /assets/api_key.txt and paste in the value. Note that api_key.txt must be located in the /assets subfolder.

Enabling GameCircle Data for a Security Profile

Next, we must indicate that there will be GameCircle data associated with the security profile we just created, and that our Monster Tag game will use it. Go to the GameCircle configuration page, select the security profile we created and click Confirm.

Connect a Security Profile to the App

To connect our game to the correct GameCircle data, go to the My Apps tab of your profile, click the Monster Tag app, then follow the Security Profile link. Click the Monster Tag radio button and confirm the action by selecting Apply Profile on the dialog that appears.

Next Steps

Success! Our app is registered with Amazon, there’s a security profile associated with it, and we generated a corresponding API key and added it to our project. We’re ready to use GameCircle and it’s ready to accept requests from our mobile application.

In the next installment of this series, we’ll use GameCircle’s built-in leaderboard functionality to track high scores and let users compete with each other. Now that we have the app and security bookkeeping out of the way, it will be a cakewalk.

 

August 01, 2013

Peter Heinrich

Following up on the second in a series of webinars covering Amazon devices, game services, and mobile applications, here’s a list of questions we collected during and after our presentation on Amazon GameCircle, including Achievements, Leaderboards, and Whispersync for Games.

 

Does the developer have access to the GameCircle nickname?

Yes, you can call getLocalPlayerProfile(), which returns a structure containing player id and player alias (same as nickname/username). NULL is returned if the player is in guest mode (they have not logged in). Player id is unique for each player.

When updating Achievement Progress can you decrement it as well or does the GameCircleCient hold onto the latest highest progress value?

Achievement progress is strictly increasing, which means updates must be greater than the current value or they’ll be ignored. Note that you can reset achievement data for draft achievements (those that have not yet been published).

With the update, does GameCircle still support Kindle Fire 1?

Yes. The GameCircle system app must be updated to v1.1_1101110, however. This should have been delivered OTA. On KF2, the GC system app should be v2.5.2500310 or greater.

Can leaderboards/achievements be translated?

Not yet, but localization is in development and will be available in a future release.

Is the same game discovery mechanism on Kindle Fire available on all Android devices as well?

The dedicated Games Tab is built in to the games library on Kindle Fire only. It’s not available on other Android devices.

What is the minimum OS supported?

GameCircle supports API level 10 up to API level 16 on all Android devices.

Is GameCircle available internationally?

Yes, GameCircle works internationally. Players in China are limited to Guest mode for now, due to data storage requirements imposed by the Chinese government, but we will address that in a future release.

Is the old version of GameCircle still supported?

Yes, for legacy games. Games that have been published using GameCircle v1.x will continue to work. If you had a game in development when GameCircle v2.0 was released, you can proceed to publish it using the old version. Since the Mobile App Distribution Portal no longer provides direct support for GameCircle v1.x app whitelisting, however, you must contact us to add or update package name/signature pairs. See the Whitelisting Notice on the GameCircle configuration page for more information.

What happened to the FileSync and BlobSync from Whispersync?

We greatly simplified the Whispersync interface to make it easier to integrate and expand auto-resolution of data conflicts. As a result, we dropped support for the blob and multifile sync options. They were complicated to integrate and forced the developer to manually reconcile data on occasion (or to ask the customer to do so). The new Whispersync requires significantly less integration overhead and provides a better customer experience in most cases.

Can I migrate old Whispersync data to the new format?

Yes, there are two methods on the WhispersyncClient that can help in the migration process. migrateVersion1GameData() and unpackVersion1MultiFileGameData() will download and unpack data stored using the previous version, respectively. They’re only meant to be used by games that integrated Whispersync prior to July 1, 2013. See the Javadoc for more info.

Is there any way to integrate game circle in Air apps?

Amazon provided an Adobe Native Extension (ANE) for GameCircle v1.x, but none is yet available for the new version. We are actively researching an upgrade to the existing ANE, but don’t have an official timeline. Check back here or follow @peterdotgames for updates on the availability of a new ANE. In the meantime, you can continue to the existing extension with GameCircle v1.x for games currently in development.

Where can I learn more about Unity plugin for game circle?

Check out the Amazon Unity Plug-Ins page on the Amazon Mobile App Distribution Portal.

Do users need to login with Amazon account username and password to use the game services?

No, GameCircle now supports a Guest Mode for users who don’t want to log in to an Amazon account. In this case, data will not be synchronized to the cloud or across devices.

Is there a good game to play to check out the features?

There are many great games that include GameCircle features, including well-known blockbusters and high-quality indies. In the Amazon Appstore, look for the GameCircle badge to quickly identify games that use Achievements, Leaderboards, or Whispersync for Games.

 

Don’t miss out next webinar event: How to Integrate Amazon Mobile Ads and Lift Your App Revenues 
on August 15th, 2013 @ 10:00 AM.

Pre-register here!

July 23, 2013

Peter Heinrich

Save game data in the cloud to protect your customers’ progress and support play from multiple devices

In just a few short years, the explosion in popularity of smart phones and tablets has transformed gaming, as touch controls, geolocation, and micropayments enter the mainstream. Online storage is also becoming more common, as developers adjust to a major challenge of mobile devices: physical durability. Keeping your data in the cloud starts to look mighty attractive compared to keeping it on a device that’s easily misplaced, damaged, or stolen.

Blob storage is a common way to save data online (game data is simply written to the cloud as one big chunk). If two devices update the same data, though, one of the updates must be ignored or overwrite the other. You have to decide which update to keep (based on a timestamp or version number, perhaps), or maybe prompt the user to choose between them. Either way, data is lost.

Because of the overhead involved, many developers don’t even bother with this naïve approach. This is a huge disservice to the player, whose game progress is completely lost if anything happens to his or her mobile device. Whispersync for Games saves game data for you, and works across all Android devices (including Kindle Fire).

Mergeable and Non-mergeable Data

Whispersync was designed to prevent data loss, make developer or player intervention unnecessary when resolving conflicts, and be dead-simple to integrate and use. It doesn’t distinguish between online and local storage, so the programmer doesn’t have to handle separate cases for saving to disk and cloud. It does this by manipulating only mergeable data.

Game data is mergeable if a simple rule can be defined to resolve conflicting values. For example, the rule associated with the best completion time might be, “Take whichever value is smallest.” To keep track of a player’s best score, we might use, “Take whichever value is highest.” In some cases, the most recent value may be the most important, so the appropriate rule would be, “Take whichever value is newest.” These rules apply at a granular level; Whispersync doesn’t treat game data as one big chunk.

Not all game data can be resolved using simple rules, though, in which case we call it non-mergeable. The current state of a chess board, for example, requires a complex tree structure to describe it. Reconciling two versions of the board is more complicated than just choosing the “lowest” or “highest” one.

Describing Game Data Using Syncable Types

Fortunately, a lot of game data is naturally mergeable or can be adjusted to be so. Whispersync offers many different syncable types with several built-in rules to resolve conflicts. They can be used to model simple and complex game data.

  • SyncableNumber – A number that is the lowest, highest, or most recent.
  • SyncableString – A string that is the most recent.
  • SyncableAccumulatingNumber – A number that can be incremented and decremented.
  • SyncableNumberList – A list of numbers in ascending, descending, or latest order.
  • SyncableStringList – A list of strings ordered by most recent.
  • SyncableStringSet – A set of strings.
  • GameDataMap – A nested map, allowing hierarchical data.

A global GameDataMap object represents the root storage for your game, storing named values of the types above. Setting a value that doesn’t exist will create it on the fly. The accessor used to retrieve a value determines the conflict resolution strategy that will be associated with it.

  public static final String SKILLS = "skills";
  public static final String TOTAL_TIME = "totalTime";

  public static final String LEVEL_MAP = "levelMap";

  public static final int NUM_LEVELS = 5;
  public static final int MAX_ITEMS = 3;

  public static final String SCORE = "score";
  public static final String STARS = "stars";
  public static final String BEST_SCORES = "bestScores";
  public static final String BEST_TIMES = "bestTimes";

  GameDataMap gameDataMap;

  public void initGameData() {
    gameDataMap = AmazonGamesClient.getWhispersyncClient().getGameData();

    // These will be independent of level.
    gameDataMap.getStringSet(SKILLS);
    gameDataMap.getAccumulatingNumber(TOTAL_TIME);

    // Use nested maps to establish some per-level values.
    for (int i=0; i < NUM_LEVELS; i++) {
      GameDataMap levelMap = gameDataMap.getMap(LEVEL_MAP + i);

      // Each level will have its own copy of these values.
      levelMap.getLatestNumber(SCORE);
      levelMap.getHighestNumber(STARS);
      levelMap.getHighNumberList(BEST_SCORES).setMaxSize(MAX_ITEMS);
      levelMap.getLowNumberList(BEST_TIMES).setMaxSize(MAX_ITEMS);
    }
  }

In the example above, we use initGameData() to establish the structure of the data we’ll synchronize, even though we don’t actually set any values. (It can be helpful to define the data layout in one place like this, even if it’s not strictly required.) The code effectively says,

  • There will be a global set of strings called SKILLS. It will track every string added to it (strings may not be removed).
  • There will be a global running total of time in the game called TOTAL_TIME. It will accumulate deltas submitted from all devices used by a single player.
  • There will be NUM_LEVELS nested maps, each of which will have its own set of values:
    • SCORE will always reflect the last score submitted for that level.
    • STARS will always reflect the maximum stars attained for that level.
    • BEST_SCORES will always list the MAX_ITEMS highest scores for that level.
    • BEST_TIMES will always list the MAX_ITEMS fastest times for that level.

Updating and Retrieving Game Data

Whispersync abstracts all game data persistence, so we can update or retrieve values using simple getters and setters. We don’t have to worry about managing a network connection, saving to disk or the cloud, or reconciling local and online versions of variables we have in memory. When we add to the running total of time played, for example, Whispersync automatically saves the delta to disk and updates the cloud if connected. If the player’s device is currently offline, the update will be queued and delivered later.

  public void updateTotalTime(int timePlayed) {
    SyncableAccumulatingNumber totalTime = gameDataMap.getAccumulatingNumber(TOTAL_TIME);

    // Add the time played to the running total.
    totalTime.increment(timePlayed);

    // Output the new total to the console.
    System.out.println("Total Time Played = " + totalTime.asInt());
  }

Likewise, we can record skills as the player masters them and easily iterate over the set to display the ones learned so far:

  public void learnSkill(String skill) {
    SyncableStringSet skillSet = gameDataMap.getStringSet(SKILLS);

    // Add the new skill to the player's repertoire. Note that this list

    // can only expand; strings cannot be removed.
    skillSet.add(skill);

    // Output all skills to the console.
    for (SyncableStringElement s : skillSet.getValues()) {
      System.out.println("Skill = " + s.getValue());
    }
  }

Updating numbers and number lists is just as straightforward, so persisting all of the player’s progress at the completion of a level can be done in just a few lines:

  public void finishLevel(int level, int score, int stars, int time) {
    GameDataMap levelMap = gameDataMap.getMap(LEVEL_MAP + level);

    // Save the score for this level. Newer values will always overwrite
    // previous scores.

    levelMap.getLatestNumber(SCORE).set(score);

    // Try to set the new maximum stars attained on this level. If the
    // value is less than the current maximum, this call does nothing.

    levelMap.getHighestNumber(STARS).set(stars);

    // Try to add this score to the list of all-time bests. If it's not
    // high enough, this update will be ignored.

    levelMap.getHighNumberList(BEST_SCORES).add(score);

    // Try to add this completion time to the list of all-time bests. If
    // it's not low enough, this update will be ignored.

    levelMap.getLowNumberList(BEST_TIMES).add(time);
    updateTotalTime(time);
  }

The accessors on GameDataMap and Whispersync’s syncable types make it easy to manipulate game data and define how conflicts should be resolved.

Think Mergeable!

Whispersync for Games automatically resolves conflicts for data it can merge, which makes it worthwhile to describe game data using syncable types when possible. Since Whispersync supports high, low, and most recent numbers and number lists; running totals; latest strings and string lists; sets of strings; and nested maps supporting hierarchical structures, a wide range of game data can be modeled.

Thinking about your game data in mergeable terms lets you push a lot of overhead out of your code. Let Whispersync handle the heavy lifting. For more information on integrating Whispersync into your game, see the online documentation

 

July 04, 2013

Peter Heinrich

Continuing our series of success stories from developers around the world, we go to France, where developers are witnessing strong positive results less than a year after the launch of the Amazon Mobile App Distribution Program in August 2012.

Ubisoft’s PC and console titles have been available on Amazon for a long time, helping to build a great partnership between both companies over the years. As Ubisoft strengthened its mobile offering, it was a natural progression for their Android games to be made available on Amazon and to Kindle Fire users. Dominique Tardieu, Sales and Marketing Director at Ubisoft Mobile, explains: “Amazon and Kindle Fire tablets hold a significant potential for our mobile games as they become more and more widespread. Also, Amazon has developed a meaningful ecosystem for Kindle Fire games via Amazon GameCircle. This gives us the possibility to leverage the social aspects of our games, through Player vs Player functionality and leaderboards, for instance.”

Since September 2012, Ubisoft has successfully launched a variety of best-selling games on Amazon, including Rayman Jungle Run, Prince of Persia, and (more recently) Nutty Fluffies. An important element of these games’ success so far has been Amazon personalization and recommendations. Tardieu says, “The experience they bring in terms of customer relationship management and knowledge of the industry has made it possible for us to ensure a successful launch for all our titles. Amazon clearly benefits from the know-how acquired over the years working on Ubisoft’s console and PC games and has learned how to harness it to successfully promote the right content to the right consumers.”

About Ubisoft:
Ubisoft is a leading producer, publisher, and distributor of interactive entertainment products worldwide and has grown considerably through a strong and diversified line-up of products and partnerships. Ubisoft has offices in 26 countries and operates in more than 55 countries around the globe. It is committed to delivering high-quality, cutting-edge video game titles to consumers. For the 2011-12 fiscal year, Ubisoft generated sales exceeding €1 billion. To learn more, please visit: www.ubisoftgroup.com

 

June 30, 2013

Peter Heinrich

We just released a major update to Amazon GameCircle, our free game service providing achievements, leaderboards, and Whispersync for Games. Games on all Android devices (including Kindle Fire, of course) can now integrate GameCircle, which is easy because we support Java, JNI, and Unity3D. Whether you submit your game to Amazon or Google, customers will benefit from the GameCircle experience. In addition, Whispersync has been dramatically improved, becoming the first and only cloud-save service to:

1) Automatically resolve data conflicts between mobile devices and the cloud,

2) Queue updates to support offline operation, and

3) Offer a simple interface that can be integrated in minutes.

The result: Your customers’ game data will automatically sync across devices—even if they play your game while temporarily offline—and you can concentrate on using the data instead of persisting it. You’re not locked in, though; you retain ownership and can always get a copy of the data you store.

We also give you flexibility when it comes to GameCircle display options, with no intrusive splash screen and configurable notification toasts. You’re in control and choose where they appear.

I’ll provide more technical details about these enhancements in future posts, but for now, let’s take a closer look Whispersync and explore its powerful new features and simplified interface.

Whispersync for Games

Whispersync does the heavy lifting when it comes to synchronizing local data to and from the cloud. It handles the tricky scenarios that you would normally have to deal with yourself, like conflicting updates from multiple devices or sync requests from a device that’s temporarily offline. You can also stop worrying about scalability; behind the curtain, Whispersync (and all of GameCircle) is powered by Amazon Web Services like S3 and DynamoDB.

Using Whispersync is easy through an API that has been completely redesigned, providing an interface similar to SharedPreferences. Saving game data to the cloud and synchronizing it between devices is as easy as retrieving a variable from a map and using (or changing) its value:

    // Get the global game data map for the current player.
    GameDataMap gameDataMap = AmazonGamesClient.getWhispersyncClient().getGameData();

    // Look up the object representing the player’s skill rating.
    // If none exists, one will be created.

    SyncableNumber skillRating = gameDataMap.getHighestNumber("skillRating");
    System.out.println("skillRating = " + skillRating.asLong());

    . . .

    // Update the value. As long as this device is online (or as soon as
    // it is), local and cloud storage will be synced.

    skillRating.set(MAX_SKILLRATING);

Whispersync maintains a singleton instance of GameDataMap that acts as the root of your game data. It can track numbers, strings, simple lists, and other maps, and gives you complete freedom in how you represent your game data using these basic syncable types. You add new variables simply by retrieving them by name; if they don’t exist, they’ll be created on the fly and synchronized from that point on.

How Whispersync applies updates and resolves conflicts depends on the way you access each syncable variable. For example, suppose you want to retrieve the current user’s best (highest) level across all devices:

    GameDataMap gameDataMap = AmazonGamesClient.getWhispersyncClient().getGameData();
    SyncableNumber bestLevel = gameDataMap.getHighestNumber( "bestLevel" );
    System.out.println( "bestLevel = "  + bestLevel.asLong());

In this case, because “bestLevel” is retrieved as a highest number, it will always reflect the maximum value ever assigned to it, from anywhere, on any device.

String values can also be synced. You could easily set the name of the latest power-up collected:

    gameDataMap.getLatestString( "lastPowerUp" ).set("Super Boingo"); 

The syncable string associated with “lastPowerUp” will always reflect the value most recently assigned to it.

The online documentation and Javadoc included with the SDK have more information on the syncable types Whispersync supports, as well as the ways in which each may be accessed.

Practical Applications

Let me provide a few more examples to illustrate just how straightforward synchronization can be.

Recording Star Count for Several Levels

A common pattern in many games is to show stars and unlock status for each level on a level selection screen. Here’s an example of using Whispersync to track individual star values for multiple levels:

  SyncableNumber[] getLevelStars() {
     GameDataMap gameDataMap = AmazonGamesClient.getWhispersyncClient().getGameData();
     SyncableNumber[] stars = new SyncableNumber[NUM_LEVELS];

     // Get the star counts for all levels.
    
for (int i = 0; i < stars.length; i++) {
        stars[i] = gameDataMap.getHighestNumber("levelStars" + i);
     }

     return stars;
  }

The first time the score values are accessed (from anywhere), Whispersync will create entries for them in the cloud, so there’s no need to declare them ahead of time.

Accumulating a Running Total

Some progress, like coins collected or time played, represents a running total that is always updated using a delta amount. Instead of setting the value directly, you just submit the amount by which it should change. Whispersync automatically adds or subtracts this value to update the current total. For example:

 void addTimePlayedToTotal(long timePlayed) {
    GameDataMap gameDataMap = AmazonGamesClient.getWhispersyncClient().getGameData();
    SyncableAccumulatingNumber totalTime =        gameDataMap.getAccumulatingNumber("totalTime");

    // This object may be incremented/decremented with long, double, and
    // BigDecimal values.

    totalTime.increment(timePlayed);
    System.out.println("Total time played: " + totalTime.asLong());
 }

Keeping a Map of Maps

By embedding a map within a map, you can create a hierarchical data structure. If your game has multiple worlds, for example, you might keep a separate GameDataMap for each one. Each of these might contain additional maps—say, one for each level.

 GameDataMap getWorldData(String name) {
    GameDataMap gameDataMap = AmazonGamesClient.getWhispersyncClient().getGameData();

    // Get all the string keys associated with top-level GameDataMap objects.
    Set<String> worldNames = gameDataMap.getMapKeys();

    // Look for a match among the maps.
    for (String currentName : worldNames) {
       if (currentName.equals(name)) {
          // A map exists for the name specified.
          return gameDataMap.getMap(currentName);
       }
    }

    // No match found. Don't create one.
    return null;
 }

Maintaining a List of Numbers

A racing game might save a player’s top three best times using a syncable number list. In this case, you could create a list for low numbers—they decrease as times improve—but you could easily choose to retain a collection of the highest or most recent values in other situations.

 // We'll initialize this once the application has launched.
 AmazonGames agsGameClient;
 GameDataMap agsGameData;
 SyncableNumberList agsBestTimes;

 // Create a callback to handle initialization result codes.
 AmazonGamesCallback agsGameCallback = new AmazonGamesCallback() {
    @Override
    public void onServiceReady(AmazonGamesClient client) {
       agsGameClient = client;
       agsGameData = AmazonGamesClient.getWhispersyncClient().getGameData();

       // Establish how many slots will be allocated and preserved.
       agsBestTimes = agsGameData.getLowNumberList("bestTimes");
       agsBestTimes.setMaxSize(3);
    }

    . . .
 };

  void finishLap(double time) {
   // Every time a lap is completed, try to add the lap time
   // to our list of best times. Only the lowest three will
   // ever be preserved.

   agsBestTimes.add(time);
 }

Every time the player finishes a lap, finishLap() would be called to update the number list. The value specified will be discarded unless it is lower than one of the current entries.

More to Come

The GameCircle improvements released in the latest update deserve more attention than the brief overview I’ve given here, so I’ll add details in the coming weeks. Look for articles dedicated to JNI; advanced API features; and using GameCircle with frameworks such as Unity3D, Cocos2d-x, and Marmalade. I’ll also dive deeper into Whispersync, discussing the difference between mergeable and non-mergeable data (and why it’s important), considerations when synchronizing currency across offline devices, and migration from the previous version. Stay tuned!

In the meantime, check out the new GameCircle release and give it a whirl. You’ll benefit whether you use the simplified Whispersync API and its expanded functionality, create a universal build to run on Kindle Fire and Android, or take advantage of the other features included with this update.