Is your mobile app or game built to run on multiple platforms? Do you want a fast, straightforward solution to common problems like data synchronization, player achievements, and leaderboards? Amazon offers several services that allow you to plug-and-play features in your mobile app or game, with very little set-up and no server-side development. This session provides instructions for integrating GameCircle (Whispersync for Games, Achievements, Leaderboards) in your Android apps, and demonstrates how to add A/B Testing and fine tune your app based on user response. Learn how to speed up your time to market, regardless of whether you distribute through Google Play or the Amazon Appstore.
4. Whispersync: Downloading from Cloud
•
•
•
How:
– 1.x:
• multi-file synchronize API call and setup conflict strategy
– 2.0:
• via Whispersync callbacks & GameDataMap Handle
What:
– 1.x:
• developer string + all files residing in the internal memory for that game
– 2.0:
• Developer string + syncablestring (i.e. raw game data)
When:
– game launch - AmazonGamesClient.getWhispersyncClient().synchronize();
5. Whispersync: Uploading to Cloud
•
•
What:
– developer string and raw game data byte[] (using SyncableString).
When:
– game calls save.
– force save (flush) before closing the game [WhispersyncClient->flush()]
6. Whispersync: Uploading to Cloud
Code Sample
public static void sync( String developerStringLocal, byte[] rawGameData )
{
developerStringCloud.setValue(developerStringLocal);
rawDataLocal = rawGameData;
}
private static void onDataUploadedToCloud()
{
// Once cloud data is available on the device, Whispersync can check for conflicts
if (developerStringCloud.inConflict())
{
//display the values to the user.
if(useCloudData)
{
developerStringCloud.setValue(developerString.getCloudValue());
OverwriteLocalSaveData(rawDataCloud);
developerStringCloud.markAsResolved();
Restart();
}
developerStringCloud.markAsResolved();
}
rawDataCloud.set(Base64.encodeToString(rawDataLocal, Base64.DEFAULT));
whisperSyncClient.synchronize();
}
7. Whispersync: Developer String
• Pick data which is core to the game
– Should make sense to the user.
• Data that changes in one direction
– Player Level, Missions/Levels Unlocked, etc.
• Data to avoid
– Data the changes in both direction — e.g., currencies, energy,
etc.
12. Whispersync: Developer String
• Ideal for games that haven't modeled the save
data according to GameCircle 2.x’s Syncable
Data Types
• Easy to implement
• User gets to make the choice
• Auto-resolving is risky
• Works offline
14. Whispersync & Unity - Tips & Tricks
• Avoiding game restart on first launch
– Loading cloud data is asynchronous:
• Halt the game progress before game state is loaded from disk
• If Whispersync callback successfully retrieves data from cloud and
it is the first launch, then load game state using cloud data
15. 1.x 2.x - Tips & Tricks
• In the Whispersync onNewCloudData callback:
– Retrieve developer string from gameDataMap. If the string is
null, only then do the migrations mentioned below:
• Single file steps:
– API call to retrieve 1.x data
– Load game from the cloud data
• Multi-file steps:
– API call to retrieve 1.x files
– API call to copy 1.x files to specific location
17. Engagement is Important
56%
62%
35%
of purchases are
repeat purchases
of revenue occurs
after the first 7 days
of revenue occurs
after the first 30 days
Source: Amazon Appstore, July 2013
28. Submit a Score
AmazonGamesClient agsClient;
public void submitScore(long score) {
LeaderboardsClient lbClient = agsClient.getLeaderboardsClient();
AGResponseHandle<SubmitScoreResponse> handle = lbClient.submitScore(TAGGED_LB, score);
// Optional callback to receive notification of success/failure.
handle.setCallback(new AGResponseCallback<SubmitScoreResponse>() {
@Override
public void onComplete(SubmitScoreResponse result) {
if (result.isError()) {
// Retries are automatic, so no action strictly required
} else {
// Special handling of your own.
}
}
});
}
29. Other APIs
•
•
•
•
Retrieve player’s current score or rank
Retrieve filtered list of top scores
Get a list of leaderboards
Show the Leaderboard overlay
34. Air Patriots
Used A/B Testing to decide:
• Include in-game advertising?
• Provide purchasing short-cuts?
• Notification frequency?
• Reduce difficulty?
• Promotional imagery?
39. Multiple Projects Are Allowed
private static final String AB_MAXACC = "Acceleration";
private static final String AB_MAXACC_VAR = "maxAcceleration";
private static final String AB_MAXVEL = "Velocity";
private static final String AB_MAXVEL_VAR = "maxVelocity";
40. Load Variation Variables
private static final int DEF_MAXACC = 5;
private static final int DEF_MAXVEL = 50;
private int maxAcc;
private int maxVel;
private void loadTreatment() {
ABTestClient abClient = insightsInstance.getABTestClient();
abClient.getVariations(AB_PRJ_VEL, AB_PRJ_ACC).setCallback(new InsightsCallback<VariationSet>() {
@Override
public void onComplete(VariationSet variations) {
Variation variation = variations.getVariation(AB_PRJ_ACC);
maxAcc = variation.getVariableAsInt(AB_VAR_MAXACC, DEF_MAXACC);
variation = variations.getVariation(AB_PRJ_VEL);
maxVel = variation.getVariableAsInt(AB_VAR_MAXVEL, DEF_MAXVEL);
}
});
}
41. Let Us Do That for You
• Amazon GameCircle
– Data Synchronization with Whispersync for Games
– Player Engagement with Leaderboards and Achievements
• A/B Testing
– Real-time Control Knobs for Live Apps with Launches
42. Please give us your feedback on this
presentation
MBL309
As a thank you, we will select prize
winners daily for completed surveys!