Game Info and Players
What sdk.ready() resolves with, and the getters that read the player, the safe area and the view context.
sdk.ready() resolves with a GameInfo object. It is the host telling the game who is playing and where. The same data is available afterwards through getters on the SDK.
GameInfo
type GameInfo = {
player: Player
players: Player[]
viewContext: 'feed' | 'full_screen' | 'challenge' | 'tournament'
contentSafeAreaInset: { top: number; right: number; bottom: number; left: number }
contentLayout?: ContentLayout
initialGameState: { id: string; gameState: Record<string, unknown> } | null
usersTurnId?: string | null
levelBased?: { levelCount: number; progress: LevelProgressState }
achievements?: AchievementsSnapshot
shopItems?: ShopItem[]
}
| Field | Meaning |
|---|---|
player | The local player: id, name, imageUrl, avatarTraits and purchasedItems. |
players | Everyone in the session. One entry in single player; every seat in a challenge. |
viewContext | Where the game is showing. feed means it is one card in a scrolling feed and should be instantly legible, not a tutorial. |
contentSafeAreaInset | Space at each edge, in CSS pixels, that device cutouts and the host's own controls cover. Keep anything the player must see or tap inside it. |
contentLayout | A finer layout, where the host sends one: the device safe area plus each host control and cutout as a rectangle. Read it through sdk.contentLayout, which falls back to contentSafeAreaInset, and test a HUD or touch target with sdk.isUiRectSafe({ x, y, width, height }). |
initialGameState | The last saveGameState payload, or null. See Saving Progress. |
usersTurnId | In turn-based challenges, the player the platform is waiting on. Trust it over your own state. |
levelBased | Present only when the platform runs this session as a level game. See Game Over and Levels. |
achievements | Declared achievements with the keys this player has earned. Read them through sdk.achievements. |
Getters
After ready() resolves, the same data is one property away:
sdk.isReady // boolean
sdk.player // Player | undefined
sdk.players // Player[] | undefined
sdk.gameInfo // GameInfo | undefined
sdk.gameState // the saved state; null or undefined when there is none
sdk.contentLayout // ContentLayout, or one built from the safe area
sdk.purchasedItems // string[]
sdk.inventory // { slug, quantity }[]
Level games also get sdk.isLevelBased, sdk.levelCount, sdk.currentLevelIndex, sdk.levelStars, sdk.highestUnlockedLevel and sdk.totalStars.
Avatars
player.imageUrl is a hosted image, which may be an SVG, or absent. Render it with an <img> and a letter fallback; do not feed it to a texture loader that expects a bitmap.
To draw the player as a character, read player.avatarTraits: their equipped Remix avatar as trait data (body, colors, clothing, face and hair). Every entry in players carries its own. It is absent for players without a Remix avatar, so keep a fallback look.
Guests
A signed-out player can still play. player is a guest record, and every write that needs an account (leaderboards, saves, achievements) resolves null. Show nothing extra on null and never block gameplay waiting on an answer.