Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/russelltg/dtree
Dialog tree parser & Executor
https://github.com/russelltg/dtree
Last synced: about 1 month ago
JSON representation
Dialog tree parser & Executor
- Host: GitHub
- URL: https://github.com/russelltg/dtree
- Owner: russelltg
- License: apache-2.0
- Created: 2018-02-04T17:52:10.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-03T20:35:56.000Z (over 5 years ago)
- Last Synced: 2024-08-10T19:03:08.530Z (3 months ago)
- Language: Rust
- Homepage:
- Size: 20.5 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dtree
Dialog tree parser and ExecutorDtree a file format, library, and command line utility for dialog trees.
## Abstract
![Dialog Tree](https://upload.wikimedia.org/wikipedia/commons/thumb/3/31/Dialog_tree_example.svg/399px-Dialog_tree_example.svg.png)
Dialog trees are a common occurence in video games, and it felt like a fun project to create an easy file format spec for these.
## Terminology
Section: A state that the dialog tree can be in. Designated by a box in the above picture.
Mapping: A text input required to go from one section to another
## Syntax
Defining a section:
```
[ start ] Welcome to the game! What would you like to do?
^ Text in brackets ^ The name of the ^ The text to show along with it
define what's being Section to describe
described
```Defining a mapping:
```
[ start (to the house) ->house ] Go to the house
^ The section ^ In parenthesis ^ The section ^ The description for the mapping
that the mapping is the text that the to travel to if
starts at player has to input the text in
to get to the next section parenthesis is inputted```
## Example
For example, the following dtree file `test/example.dtree`:
```dtree
[start] Welcome to this dtree file
[start (gym)->gym] Go to the gym
[start (videogames)->games] Play videogames[gym] You made it to the gym! What a loser lol. Game over.
[games] Which game would you like to play?
[games (cs)->cs] Counter Strike
[games (cod)->cod] Call of Duty[cs] Lmao what a shitty game. You got rekt. Game over.
[cod] You have 12 year old noobs scream at you because of the size of your mother. Wonderful.
```A possible playthrough of this could look like:
```
$ dtree test/example.dtree
Welcome to this dtree file
(videogames) Play videogames
(gym) Go to the gym
> videogames
Which game would you like to play?
(cod) Call of Duty
(cs) Counter Strike
> cod
You have 12 year old noobs scream at you because of the size of your mother. Wonderful.
```