assets
Use when adding, organizing, registering, or loading non-code files (images, audio, video) in a Pixi'VN project — local assets…
Use when implementing save/load in a Pixi'VN game — Game.exportGameState()/restoreGameState()/jsonToGameState(), what the exported GameState contains, and how to persist it (save slots, quick-save, auto-save-on-refresh, downloadable JSON). Load this before writing any save-file,
$ npx -y skills add drincs-productions/pixi-vn --skill saves --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/savesContext preview
The summary Claude sees to decide when to auto-load this skill.
Use when implementing save/load in a Pixi'VN game — Game.exportGameState()/restoreGameState()/jsonToGameState(), what the exported GameState contains, and how to persist it (save slots, quick-save, auto-save-on-refresh, downloadable JSON). Load this before writing any save-file,
name: pixi-vn-saves description: Use when implementing save/load in a Pixi'VN game — Game.exportGameState()/restoreGameState()/jsonToGameState(), what the exported GameState contains, and how to persist it (save slots, quick-save, auto-save-on-refresh, downloadable JSON). Load this before writing any save-file, save-slot, or "continue game" feature.
Official docs: [pixi-vn.com/start/save](https://pixi-vn.com/start/save).
Use this skill whenever a task involves saving/loading the game: a save-file format, save slots, a quick-save shortcut, "continue where I left off" after a page refresh, or exporting/importing a save as a file. This skill does not cover the module-level details of what's *inside* a save (storage variables — `pixi-vn-storage`; canvas element state — `pixi-vn-canvas`; step/backlog history — `pixi-vn-history`) — only the save/load flow itself and how those pieces fit together.
import { Game } from "@drincs/pixi-vn";
Game.exportGameState(): GameState
Game.restoreGameState(data: GameState): Promise<void>
Game.jsonToGameState(json: string): GameStatestorage, canvas, sound, and history data — suitable for `JSON.stringify`.
using whatever navigate function was set via `Game.onNavigate`/`Game.init`'s `navigate` option — it no longer takes a navigate function as a second argument.
wrapper around `JSON.parse` with the right type, for symmetry with `exportGameState`.
const json = JSON.stringify(Game.exportGameState()); // ... later, possibly after a page reload ... await Game.restoreGameState(Game.jsonToGameState(json));
A `GameState` bundles every module's current state: storage variables, the canvas's saved element/layer state (if the canvas was initialized), sound's channel/media state, and go-back history (capped by `stepHistory.stepLimitSaved`, default `20` — see `pixi-vn-history` for what that limit means for how far a player can go back after loading). `Game.exportGameState`/ `restoreGameState` is the layer application code should use — there's no need to go through any individual module directly for a full game save.
`Game.exportGameState()` says nothing about *where* that payload lives or what metadata a save-slot UI needs (title, timestamp, thumbnail). That part is entirely up to the app. The official React+TS template (`npm create pixi-vn@latest`, source at `src/models/GameSaveData.ts` / `src/lib/utils/save-utility.ts`) shows one concrete way to close that gap — **this is the template's convention, not a library requirement**:
interface GameSaveData {
saveData: GameState; // the raw Game.exportGameState() output
gameVersion: string;
date: Date;
name: string;
image?: string; // thumbnail, e.g. canvas.extractImage() — see pixi-vn-canvas
}
function createGameSave(options?: { image?: string; name?: string }): GameSaveData {
return {
saveData: Game.exportGameState(),
gameVersion: __APP_VERSION__,
date: new Date(),
name: options?.name ?? "",
image: options?.image,
};
}
async function loadSave(saveData: GameSaveData) {
await Game.restoreGameState(saveData.saveData);
}The pattern: wrap `exportGameState()`'s return value in an app-level object carrying save metadata, and pass the inner `saveData` field back into `restoreGameState()` when loading.
From there, the template persists that wrapped `GameSaveData` object (not the raw game state alone) through several concrete mechanisms — illustrative, not exhaustive:
`deleteSaveFromIndexDB`), auto-incrementing from `0`.
range below the numbered saves (e.g. ids `-2..-7` for 6 slots) so they never collide with manual saves. Each quick-save fills the first empty slot, then cycles by overwriting the least-recently-used slot once all slots are full.
the `beforeunload` and `visibilitychange` events) stringified straight into `localStorage` under its own key — not through IndexedDB — so an accidental tab close or reload doesn't lose progress.
the latest numbered IndexedDB save against the auto exit save and returning whichever is newer (synthesizing id `-1` for the auto exit save for that comparison) — `null` if neither exists, to disable the button; the result feeds straight into `loadSave`.
or sharing a save outside the app.
None of this is prescribed by `@drincs/pixi-vn` — treat it as one worked example of gluing `exportGameState`/`restoreGameState` to a real persistence layer, not the only way to do it.
Pixi’VN is a very versatile and powerful story-driven engine. It is based on JavaScript/TypeScript and PixiJS, and supports animated characters through Spine 2D and Live2D.
Use when adding, organizing, registering, or loading non-code files (images, audio, video) in a Pixi'VN project — local assets…
Use when adding, moving, or removing images, sprites, text, or video on the Pixi'VN game canvas, or when applying or creating…
Use when defining visual novel characters for a @drincs/pixi-vn game — creating a character with a name, color, icon and other…
Index and entry point of the Pixi'VN skill set — start here for any task on a @drincs/pixi-vn project, then follow the skill map…
Use when implementing "go back" / "rewind" / step-navigation features in a Pixi'VN game, or when you need to read the…
Use when upgrading an existing @drincs/pixi-vn project to a newer version, or when a runtime/type error matches a known breaking…