Neural narratives in Python #15

I recommend you to check out the previous parts if you don’t know what this “neural narratives” thing is about. In short, I wrote in Python a system to have multi-character conversations with large language models (like Llama 3.1), in which the characters are isolated in terms of memories and bios, so no leakage to other participants like in Mantella. Here’s the GitHub repo.

At the end of the previous part, my player character, a police detective, convinced an arrogant scholar and a mysterious young student to cooperate on messing with interdimensional rifts to find a missing teen.

The young student mentioned that they would gather supplies. That sounded like an action that my player character and his companions should be able to perform. A section of my app already allowed the user to perform Investigate and Research, so I created a whole new action for gathering supplies.

I relied on OpenAI’s Orion preview model to refactor the whole process of creating a new action type to the utmost, so now it will be very easy to add new ones.

More importantly, I pictured what could be in the horizon for this little test story. Will they walk through a rift into another dimension? How the hell would that work mechanically? My app tracks the combination of places where any character is located. The hierarchy goes world > region > area > location. Characters can be present in areas (some space the size of a town) or in locations (the size of a building or complex of related buildings). But what if the characters step from Providence into another dimension? Is that still set in the world of this story, that originally was intended to refer to a planet? Could that other dimension be squeezed mechanically into being in an alternate 1920s Earth?

Clearly I was missing something, so I thought about it until I came with the notion that the hierarchy of places should be contained inside a new notion, not exactly a place, called Story Universe. This new dimension would belong to the overarching story universe, but not be connected to the same world. This is very important, because dialogues, actions, and such get fed the hierarchy of places and their descriptions as information.

This new Story Universe for my ongoing story encapsulates the notion that rifts to other dimensions can open by themselves or be torn open, and that the beings of many dimensions have to deal with that nonsense.

I ended up having to rewrite the code for every part that involves creating places, because they had to take into account that they all stemmed from, however remotely, a particular Story Universe. I made a new page to handle the generation of places.

These changes allowed me to create the following hierarchy of deranged places for a story or a myriad of them:


Story Universe: The Whims of Divinity

In the universe of ‘The Whims of Divinity’, the gods reign supreme, wielding the power to bestow extraordinary abilities upon the creatures they deem worthy. This universe operates on the fundamental principle of divine intervention, where the gods’ actions and decisions shape the course of events. The unique aspect of this universe lies in the unpredictable nature of the gods’ choices, as they grant powers based on their ever-changing whims. The creation myth speaks of the gods molding the universe from the very fabric of their desires, breathing life into beings and worlds through their divine will. The structure of reality consists of multiple realms, each governed by a different god, with the mortal realm at the center. The gods observe the mortal realm, seeking individuals or creatures that capture their interest, granting them powers that can range from elemental control to reality-bending abilities. The themes explored within this universe revolve around the struggle between free will and predestination, the nature of power and responsibility, and the capriciousness of divine favor. The whims of the gods create a world where heroes can rise from the most unlikely of places, where villains may be driven by the very powers they possess, and where the balance of the universe hangs on the unpredictable decisions of the divine. Stories within this universe delve into the lives of those blessed or cursed by divine intervention, exploring how these powers shape their destinies and the world around them. The possibilities for conflict, exploration, and discovery are endless, as characters navigate a reality where the gods’ whims can change everything in an instant.

World: Memmedom

Memeddom is a world governed by the eccentric, deranged god of memes. The geography of Memeddom is a patchwork of vibrant, chaotic landscapes, ranging from the glittering Meme Mountains to the vast Echo Chambers, where endless loops of soundbites resonate. The flora and fauna have evolved to mimic popular memes, with creatures like the Doge Deer and plants like the LOLlius flowers. The god’s preoccupation with creating and sharing memes has led to a culture obsessed with viral content and fleeting fame. The dominant language, MemeSpeak, consists of a mixture of images, emojis, and abbreviated text. The economy is based on the currency of ‘Likes,’ where citizens earn and spend Likes on goods and services. Resources in Memeddom are memes themselves, with rare and viral memes being the most valuable. The world is ruled by an Influencer Monarchy, where the most popular and influential meme creators hold power. Political tensions arise between different meme factions, each vying for control over the ‘MemeStream,’ the main source of meme distribution. The dominant religion is the ‘Church of the Viral,’ which worships the god of memes and seeks to spread his influence across the world. The society is divided into classes based on online popularity, with the most liked individuals forming the elite ‘Trending’ class. The inhabitants of Memeddom are a mix of humans, talking animals, and emoji-like creatures, all constantly bombarded by the god’s memes. While some embrace the chaos, others long for a world free from the tyranny of viral content.

Region: Doomerscape

Doomerscape is a vast, desolate region marked by its bleak, grayscale landscape and perpetual overcast skies. The climate is chilly and damp, with a constant drizzling rain that casts a gloomy pallor over the land. The most notorious geographical feature is the Sea of Sorrows, a massive, stagnant body of water that is said to be made from the tears of the Doomer god himself.

