remix-save-game
Add save and load game state functionality via RemixSDK
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Add save and load game state functionality via RemixSDK
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Generate and add images to a Remix game
Generate and add sprites to a Remix game
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.
OpenAPI-first endpoint reference for Remix game publishing REST routes
Use the official Remix CLI for authentication, config inspection, game creation, uploads, and analytics. Trigger this skill when a task involves `remix login`, `remix whoami`, `.remix-cli.json`, `REMIX_API_KEY`, or terminal-based game management on Remix.
Quickstart for the official Remix MCP server. Use when configuring or operating `@remix-gg/mcp`, wiring MCP auth, or choosing the right Remix MCP tools and skill resources.
| name | remix-save-game |
| description | Add save and load game state functionality via RemixSDK |
This skill guides you through integrating save game state into an HTML game on the Remix platform. Save game state lets players persist progress across sessions -- scores, unlocked levels, inventory, and more -- using the RemixSDK.
<script src="https://cdn.jsdelivr.net/npm/@remix-gg/sdk@latest/dist/index.min.js"></script>
Call await window.RemixSDK.ready() before the game loop starts. This
ensures the SDK is loaded and any existing saved state is available.
await window.RemixSDK.ready();
Read window.RemixSDK.gameState to get previously saved data. It returns
Record<string, unknown> | null | undefined -- always check for null before
using it.
const savedState = window.RemixSDK.gameState;
Use the saved state to restore game progress, or fall back to defaults if the player is starting fresh:
const state = savedState ?? { score: 0, level: 1 };
Call saveGameState whenever the player reaches a meaningful checkpoint. The
gameState value must be a JSON-serializable object.
window.RemixSDK.singlePlayer.actions.saveGameState({
gameState: { score: player.score, level: player.level },
});
<script>
let clicks = 0;
async function init() {
await window.RemixSDK.ready();
// Load
const gameState = window.RemixSDK.gameState;
if (gameState && typeof gameState.clicks === "number") {
clicks = gameState.clicks;
}
document.getElementById("count").textContent = clicks;
document.getElementById("btn").addEventListener("click", () => {
clicks++;
document.getElementById("count").textContent = clicks;
// Save after every click
window.RemixSDK.singlePlayer.actions.saveGameState({
gameState: { clicks },
});
});
}
init();
</script>
<script>
let level = 1;
let coins = 0;
async function init() {
await window.RemixSDK.ready();
// Load
const saved = window.RemixSDK.gameState;
if (saved) {
level = saved.level ?? 1;
coins = saved.coins ?? 0;
}
startLevel(level);
}
function onLevelComplete() {
level++;
coins += 10;
// Save at level transitions
window.RemixSDK.singlePlayer.actions.saveGameState({
gameState: { level, coins },
});
startLevel(level);
}
init();
</script>