History
Describes how Pixi’VN tracks and manages narrative history, including dialogue, choices, step counters, and save limits.
UI screen
You can find an example of the history UI screen in the interface examples section.
Nomenclature
In this documentation, the term "narrative history" refers to the list of all dialogues, choices, and more that have been shown to the player.
Pixi’VN saves all dialogues, choices, responses, and more at every step executed during the game. This makes it possible to navigate back to previous steps, letting the player review past events or revisit earlier choices.
Get
To get the narrative history, use stepHistory.narrativeHistory.
const dialogues: NarrativeHistory[] = stepHistory.narrativeHistory;Remove
To delete all narrative history, use stepHistory.removeNarrativeHistory.
stepHistory.removeNarrativeHistory();To delete part of the narrative history, pass a number to remove the first N elements:
// Delete the first 2 elements
stepHistory.removeNarrativeHistory(2);Other features
At each step, all information about the current game state is saved.
To prevent the save file from growing too large, there is a limit on the number of steps saved. By default, only the last 20 steps are saved, but you can increase this limit (e.g., to 100). When the limit is reached, only essential information from older steps is kept. This allows you to display the full narrative history, but you cannot return to a specific step beyond the limit.
You can change the step save limit by setting the stepHistory.stepLimitSaved property.
import { stepHistory } from "@drincs/pixi-vn";
stepHistory.stepLimitSaved = 100;To disable the step save limit, set stepHistory.stepLimitSaved to Infinity.
import { stepHistory } from "@drincs/pixi-vn";
stepHistory.stepLimitSaved = Infinity;