Random Random Conversation Tutorial


The Random Conversation Syntax  covers building preset conversations for random encounters spoken between random NPCs out in the world. This new module extends the syntax to allow for the exchanges to also be randomised.

1) Setting Up

There are a few steps to using the system. It needs to be initialised from within a standard conversation file. This can happen on the first line of the conversation or further in, at any point. However, nothing else can be predefined after initialising the module.

Such a line will look like this:

0;[automata\npcs\random\setup$file][>>_ sets "rcr-lines" "path\to\lines\file"];neutral;Prefedined opener.[[rcr-cont] new{ "tag1" "tag2" }]

The first important element is this call:

[automata\npcs\random\setup$file]

It must be the first thing called in the second (code) element of a conversation line. It sets up the standard configuration for the generator, including granting access to the other variables and non-terminals used next. The system requires two strategies to be defined: selecting the next speaker and another to determine if a conversation should end. It's best to ask me about these if you want to change them, but I'd highly suggest that the existing strategies are there for a reason and don't need changing.

The next element defines which file contains the random conversation lines. This is a file with a very similar syntax to normal random conversations. We'll return to that in a moment.

[>>_ sets "rcr-lines" "path\to\lines\file"]

The variable can be changed at any point, changing what file is responsible for providing the lines; this is usually done in the 4th segment of the line. However, since the conversation has to start somewhere, it's highly advised that you do it here unless you have a good idea of what you are doing.

The next part is the actual jump into the procedural generation:

[[rcr-cont] new{ "tag1" "tag2" }]

This requests a new line to be added to the conversation from the currently set line source, matching the specified tags. The process uses an any selector by default. But that has more to do with building the line source file.

An important thing to note is the difference between these two non-terminals:

[rcr-cont]
[rcr-tryend]

Both of these can be used interchangeably but with slightly different results. The first guarantees that the conversation will continue; the second checks the end condition for the exchange and only continues if it is not met. The standard strategy to end a conversation is to end it after at least four lines have been generated. But this can be adjusted.

Functionally it doesn't matter where the call to generate a new line appears in regarding the text, but it might interact with other elements. Both the versions of this call rely on the rcr-lines variable to select the line source. As such, changing the variable before or after the call has a different effect.

2) Line Sources

A line source file is very similar to a conversation file. It's also composed of lines made up of four segments, with the second to the fourth segment having the same format and interpretation as that older format:

tags;code;mood;dialogue_line

For example, this is the line source used for initial testing:

a;null;neutral;Hello.[[rcr-cont] new{ "b" }]
a,g;null;annoyed;Fuck off.[[rcr-cont] new{ "c" }]
b;null;neutral;Heard any rumours?[[rcr-cont] new{ "e" }]
e;null;neutral;No.[[rcr-cont] new{ "f" }]
e;null;amused;Mudcrabs?[[rcr-cont] new{ "g" }]
e;null;amused;High elves?[[rcr-cont] new{ "g" }]
b,f,g;null;neutral;Goodbye.[[rcr-cont] new{ "h" }]
b,f,g;null;neutral;Farewell.[[rcr-cont] new{ "i" }]
c;null;annoyed;Fuck off too!
h,i;null;neutral;Goodbye.
h,i;null;neutral;Farewell.

I'm sure you can spot the source of inspiration.

That different element is the tags, used to match viable lines. This perfectly matches building production rule files for use with the any selector (including advanced tag matching options).

Furthermore, as the lines are matched from among viable lines within the source, their order does not matter. It's merely a pool of possibilities.

This new element also replaces explicitly listing the index of the speaker as the speaker strategy handles this. Usually, this bounces the lines between the first and second speaker (index 0 and 1 respectively) but can be changed; this is discussed in section 3.

Functionally, these generated lines are added to and executed as predefined lines. This means that further usage of the [rcr-cont] and [rcr-tryend] tags is needed to continue the conversation. A line that doesn't contain them signifies an end to the generation. This is used to specify the following tags and can be used to transition to a different line source as well.

3) Lead Manipulation

Finally, there's also one additional element to discuss. The conversation system allows for more than just two characters, but as stated before, the default strategy involves bouncing the lines between the first and second character. But, the system also has an additional feature that takes this into account. At any point, you can call a special symbol to change the speakers:

[[rcr-switchlead]]

This will cause the system to change characters but in a somewhat intelligent manner. So, for example, in a four-person conversation, calling this when the 2nd character (index 1) is speaking will replace the 1st character (index 0) randomly, either the 3rd or the 4th. The current character is preserved, but the other character is substituted in with someone else.

Get Esoteric ♥ Esoterica

Leave a comment

Log in with itch.io to leave a comment.