このページはまだ日本語訳がないため、英語の原文を表示しています。
ガイドThe visualnovel template
Lantern Crossing: a cartographer has to get her map across a foggy river before dawn, and the ferryman decides how far to trust her. Two choices earn or lose his trust and the third, at a fork in the river, reaches the harbor or the fog, so the story has a good ending and a lost one.
It is built on vn, which presents the script: portraits with expressions, a text box with name plates and a typewriter, choices, the backlog, and auto and skip modes; dialogue, whose Runner plays the Yarn Spinner script and keeps its variables; save, for three save slots and the player's settings; and l10n, for English and Simplified Chinese string tables. The backgrounds and portraits are drawn in code, so it needs no image files. The keyboard, a controller and touch each play all of it, from the input map in game.yaml.
| File | What it holds |
|---|---|
story/story.yarn |
The story. Speakers are cast ids, every line and option has a #line: id, <<bg name>> changes the background, <<ending name>> names the ending, and each node's chapter: header names what a save slot shows. |
story/cast.yaml |
The characters: name plate colors, stage slots and expressions, in vn's cast format. |
strings/en.yaml, strings/zh-Hans.yaml |
The interface's strings and the names, chapters and endings in each language. English lines are the script's own text; another language translates each line as line.<id>. |
story.go |
Loads the story files and shows lines and name plates in the player's language. |
novel.go |
The game: the title screen, the story and its menus, input, save slots and settings. |
ui.go, stage.go |
The buttons and menus over the stage, and the drawn backgrounds and portraits. |
story_test.go, game_test.go |
Checks that the story files agree (every line translated, every background and ending known, every path ending in an ending), and plays both endings with the keyboard, a controller and touch, saving and loading on the way. |
A save slot keeps the options chosen since the start, the id of the line shown and how many times that line had shown since the last choice, and loading replays that path, because the dialogue runner's saved state holds its variables and visited nodes but not where in a node it stopped. Saving over a used slot asks first. The lines read and the endings found are player settings, kept apart from the slots and saved again when the app leaves the front or quits, so skip mode knows the lines read in every playthrough. The root scope requests landscape orientation on phones (cx.RequestOrientation(core.OrientationLandscape)) so the two portraits stand side by side above the text box, the text box keeps clear of a phone's notch and home indicator, and the backlog's Older and Newer buttons scroll it for touch and the mouse.
To make the template your own, write a story in story/story.yarn and run its tests, which name every line without a translation and every background, ending or chapter the game does not know; add characters to story/cast.yaml with a look in stage.go, backgrounds to backgrounds in stage.go, endings to endings in story.go, and a language as a string table listed in story.go. The template's README.md lists the controls.