Event Tutorial - 03 - The Narration


Continuing on with the event tutorial, we can get to the first bits of text in the event. Since the game has a very poor distinction between writing and coding, we'll be jumping in between a few different things, trying to introduce the NPC.

1) From code to the narration

First off, we need to place our event in the context of how travel works. The way everything is set up, it can occur before, during or after travelling to the destination. This is a good candidate for something that happens during, because of this, we can use some pre-existing writing that helps to tie events in with the narrative flow of moving from place to place.


The cg-travel-context variable comes from the event handler if there's anything we need to base on it, it's available to us here as well. It contains details such as the origin and destination of our movement and general descriptors for the state of the world - for example, the season, time of day and weather. You might ask, how can one variable hold all that? Is it some kind of structure or class? Nope. It's just a part of a grammatical statement defining the context - i.e. text. In fact, we can make our own context variable too:


Next, let's insert a non-terminal that will begin generating the narration. Today I'm feeling like using a regular grammar approach, so we'll only need a single symbol to start the generation, and it should flow from there:


2) Diversification

This brings our attention to the accompanying production rule file:


From the state file (that will be generated for this conversation) we jump into the grammar, here we'll define our actual narration. But this kind of writing lacks dynamism; it does not change from one instance of the event to another. To make that happen, we can give multiple valid production rules for the given non-terminal, but we can also further add variability to the text within the rule. Now, technically doing this means it's no longer a regular grammar, but its a detail, the main flow will still follow that idea. So let's start with the man himself. We've already generated some attributes for him, so why not use them to describe him, even in just the most straightforward way, by adding some adjectives.


First off, let's add in text for our attributes that can be used within the narration itself. Unfortunately, there's going to be another thing we have to resolve - an element of the English language called "articles", ugh, English, am I right? So what we'll do here is add a few universal transformations and prepare our adjectives to make use of them. So we use the <a/the>, <an/the> and <_/the> tags to tell how a given adjective should be handled. But what exactly will be happening here? If we call, for example [automata\time\travel\thingsmensay$all$describe,a,blonde], it's going to use the article resolution rule (since it doesn't contain internal, and the actual adjective texts do), which will then reflect back to the internal description of blonde, get it and do the appropriate substitution. The [...tags] will copy the tags within the non-terminal that called a given production rule. 

In order:

[automata\time\travel\thingsmensay$all$describe,a,blonde]

Becomes:

[>_ replace replace replace "[automata\time\travel\thingsmensay$all$internal,describe,a,blonde]" "<a/the>" "a" "<an/the>" "an" "<_/the> " new]

Becomes:

[>_ replace replace replace "<a/the> blone" "<a/the>" "a" "<an/the>" "an" "<_/the> " new]

Becomes:

a blonde

Additionally, now that we have these tools, as long as we follow the internal convention, we can use it for basically whatever.

But having only one way to express something in writing often isn't enough. Well, unless it's supposed to be used only once. In this case, since this event can repeat, it might be a good idea to give a bit more flair to the writing by introducing some synonyms:


And then, we can both use this in writing, as well as expand the number of possible part-a texts for the game to choose from:


But now we want to continue on with the narration. We could do this by adding another entry to the conversation tree. Or, we can use that regular grammar approach I talked about earlier. In a regular grammar, a production rule results with either a terminal string or a string containing a non-terminal at the end, which continues the generation. That's precisely what we're going to do here, but let's add an additional detail. If the character is drunk or dishevelled, let's have the PC get a waft of an unpleasant smell, resulting in a loss of mood. Not a big one, but I'd say a very much justified one. (I had an encounter recently, I don't want to talk about it, ok?)


Now if you are wondering why that one line repeats three times, it's a statistical manipulation to only have a dishevelled person have an offensive odour 50% of the time. The only thing missing here is the mood decrease, but let's see where I can get that without having to remember what the code for it is! We can open the game, go to Options, Run Wizards and then the Interaction Wizard will help us.




From there, we can fill out the next part referring to the character getting ready to speak, and well use the approaching and waiting distinction we introduced by adding additional text to the cg-context variable. And for the next part, we can use the man's intention to give an idea of what he's going to say:


Next time, we'll get to him actually saying something!

Get Esoteric ♥ Esoterica

Leave a comment

Log in with itch.io to leave a comment.