remix-game-sdk
Remix Game SDK Reference (@remix-gg/sdk)
Use this file when generating or repairing game code for Remix.
Runtime model
- In Remix-hosted uploads, the SDK is available as
window.RemixSDK. window.FarcadeSDKis still assigned as a backward-compatible alias, but new code should usewindow.RemixSDK.- Include SDK script in the HTML
<head>:<script src="https://cdn.jsdelivr.net/npm/@remix-gg/sdk@latest/dist/index.min.js"></script>
- Do not rely on package imports in uploaded single-file game code.
- Always call
await window.RemixSDK.ready()before reading player/game data.
Required hooks for v1 agent validation
These checks are required by GET /v1/games/{gameId}/versions/{versionId}/validate:
window.RemixSDK.singlePlayer.actions.gameOver({ score })window.RemixSDK.onPlayAgain(() => { ... })window.RemixSDK.onToggleMute(({ isMuted }) => { ... })
Commonly used SDK surface
Properties/getters:
window.RemixSDK.playerwindow.RemixSDK.playerswindow.RemixSDK.gameStatewindow.RemixSDK.gameInfowindow.RemixSDK.purchasedItemswindow.RemixSDK.inventorywindow.RemixSDK.shopItemswindow.RemixSDK.isReadywindow.RemixSDK.hasItem(itemId)window.RemixSDK.getItemPurchaseCount(itemId)window.RemixSDK.getShopItem(slug)
Useful gameInfo fields:
viewContextfor feed/full-screen/challenge/tournament contextcontentSafeAreaInsetfor overlay-safe mobile layoutinitialGameStatefor persisted state hydration
Single-player actions:
window.RemixSDK.singlePlayer.actions.gameOver({ score })window.RemixSDK.singlePlayer.actions.saveGameState({ gameState })window.RemixSDK.purchase({ item })window.RemixSDK.onPurchaseComplete(({ success, item }) => { ... })window.RemixSDK.singlePlayer.actions.reportError({ message, ... })window.RemixSDK.hapticFeedback()
Multiplayer actions:
window.RemixSDK.multiplayer.actions.gameOver({ scores })window.RemixSDK.onGameStateUpdated(callback)
Multiplayer actions/events are optional for basic single-player games.
Minimal integration template
async function initGame() {
const sdk = window.RemixSDK
await sdk.ready()
let muted = true
sdk.onToggleMute(({ isMuted }) => {
muted = isMuted
})
sdk.onPlayAgain(() => {
restart()
})
function finish(score) {
sdk.singlePlayer.actions.gameOver({ score })
}
function save(state) {
sdk.singlePlayer.actions.saveGameState({ gameState: state })
}
function restart() {
// reset local game state and render
}
// start gameplay loop...
}
initGame()
Mistakes to avoid
- Calling SDK getters before
ready()resolves. - Omitting one of the required validation hooks (
gameOver,onPlayAgain,onToggleMute). - Using non-existent SDK methods such as
vibrate,checkpoint, orsave. - Using
singlePlayer.actions.purchase(...)in new code when the SDK exposessdk.purchase(...). - Ignoring
contentSafeAreaInsetwhen HUD or controls can collide with mobile overlays. - Using
localStorage/sessionStorageas primary persistence instead ofsaveGameState.
More from farworld-labs/remix-skills
phaser-2d-arcade
Build mobile-first 2D browser games with Phaser 3 Arcade Physics
37remix-agent-publish
Build and publish Remix games with the current Remix toolchain. Use when work touches the official Remix CLI, MCP server, REST publishing APIs, or the @remix-gg/sdk game runtime.
37threejs-lite
Build lightweight mobile-friendly 3D browser games with Three.js
33remix-api-auth
Configure and verify authentication for Remix REST, CLI, and MCP workflows. Use when a task needs `REMIX_API_KEY`, `remix login`, stored Remix credentials, or auth troubleshooting.
32remix-add-sprite
Generate and add sprites to a Remix game
31remix-game-creation
Create a new game draft via the Remix API
31