History

From VNDev Wiki
Revision as of 02:19, 17 December 2024 by Tale glider (talk | contribs) (simpler headings)

A history or log screen is a GUI element that shows multiple previously-shown dialogue and narration lines, typically with a scrollbar so you can go further back than what can fit on the screen at once, while still being compact enough to fit multiple lines on the screen at the same time.

A button to access this screen is usually provided in the game's quick menu.

Features

In addition to showing past dialogue and narration, it might provide other features, such as these:

  • Showing small side images next to the text.
  • Showing miniatures of CGs, or text descriptions of them.
  • Providing buttons for things like replaying voice lines (or sound effects) or jumping back to the the lines in the game.
  • Show labels for the start of chapters or scenes.
  • If it can scroll very far back (hundreds or thousands of lines), it might be split into pages.

Implementation

There are two different ways this screen might retrieve past lines of dialogue: logging and backwards reading.

Log-based

This is the most common approach. Every time the game shows some text, it adds that text to a large ring buffer, and when the buffer fills up, it starts discarding the oldest elements to make room for the newer ones.

This is fairly easy to implement, and doesn't need special handling of things like branching. Every time a line of dialogue or narration is shown to the player it's added to the buffer, along with information about which character saida it, and optionally other information such as a voice line ID or an expression to use in a side image within the history screen.

Games and engines that also provide rollback might do this by taking snapshots of the entire game state (what's on screen, every variable's value, every sound that's playing...) every time they add an entry to the history screen.

Undo-based

Normally, dialogue and narration is shown one block of text at a time, from first to last, but since the engine has access to all the blocks, it can go back and find the previous block, then the one before that, and so on. At least in linear VNs.

But in games with branching, there might be several paths that lead to the same blocks, and then it's not possible to know just from the current position which text has been shown before.

The simplest solution to keep a list of every time the game reaches or jumps to a label, and making a stack of these events. That way, as long as nothing gets removed from the stack, it's possible to go backwards all the way to the start of the game. And if there's a lot of branching (such as a time loop that the player has to break out of by making specific combinations of choices), it's possible to make the stack act as a ring buffer, so that once it grows to a certain size, the oldest elements get discarded when adding new ones, limiting how many branching events the history screen can go back through.

This approach might be able to go a lot further back than log-based history, since it doesn't need to record anything when no branching is happening. But its complexity might make it not always worth implementing. It can however make it easier to implement rollback, since it avoids taking full snapshots of the game, of which rollback could need a large amount to be stored.