The inhabitants of Doomerscape are a melancholic bunch, known as the Doomered. They are a mix of humans, animals, and creatures that have been transformed by the pervasive Doomer energy that permeates the region. The Doomered are characterized by their pessimistic outlook on life, their love of black coffee, and their tendency to wax philosophical about the futility of existence. They live in small, scattered communities, preferring to keep to themselves and avoid the temptations of fleeting meme fame.

The architecture of Doomerscape is stark and minimalist, with buildings made of dark, rough-hewn stone and adorned with mournful sculptures of weeping figures. The most iconic structure is the Tower of Lament, a towering spire that houses the governing body of the region, the Council of Despair. This council is made up of the most world-weary and cynical of the Doomered, who rule with a laissez-faire approach, believing that all attempts at control are ultimately futile.

The economy of Doomerscape is based on the mining of rare, black crystals known as Sorrow Stones. These stones are highly sought after for their ability to absorb and store negative emotions, making them valuable to the Doomered for their emotional catharsis. The Sorrow Stones are traded with neighboring regions, who use them in various applications, from powering melancholic machinery to creating mood-altering elixirs.

Despite its dreary reputation, Doomerscape is not without its defenders. The Doomered are known for their fierce, if somewhat apathetic, fighting style, which involves a lot of sighing and eye-rolling as they battle. They are led by the Knights of the Woeful Countenance, a group of warriors who have mastered the art of combat while maintaining an air of resigned indifference.

The spiritual beliefs of the Doomered center around the worship of the Doomer god, a deity of despair and ennui. They believe that by embracing the futility of existence, they can achieve a state of enlightenment known as ‘Peak Doomer.’ This belief system is reflected in the region’s cultural aesthetics, which emphasize the beauty of sadness and the nobility of giving into one’s darker emotions. The Doomered have a complex social hierarchy based on one’s level of existential angst, with those who have achieved Peak Doomer status being the most revered.

Area: Mournville

Mournville is a small, gloomy town located in a shallow valley, surrounded by rolling hills of pale gray grass and withered trees. The landscape is dotted with spent matchsticks and cigarette butts, remnants of the town’s primary industry and pastime.

The soil in Mournville is rich in a rare mineral called Ashenite, which is used to fertilize the tobacco fields that dominate the countryside. The tobacco grown here is of a unique variety known as Melancholia, prized for its smooth, rich flavor and the way it seems to enhance the melancholic mood of the smoker.

The town is inhabited by a mix of humans and a peculiar species of crow that has evolved to thrive in the smoky environment. These crows, known as Sombriels, are revered by the townspeople for their mournful caws and their tendency to steal lit cigarettes from unsuspecting smokers.

Mournville is governed by a council of the town’s oldest and most resigned residents, who meet in the town’s central square to sigh heavily and bemoan the state of the world. They maintain a policy of strict isolationism, believing that the town’s unique atmosphere should be preserved from the corrupting influence of outsiders.

The town’s main cultural event is the annual Festival of Regrets, where the townspeople gather to share their deepest regrets and to smoke an extra-strong blend of Melancholia tobacco. The festival culminates in a procession to the nearby Ashen Hills, where the townspeople release a flock of Sombriels carrying lit cigarettes in their beaks, symbolizing the release of their regrets into the sky.

Location: Despondency Park

Despondency Park is a bleak expanse of withered grass and gnarled trees, cast in the perpetual gloom of a sunless sky. The park is dotted with stark yellow street lights that cast an eerie glow over the few remaining benches where the town’s most resigned citizens gather to smoke and bemoan the pointlessness of life.

The air is thick with the acrid smell of cigarette smoke and the mournful caws of the Sombriels, the peculiar species of crow that inhabit the town. These birds are drawn to the park by the abundance of discarded cigarette butts and the melancholic energy that permeates the area.

The park is a place of deep despair and hopelessness, where the only solace comes from the shared misery of others. It is not uncommon to see groups of citizens huddled together on the benches, their faces etched with the lines of a thousand regrets, as they take long drags from their cigarettes and stare out into the gloom.

Despite its gloomy atmosphere, Despondency Park is a popular spot for those seeking a moment of respite from the world. The park is home to a rare species of flower known as the Melancholy Bloom, which is said to thrive in the park’s unique atmosphere. The flowers are prized for their delicate beauty and the way they seem to absorb the sorrow of those who sit among them.

The park is also a popular spot for the town’s annual Festival of Regrets, where the townspeople gather to share their deepest regrets and to smoke an extra-strong blend of Melancholia tobacco. The festival culminates in a procession to the nearby Ashen Hills, where the townspeople release a flock of Sombriels carrying lit cigarettes in their beaks, symbolizing the release of their regrets into the sky.


Now that the creation of any kind of place, including the overarching Story Universe, has been programmed in, I’ll need to search for every piece of code that references worlds, then make sure to involve the associated Story Universe as well. That will take a while. But it will be very interesting to see how this new hierarchy influences the dialogues and actions performed in the app.

EDIT: the Deep Dive pair at Google NotebookLM had plenty of interesting things to say about this post. Good job sticking the landing, guys.