Shared Group Data was originally designed to be driven by server-authoritative for most cases, and the previous advice was to not add players directly to the Shared Group data, as that gave them read/write permissions (allowing for cheating). However, our new API Access Policy allows a much greater variance in functionality and security over the original design. More details are available in the advanced section of this document.
Example: Turn-based multiplayer Async games
The original, and still best, use case for Shared Group data is best described as storing state for an online board game. players take turns modifying the data via CloudScript, with a clear turn order. Players can log off and resume play later, with their game state stored in the cloud. The following CloudScript example is the turn-based structure for any common board game. The board game itself is stubbed out as pseudo-code.Assumptions
The Shared Group Data that represents the game has already been started, and its membership is already defined.Key restrictions
- Shared Group Data:
- Only contains simple Key/Value Pair data (strings). For use as any other data type (such as Inventory items, Statistics, Virtual Currency, etc.), the title must provide any necessary conversions.
- Is neither sharded nor cached, so it will not be responsive when accessed simultaneously by multiple players. Features using it should be designed with small player groups in mind, and not allow for simultaneous writes.
