Cloud Save across Platforms & Devices
description
Transcript of Cloud Save across Platforms & Devices
Cloud Save across Platforms & Devices
Peter Heinrich, Technical Evangelist
Games Services,Appstore for Android
Customer Experience
“Amazon.com Core Values: A Customer Experience Obsession” – Flavio Martins, WinTheCustomer!
“Put Buyers First? What a Concept” – Joe Nocera, New York Times
“Amazon's obsession with customers pays off” – Matt Linderman, Signal vs. Noise
“If you do build a great experience, customers tell each other about that. Word of mouth is very powerful.” – Jeff Bezos
Save Customer Game Data!
Mobile Devices
Small $$$ Fragile
Easy to misplace or lose
Often targeted for theft
Easily damaged or broken
Mobile + Cloud, BFFs
DB
Use Cases Get Complicated
?
?
?
Real Money, Real Problems
!
Currency Is Tricky
Don’t allow offline purchases
Allow, but exclude consumables
Support negative balances
Even online devices need to coordinate balance updates between themselves
7205
Time Played across Devices
5 min 7 min 20 min
min
5 5+2 7+13
135, 2, or 13?
Time Played across Devices
5 min 2 min 13 min
min
2 135
7205
Time Played across Devices
5 min 2 min 13 min
min
2 135
Running Totals
Make each client a local authority
Keep subtotals and combine them in the cloud
Return total on demand
Sending deltas in updates is not idempotent
Other Game Data
No Restrictions = Lots of Work
1 2
3
132
Concurrency Control
Sequence
Mergeable DataUses a simple rule for conflict resolution, based on the nature of the data:
High Score – largest / biggest
Best Time – lowest / fastest
Last Monster – most recent
Optimistic Locking
1. Save local timestamp or sequence #
2. Update local value
3. Retrieve remote timestamp / sequence #
A. If local > remote, push to cloud
B. Else, pull from cloud
Conflict Resolution
Model data with mergeable types
Simple rules allow unattended conflict resolution
Nature of data defines rule
Common types: Highest / lowest number, most-recent string
Whispersync for Games
• Queues updates for offline operation
• Automatically resolves conflicts between mobile devices and cloud
• Lightweight API with fast integration
Syncable Types:Number lowest, highest, most recent
String most recent
AccumulatingNumber running totals
NumberList ascending, descending, latest
StringList most recent
StringSet
Map
Learn more: developer.amazon.com
Contact us: forums.developer.amazon.com developer.amazon.com/help/contactus.html
Follow us:@peterdotgames/AmazonAppstoreForAndroiddeveloper.amazon.com/blog