A compiler for interactive dialogs.
The easy to use plaintext dialog format.
Sprich (German: speak) is a tool for game developers to easily manage dialogs for NPCs. It features a nice human readable format for creating the dialogs and compiles them to JSON for you to embed in your game.
Put all the
.sprich files you want to compile in one directory and run:
sprich input_directory output_directory
Which will compile the files and place the resulting JSON - Files in the output directory, or in the input directory, if no output directory was specified.
Each file consists of several states and other statements which are all on their own line. In the following I will describe the intended behaviour for all statements, in your game however you can exploit them as you wish.
Consult the folder
examples for a few examples of the syntax in action.
Each state can have several actions followed by several options. If no options are given or no action transitions into a new state the dialog is over.
The default start state in sprich is considered to be named
[+] and other
states can be named by a mix of letters, numbers and underscores.
The simplest action is a message your character should say:
Once all actions in a state have been processed you can show options to your user. They define a text that should be selectable follow by an optional state and a condition. The option should only be selectable/visible if the condition holds true. If no state is given the option ends the dialog.
Conditions are always strings that your game needs to process.
[+] "Hello! How are you?" > "Good" [good] > "Bad" [bad] "mood == 0" > "I don't want to talk"
You can call any function with parameters seperated by spaces. A function call
is denoted by a
[+] \think \feel "happy" 3 "Nice to meet you!"
Instants can be used for intermediate states. They start with a
-> followed by
a state and an optional condition. If no condition is given the instant will be
acted out immediately. This can be useful for checking conditions at the start
of a dialog.
[+] -> [grumpy] "weather == bad" -> [happy]
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size sprich-0.1-py3-none-any.whl (5.3 kB)||File type Wheel||Python version py3||Upload date||Hashes View|
|Filename, size sprich-0.1.tar.gz (3.4 kB)||File type Source||Python version None||Upload date||Hashes View|