File structure

Directory structure

config.yaml
├─paras
│ ├─ja
│ │ ├─start.yaml
│ │ └─end.yaml
│ └─zh-Hans
│   ├─start.yaml
│   └─end.yaml
└─res
  ├─ja.yaml
  └─zh-Hans.yaml

Properties

The total config file is a GameConfig object. Here shows the properties:

PropertyDescription
titleThe title of the game.
base_langThe base language.
parasThe paragraph path.
startThe start paragraph.
authorOptional. The author of the game.
pluginsOptional. The PluginConfig object.
resOptional. The resource path.
propsOptional. The custom properties.

The PluginConfig object contains the base directory and the plugin names:

PropertyDescription
dirThe directory.
modulesThe plugin names.

A Paragraph object is a collection of texts:

PropertyDescription
tagThe tag and key of the paragraph.
textsThe texts.
titleOptional. The title of the paragraph.
nextOptional. The next paragraph.

The visibility of paragraphs

Only the paragraph whose tag is the same as the file name(without extension) is public to all paragraphs. The rest paragraphs in this file could only be referenced by the paragraphs in the same file.

For example, for start.yaml

- tag: start
  next: foo
- tag: foo
  next: bar
- tag: bar
  next: end

and end.yaml

- tag: end
  next: foo
- tag: foo
  next: bar
- tag: bar

The foo and bar referenced are the ones in the same file, while start and end could be referenced from other files.

Basic example

This is a config example, with 2 paragraphs.

config.yaml
└─paras
  └─en
    ├─para1.yaml
    └─para2.yaml

config.yaml

title: Title
base_lang: en
paras: paras
start: para1

para1.yaml

- tag: para1
  texts:
    - This is the first line.
    - This is the second line.
  next: para2

para2.yaml

- tag: para2
  texts:
    - The first line of the second paragraph.

The output will be

This is the first line.
This is the second line.
The first line of the second paragraph.

You can see that the game starts at the first paragraph para1, and it jumps to para2 after para1 ends. The game exits after para2 ends, because it doesn't specify the next paragraph.