Skip to main content

A compiler for interactive dialogs.

Project description

sprich

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.

Usage

Put all the .sprich files you want to compile in one directory and run:

sprich input_directory

or

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.

Syntax

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.

states

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.

messages

The simplest action is a message your character should say:

[+]
"Hello!"

options

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"

function calls

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!"

instant transitions

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]

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sprich-0.1.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sprich-0.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file sprich-0.1.tar.gz.

File metadata

  • Download URL: sprich-0.1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for sprich-0.1.tar.gz
Algorithm Hash digest
SHA256 420a0fc5982eecbe4ce6814f165d5a37a7012357cf0fca5f6ca05bfb6669aee0
MD5 d60e079eecc43750cef7f1d596dadf30
BLAKE2b-256 e242cd45cde683d63ba83fd81eaa60a10f58ab4393b412ad14271aaa8067ff13

See more details on using hashes here.

File details

Details for the file sprich-0.1-py3-none-any.whl.

File metadata

  • Download URL: sprich-0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for sprich-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e5e972f4df781f41b3cc8e599bc6c4dd5acaef64825549909fc5a4c021727056
MD5 69f5cd6696004c387702e22fa6a60876
BLAKE2b-256 4a4c28710dd2e3ff086aa653f9f9456a892713f1ec0475e29605ccea4328f9b4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page