replique 0.1.1

A pure Rust dialogue system
Documentation

Replique

Replique is a pure Rust dialogue system, with first-class support for Bevy.

It is inspired by YarnSpinner, YarnSpinner-Rust and Godot Dialogue Manager. Dialogues are written in plain text files that look like this:

:= start
Alice: Hi! How are you?
Bob: Great, and you? Did you prepare the afternoon meeting?
Alice: Not at all, I was too tired yesterday. I'll get to it right away.
-> Good luck then!
    Alice: See you later!
-> I can help if you want.
    Alice: Thanks, I'd like that. Meet at the break?
    Bob: Perfect, see you!
=> meeting
---

:= meeting
Caroline: Hello everyone, now that we are all here we can start.
Caroline: Alice... You can start...
---

Syntax at a glance

Syntax Meaning
:= name Start a node named name
--- End the current node
Speaker: text A line of dialogue
-> text A choice offered to the player
>> command(arg1, arg2) A command to execute on the engine
=> name Jump to the node name
[let $var = value] Set a variable
[$var] Insert a value into the line
[if cond], [elif cond], [else] Play a block only under a condition
[while cond] Repeat a block, with [break] and [continue]

Variables, conditions and loops

Variables hold numbers, strings, booleans and dictionaries. Anything written between [ and ] inside a line is evaluated and inserted where it stands:

:= shop
[let $gold = 12]
[let $player = {name: "Alice", hp: 7}]

Merchant: Welcome [$player.name]! You have [$gold] coins.

[if $gold >= 10]
    Merchant: The lantern is yours.
    [let $gold = $gold - 10]
[elif $gold > 0]
    Merchant: Not quite enough, come back later.
[else]
    Merchant: Come back when you can pay.

[while $gold > 0]
    [let $gold = $gold - 1]
    >> ring_bell()

Merchant: [$player.name], you are leaving with [$gold] coins.
---

Crates

Crate Description Docs
replique The engine-agnostic parser and dialogue runtime doc.rs
bevy_replique Bevy plugin built on top of replique doc.rs
replique-cli Command line tool to check dialogue files README
replique-lsp Language server for editor support README

Versions

Replique Bevy
0.1 0.19

License

Dual-licensed under MIT or Apache-2.0, at your option.