Démarrage rapide
Premiers pas avec Pixi’VN
Vous pouvez commencer à utiliser Pixi’VN en initialisant un nouveau projet ou en installant le paquet dans un projet existant.
Avant de commencer, vous devez avoir installé les outils suivants :
- Node.js version 20.19.0 ou ultérieure.
- Text editor with TypeScript support or AI coding app, such as:
- (Recommandé) Git
- Un compte GitHub - Vous pourrez utiliser Copilot (assistant IA), la génération automatique de paquets à distribuer et ajouter des commentaires au wiki
Initialisation du projet
Si vous souhaitez démarrer à partir d'un nouveau projet, vous pouvez utiliser la commande suivante pour initialiser un nouveau projet avec les modèles Pixi’VN :
npm create pixi-vn@latestVous pouvez consulter la liste des modèles disponibles et les démos interactives ici.
Après l'initialisation du projet, ouvrez le répertoire du projet avec votre éditeur de texte (VSCode est recommandé) et commencez à développer votre projet.
Installation
Pour installer le paquet Pixi’VN dans un projet JavaScript existant, utilisez l'une des commandes suivantes :
npm install @drincs/pixi-vnVous pouvez également utiliser la version CDN de ce plugin :
<script src="https://cdn.jsdelivr.net/npm/@drincs/pixi-vn@<version>/+esm"></script>Pour une meilleure expérience de développement, utilisez vitePluginPixivn et setupPixivnViteData.
import { defineConfig } from "vite";
import { vitePluginPixivn } from "@drincs/pixi-vn/vite";
export default defineConfig({
// ...
plugins: [
// other plugins...
vitePluginPixivn(),
],
});Pour gérer les erreurs dans Pixi’VN, vous pouvez utiliser la fonction Game.addOnError. Cette fonction prend un callback qui sera appelé chaque fois qu'une erreur se produit dans le jeu.
Pixi’VN fournit un ensemble d’Agent Skills qui apprennent aux assistants de programmation IA à utiliser correctement chaque partie du moteur.
Dans LM Studio Bionic, demandez à l’agent d’installer les skills depuis
https://github.com/DRincs-Productions/pixi-vn, ou ajoutez les fichiers de skills dans Settings → Skills. Pour réutiliser les skills installées pour Codex ou Claude Code, activez 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 -yAutres agents (universel) :
npx skills@latest add DRincs-Productions/pixi-vn@latest --skill '*' --agent universal -g -yInitialisation
Avant d'utiliser le moteur Pixi’VN, vous devez initialiser le jeu. Vous pouvez le faire en appelant la méthode 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;
}