Avvio rapido
Iniziare con Pixi’VN
Puoi iniziare a usare Pixi’VN inizializzando un nuovo progetto o installando il pacchetto in un progetto esistente.
Prima di iniziare, è necessario avere installati i seguenti strumenti:
- Node.js versione 20.19.0 o successiva.
- Text editor with TypeScript support or AI coding app, such as:
- (Consigliato) Git
- Un account GitHub - Potrai usare Copilot (assistente IA), la generazione automatica di pacchetti da distribuire e aggiungere commenti al wiki
Inizializzazione del progetto
Se vuoi partire da un nuovo progetto, puoi usare il seguente comando per inizializzare un nuovo progetto con i template Pixi’VN:
npm create pixi-vn@latestPuoi vedere l'elenco dei template disponibili e le demo interattive qui.
Dopo l'inizializzazione del progetto, apri la directory del progetto con il tuo editor di testo (si consiglia VSCode) e inizia a sviluppare il tuo progetto.
Installazione
Per installare il pacchetto Pixi’VN in un progetto JavaScript esistente, usa uno dei seguenti comandi:
npm install @drincs/pixi-vnPuoi anche usare la versione CDN di questo plugin:
<script src="https://cdn.jsdelivr.net/npm/@drincs/pixi-vn@<version>/+esm"></script>Per una migliore esperienza di sviluppo, usa vitePluginPixivn e setupPixivnViteData.
import { defineConfig } from "vite";
import { vitePluginPixivn } from "@drincs/pixi-vn/vite";
export default defineConfig({
// ...
plugins: [
// other plugins...
vitePluginPixivn(),
],
});Per gestire gli errori in Pixi’VN, puoi usare la funzione Game.addOnError. Questa funzione accetta un callback che verrà chiamato ogni volta che si verifica un errore nel gioco.
Pixi’VN include una serie di Agent Skills che insegnano agli assistenti di programmazione basati sull'IA come utilizzare correttamente ogni parte del motore.
In LM Studio Bionic, chiedi all'agente di installare le skill da
https://github.com/DRincs-Productions/pixi-vn, oppure aggiungi i file delle skill in Settings → Skills. Per riutilizzare le skill installate per Codex o Claude Code, attiva Settings → Skills → Use skills found in other apps.
Codex:
npx skills@latest add DRincs-Productions/pixi-vn@latest --skill '*' --agent codex -g -yClaude Code:
npx skills@latest add DRincs-Productions/pixi-vn@latest --skill '*' --agent claude-code -g -yAltri agenti (universale):
npx skills@latest add DRincs-Productions/pixi-vn@latest --skill '*' --agent universal -g -yInizializzazione
Prima di usare il motore Pixi’VN, è necessario inizializzare il gioco. Puoi farlo chiamando il metodo Game.init.
import { Game } from "@drincs/pixi-vn";
const body = document.body;
if (!body) {
throw new Error("body element not found");
}
Game.init(body, {
height: 1080,
width: 1920,
backgroundColor: "#303030",
}).then(() => {
// ...
Game.start("start", {});
});
// read more here: https://pixi-vn.com/start/other-narrative-features.html#how-manage-the-end-of-the-game
Game.onEnd(async (props) => {
Game.clear();
// navigate to main menu
});
Game.addOnError((error, props) => {
console.error(`Error occurred`, error);
});
Game.onNavigate((path) => navigateTo(path));<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Game</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>html,
body {
background-color: #242424;
height: 100%;
}
body {
margin: 0;
min-height: 100vh;
display: flex;
overflow: hidden;
}