pixi-vn-saves

Implements save/load flows for Pixi'VN games using Game.exportGameState and restoreGameState.

145|9|Updated Feb 14, 2024
One-click install
npx skills add https://github.com/DRincs-Productions/pixi-vn --skill pixi-vn-saves-drincs-productions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pixi-vn-saves
Source: https://github.com/DRincs-Productions/pixi-vn/tree/main/skills/saves
Command: npx skills add https://github.com/DRincs-Productions/pixi-vn --skill pixi-vn-saves-drincs-productions

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @drincs/pixi-vn.

What problem does it solve? Building save/load functionality in a Pixi'VN game requires knowing how to export the full game state, restore it after a reload, and persist it across sessions — none of which the engine prescribes a storage layer for. This Skill provides the exact API usage and a proven persistence pattern so you don't have to reverse-engineer the save flow yourself. ## Core Features & Use Cases - State Export/Restore API: Covers Game.exportGameState(), Game.restoreGameState(), and Game.jsonToGameState(), including what a GameState contains (storage, canvas, sound, and history data). - Persistence Patterns: Documents the official React template's conventions for IndexedDB save slots, quick-save slots with LRU cycling, auto-save on page close via localStorage, a main-menu Continue button, and downloadable JSON save files. - Use Case: You need a "continue where I left off" feature after a page refresh. Use this Skill to wire exportGameState into a beforeunload handler writing to localStorage, then restore it on launch with restoreGameState. ## Quick Start Ask the AI to implement a save slot system with quick-save and auto-save-on-refresh for your Pixi'VN game using Game.exportGameState and Game.restoreGameState.

Frequently Asked Questions about pixi-vn-saves

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I save and load game state in Pixi'VN?

Call Game.exportGameState() to get a plain GameState object, serialize it with JSON.stringify, and later restore it with await Game.restoreGameState(Game.jsonToGameState(json)). The restore uses the navigate function set via Game.onNavigate or Game.init.

How to implement save slots in a Pixi'VN game?

The engine does not prescribe a storage layer, so wrap exportGameState() output in an app-level object with metadata like name, date, and thumbnail. The official React template stores these in IndexedDB with auto-incrementing ids, plus negative-id quick-save slots.

What data does a Pixi'VN GameState contain?

A GameState bundles version info plus storage variables, canvas element and layer state, sound channel and media state, and go-back history. History is capped by stepHistory.stepLimitSaved, which defaults to 20 steps.

Can I auto-save a Pixi'VN game when the page closes?

Yes, the official template pattern binds a handler to beforeunload and visibilitychange events that stringifies the save into localStorage. This preserves progress through accidental tab closes or reloads without using IndexedDB.

Does Game.restoreGameState take a navigate function?

No, restoreGameState only takes the GameState data as its argument. It uses whatever navigate function was previously set through Game.onNavigate or the navigate option in Game.init.