84 lines
4.1 KiB
Markdown
84 lines
4.1 KiB
Markdown
|
# NVL Syntax
|
||
|
|
||
|
Every sequence is wrapped in blocks, and they can be contained in different files. All NVL files will be supplied to the parser, make sure to avoid name conflicts even in different files because of this. All definitions at the highest level will be sequences.
|
||
|
```
|
||
|
Intro { // "Intro" is automatically the name of this sequence
|
||
|
FOO
|
||
|
BAR
|
||
|
}
|
||
|
```
|
||
|
|
||
|
## Dialogue
|
||
|
Dialogue is common enough, so we provide special syntax for them, there is nothing special about this special syntax, it is defined the same way as other commands as we will see. `[]` is used to specify who is speaking.
|
||
|
|
||
|
```
|
||
|
Intro {
|
||
|
[Alice]
|
||
|
> Wow! I hope this project goes somewhere!
|
||
|
> Pick a project so difficult that nobody believes you can do it
|
||
|
[Bob]
|
||
|
> Channel your "I'll fucking show them" energy.
|
||
|
}
|
||
|
```
|
||
|
|
||
|
## Implication of pauses
|
||
|
As mentioned in the last section this is important.
|
||
|
|
||
|
It is recommended that `[]` (and other commands) does not do anything more than update the "who is talking" information and `>` be the only command that provide a pause.
|
||
|
```
|
||
|
Intro {
|
||
|
[Alice] // Changes the speaker and continues to read the next line
|
||
|
> Wow! I hope this project goes somewhere! // Changes the current text (or text position, depending on how you want to define your parser) and also PAUSE
|
||
|
> Pick a project so difficult that nobody believes you can do it // ditto
|
||
|
[Bob] // Changes the speaker and continues to read the next line
|
||
|
> Channel your "I'll fucking show them" energy. // Change text and pause
|
||
|
}
|
||
|
```
|
||
|
The comment syntax is the same as in C.
|
||
|
|
||
|
## Commands
|
||
|
Aside from who is the speaker and what are they speaking, the frontend still needs more information, such as what happens on the screen, what animation sequence to play, what background should the scene have, what sprites should show and how should they show. Only the strictly narrative sections of the game (i.e. things that have to do with storytelling) should be defined as commands in NVL, everything else ought to be a part of the frontend, such as system logic, UI, etc.
|
||
|
|
||
|
How any of these actions would be handled is done through commands.
|
||
|
A command definition file defines the commands that are used in the NVL file and what should happen when they are called.
|
||
|
```
|
||
|
Intro {
|
||
|
SET_COMPOSITE_TRACK 0 Source BG_ROOM01
|
||
|
SET_AUDIO_TRACK 0 Source Easygoing Loop
|
||
|
|
||
|
SET_COMPOSITE_TRACK 1 Source Alice_N_01
|
||
|
SET_AUDIO_TRACK 1 Source Alice_Voice_00 Once
|
||
|
[Alice]
|
||
|
> Wow! I hope this project goes somewhere!
|
||
|
> Pick a project so difficult that nobody believes you can do it
|
||
|
|
||
|
SET_COMPOSITE_TRACK 2 Source Bob_N_01
|
||
|
SET_AUDIO_TRACK 1 Source Bob_Voice_00 Once
|
||
|
[Bob]
|
||
|
> Channel your "I'll fucking show them" energy.
|
||
|
}
|
||
|
```
|
||
|
As a matter of style I have made commands upper-case, this is not required. Note that commands are really just function calls but the syntax says that arguments are not called in parentheses. There are also no semicolons at the end of each line, this implies that line breaks are part of the syntax.
|
||
|
|
||
|
`SET_COMPOSITE_TRACK` and `SET_AUDIO_TRACK` are facilities used in the ADVect engine, they each correspond to the audio mixing tracks and video composite tracks.
|
||
|
|
||
|
It is important to reiterate that the `>` or the `[]` syntax is just another command whose behavior can be defined as the developer pleases, for example one could choose to raise the hierarchy of the sprite of the character speaking in the composite when a new block spoken by that character is entered, this wouldn't work with the current model of ADVect but it is something that can be done if the frontend has such an association between the speaker information and the sprites.
|
||
|
|
||
|
```c
|
||
|
void SET_COMPOSITE_TRACK(int track_index, string track_property, string value) {
|
||
|
// track property of S means source, other properties can be V for volume etc..
|
||
|
...
|
||
|
}
|
||
|
void SET_AUDIO_TRACK(int track_index, string track_property, string value, optional<string> Behavior = "") {
|
||
|
...
|
||
|
}
|
||
|
void SET_LINE() {
|
||
|
// defined somewhere to be the alias of the > syntax
|
||
|
...
|
||
|
}
|
||
|
void SET_SPEAKER() {
|
||
|
// defined somewhere to be the alias of the [] syntax
|
||
|
...
|
||
|
}
|
||
|
```
|