This month's Acuitas work was about nested narratives, another feature I've been wanting to add for a long time. It essentially supports stories understood as distinct parts of other stories or conversations. I don't just want you to think of literary structures that feature a frame story with other stories inside it; even one character telling another about previous events that happened to them can be a nested narrative. Inner narratives are relevant to outer narratives (assuming a reasonable speaker/storyteller), but have an independent timeline and plot.
![]() |
| Image from Wikimedia Commons user Wilfredor. |
What I wanted to do was give any inner narrative its own scratchboard[1], referenced from the outer narrative's scratchboard via a single fact of the form "<character> told story" including a pointer to the inner scratchboard. There is a distinct point when an inner narrative begins, and another when it ends; while an inner narrative is open, the Narrative Engine routes any new statements it receives to the inner narrative's scratchboard instead of the outer narrative's scratchboard.
So the first thing I needed to create were tests to determine when an inner narrative should open or close. My initial versions of these are rudimentary, because I know this is going to be a tricky problem. People usually don't explicitly announce "I'm going to tell a story now" or "that story is over." Instead, the listener has to pick up on cues that the timeframe, setting, or topic has shifted. For now, I'm treating past progressive tense and the presence of time adverbs as prime indicators that an inner narrative is beginning. (Conversational examples: "Once when I was attending a concert ..." "I was going to the store earlier, and ..." Story example: "CharA told CharB that yesterday he was out picking mushrooms, and ..."). A simple "The end" or "<narrator> finished their story" indicates an ending, which is a bit cheaty, but again, I didn't want to make this part too complicated yet. Nesting can go an arbitrary number of levels deep, with the innermost level always checking whether a deeper level should open or the current level should close.
I used this silly little story for a basic test. The subnarrative opens on Line 4 and closes on Line 8 ("yesterday" is used instead of "once" because the parser is having some problems with "once" which I don't care to debug right now):
0:"Bilbo Baggins was a hobbit."
1:"Bilbo met a dwarf named Thorin Oakenshield."
2:"Thorin told Bilbo that yesterday Thorin was living in the Lonely Mountain."
3:"Thorin mined gold and gems out of the mountain."
4:"Thorin and Thorin's family made many valuables."
5:"A dragon named Smaug attacked Thorin and Thorin's family."
6:"Smaug drove Thorin out of the Lonely Mountain."
7:"Smaug stole the valuables."
8:"Thorin finished Thorin's story."
9:"Thorin explained that Thorin wanted to return to Thorin's home."
10:"But Thorin could not return to Thorin's home, because Smaug was still at the Lonely Mountain."
11:"Thorin also wanted Thorin's valuables."
12:"Thorin asked Bilbo to help Thorin."
13:"Bilbo decided to help Thorin."
14:"Bilbo took the valuables from Smaug and gave the valuables to Thorin."
15:"Smaug left the Lonely Mountain because Smaug was angry."
16:"Thorin returned to Thorin's home."
17:"The end."
Once I had the mechamisms to create subnarratives in place, I had to update the episodic memory routines to handle the sub-scratchboards when storing or retrieving narrative memories. This just meant creating scratchboard ID names and putting in some recursion to store everything from an inner scratchboard with a tag that says it belongs to that scratchboard. The retrieval routine then uses those tags to reconstitute the nested scratchboard structure when "remembering" a memory.
My overarching goal for all this was to permit a conversation partner to tell Acuitas a story about something that happened to them, and for Acuitas to then remember it - so that he can include events that happen to other people in his own episodic memory. This isn't quite happening yet because Acuitas doesn't even remember conversations right now, but the supporting parts are ready.
Until the next cycle,
Jenny
[1] For anyone who hasn't been following these diaries for a long time, a "narrative scratchboard" is my term for a data structure that contains Acuitas' extracted understanding of a story or conversation. Scratchboards receive narrative statements serially and build a history of how the situation evolves over time, including character goals and their success or failure, the status of characters or objects, and more. Acuitas also uses scratchboards to manage and remember his own goals, actions, and experiences in narrative format.

No comments:
Post a Comment