Quick start
Getting started with Pixi’VN
You can start using Pixi’VN by initializing a new project or installing the package in an existing project.
Before starting, you must have the following tools installed:
- Node.js version 20.19.0 or higher.
- Text editor with TypeScript support or AI coding app, such as:
- (Recommended) Git
- A GitHub account - You will be able to use Copilot (Al assistant), auto-generation of packages to distribute and add comments to the wiki
Project initialization
If you want to start from a new project, you can use the following command to initialize a new project with the Pixi’VN templates:
npm create pixi-vn@latestYou can see the list of available templates and interactive demos here.
After the project is initialized, open the project directory with your text editor (VSCode is recommended) and start developing your project.
Installation
To install the Pixi’VN package in an existing JavaScript project, use one of the following commands:
npm install @drincs/pixi-vnYou can also use the CDN version of this plugin:
<script src="https://cdn.jsdelivr.net/npm/@drincs/pixi-vn@<version>/+esm"></script>For a better developer experience, use vitePluginPixivn and setupPixivnViteData.
import { defineConfig } from "vite";
import { vitePluginPixivn } from "@drincs/pixi-vn/vite";
export default defineConfig({
// ...
plugins: [
// other plugins...
vitePluginPixivn(),
],
});To handle errors in Pixi’VN, you can use the Game.addOnError function. This function takes a callback that will be called whenever an error occurs in the game.
Pixi’VN ships a set of Agent Skills that teach AI coding assistants how to correctly use each part of the engine.
In LM Studio Bionic, ask the agent to install skills from
https://github.com/DRincs-Productions/pixi-vn, or add the skill files in Settings → Skills. To reuse skills installed for Codex or Claude Code, enable 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 -yOther agents (Universal):
npx skills@latest add DRincs-Productions/pixi-vn@latest --skill '*' --agent universal -g -yInitialize
Before using the Pixi’VN engine, you must initialize the game. You can do this by calling the Game.init method.
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;
}