DataStoreService
Saved data that outlives game servers: progress, inventories and high scores. Server only.
- Get it:
import { DataStoreService } from '@rally/sdk' - Available on: Game server only.
Each game has its own data, shared by all of its servers and versions; other games can’t read it.
Open a store by name with getDataStore (any JSON values) or getOrderedDataStore (numbers you
can rank). A data store and an ordered data store with the same name are the same data.
Where the data lives depends on how the game runs:
| Running in | Data |
|---|---|
| A published game | Rally keeps it for the game. |
| Rally Studio’s Play | In memory, gone when Play stops. |
| A Studio test server | Starts empty and is thrown away when the test ends. |
On players’ devices every method throws: ask the server with a RemoteFunction. Store names and keys are 1–50 characters, and values up to 64 KB of JSON; see Limits.
Methods
Section titled “Methods”getDataStore
Section titled “getDataStore”getDataStore(name: string): DataStoreThe data store called name (1–50 characters).
getOrderedDataStore
Section titled “getOrderedDataStore”getOrderedDataStore(name: string): OrderedDataStoreThe ordered data store called name (1–50 characters), for ranking numbers.