Migration guide
Migration from v1.3.x to v1.4.0
This document describes the changes that need to be made to your code to migrate from v1.3.x to v1.4.0.
In this release, some functions for managing "navigation of the narrative" have been modified to allow for the easy implementation of rollback and rollforward. Specifically, it is now possible to execute multiple back and continue requests synchronously, and the system will internally queue them and calculate the delta to execute only the necessary processes. You can read more about this in the Rollback and Rollforward section.
For this reason it was necessary to modify the stepHistory.back() function and the Game.init() function. stepHistory.back() now requires a path navigation function rather than a StepLabelProps function. You can now define the path navigation function in Game.init().
stepHistory.back((_path) => {
// TODO: navigate in the url path
// READ THIS: https://pixi-vn.web.app/start/interface.html#navigate-switch-between-ui-screens
})
const gameProps = {};
stepHistory.back(gameProps); Game.init(body, {
height: 1080,
width: 1920,
backgroundColor: "#303030",
navigate: (_path) => {
// TODO: navigate in the url path
},
}).then(() => {
// ...
});Some long-deprecated features have been removed in this release, including: stepHistory.goBack, narration.goNext, PIXI, canvas.canvasWidth, canvas.canvasHeight, canvas.onEndOfTicker, FadeAlphaTicker, MoveTicker, RotateTicker, ZoomTicker, narration.canContinue, narration.callLabel, narration.jumpLabel, narration.choiceMenuOptions, storage.startingStorage, storage.setVariable, storage.getVariable and storage.removeVariable.
Migration from v1.2.x to v1.3.0
This document describes the changes that need to be made to your code to migrate from v1.2.x to v1.3.0.
In this release, the canvas component animations have been revolutionized. The core animation function is now canvas.animate, a function that combines PixiJS tickers and motion. So the provided tickers preset (FadeAlphaTicker, MoveTicker, RotateTicker, ZoomTicker) has been deprecated.
Migration from v0.10.x to v1.0
This document describes the changes that need to be made to your code to migrate from v0.10.x to v1.0.
Being version 1.0.0 it is the first complete release of the library. It is a breaking change and the API has changed significantly. The fundamental change of this release was to split the entire engine into independent modules. This allows for a more modular and flexible design, making it easier to use the engine in different contexts. The size of packages has been reduced significantly (150 MB to 50 MB) and the engine is now more efficient and faster.
The Game namespace object has been introduced for the which contains all the functionality that exploits multiple modules. This is the main entry point for the engine and is used to access all the functions of the engine.
The stepHistory module has been introduced to manage the history of the game. Previously the entire management of the game's history was handled by narration.
clearAllGameDatas();
Game.clear(); canvas
.initialize(body, {
height: 1080,
width: 1920,
backgroundColor: "#303030",
})
.then(() => {
// Pixi.JS UI Layer
canvas.addLayer(CANVAS_UI_LAYER_NAME, new Container());
Game.init(body, {
height: 1080,
width: 1920,
backgroundColor: "#303030",
}).then(() => {
// Pixi.JS UI Layer
canvas.addLayer(CANVAS_UI_LAYER_NAME, new Container()); getSaveData();
Game.exportGameState(); getSaveJson();
JSON.stringify(Game.exportGameState()); loadSaveData(data, navigate);
Game.restoreGameState(data, navigate); loadSaveJson(data, navigate);
Game.restoreGameState(JSON.parse(dataString) as GameState, navigate); loadSaveJson(data, navigate);
Game.restoreGameState(JSON.parse(dataString) as GameState, navigate); jsonToSaveData(json);
JSON.parse(json); narration.canGoBack;
stepHistory.canGoBack; narration.back();
stepHistory.back(); narration.narrativeHistory;
stepHistory.narrativeHistory;