Lorebook Generation Tutorial

General Concept and Theme
So, we have the barest glimmering of a scenario idea or theme.

We want it to be surrealistic, almost like Alice in Wonderland. There's an AI module for that, so we go ahead and select OccultSage's Surrealistic Look Through the Lookingglass from the Modules drop down.

Let's demonstrate the in-line capabilities, so we type the following into the story text:

We highlight, and right Click (or ctrl-click on mobile devices with a keyboard). This should pop up a context menu. We then click -> `Generate Lore...` -> `Concept`



This pops up a `New Lorebook Entry` view in the Lorebook manager, and fills in the `Description` field with `The Carnival of Souls` automatically. It will generate the first entry automatically, and we get back:

Hmm, let's try again. We hit the circle arrow Retry button. On the next generation, we got:

Eh, uninteresting. Let's try again.

This is really interesting. Let's click on the Generate Entry that looks like a > to get it to generate more on top of that:

Wow, this is a really good concept! Way to go, Sigurd. Let's keep going. Click on the Generate Entry button to continue from here.

``` Those who cross Styx will never be seen again. However, if they survive the experience, they may ascend back up into Heaven to find joy and happiness once more. And that brings us to...

"I don't know how I'm going to make it through tonight," Carlos said quietly after taking another sip from his flask. "What was I thinking?" ```

So, let's trim the dialog off, and we have a nice lorebook entry describing the Concept of our scenario or world.

The sum total of our Concept entry is:

Nice! Let's give the lorebook entry the name of, and key it to   and   under Keys.



Now that we have a general theme defined, lets create a `Faction`. We click on `+ Add Entry` and create a new blank entry. We select `Faction` from the `Category` drop down.
 * 1) Factions

We want to make sure that our `Concept` entry is included in the context, so we click on the `Add Context (advanced)` button in the upper right corner. This will pop down something that looks like: ``` [ ] Memory [ ] Author's Note [ Lorebook keys to search                           ] ``` ![Screen Shot 2021-09-13 at 1.22.27 PM.png](T4iXIO_IY-Screen Shot 2021-09-13 at 1.22.27 PM.png)

We click on the `Lorebook keys` text entry box, and type in `Carnival of Souls`. This will cause the Lorebook Generator to pull the entry we just made into its context.

What kind of people/group would work at the Carnival of Souls? Ah-ha, `Carnies`, the workers in the Carnival of Souls. We type `the Carnies (workers)`, and click on `Generate Entry`/`>` to submit for generation.


 * NOTE:** Preceding the text with `a`, `an` or `the` has special meaning to the generator! It will more accurately generate for concepts or groups of people rather than a specific entity.
 * NOTE2:** The generator works best if short tags inside ``, divided by commas, such as `(workers)`

On the first generation we get the following output: ``` Most carnival workers aren't very skilled or experienced laborers. Some, however, do possess skills needed by the circus industry—such as acrobatics or working animals. These men and women dress like clowns, and act out exaggerated versions of everyday activities such as eating popcorn or juggling balls. Many wear masks, gloves, and colorful costumes to complete their performances. ```

We generate more, and we get the following added: ``` The most common jobs among these performers include Clown Alley Managers, Ringmasters, Big Top Supervisors, Circus Performers, Animal Caretakers, Dancers, Entertainer Trainees, Tilt-A-Whirl Operators, Carpenters, Stagehands, and Truck Drivers. ```

Hmm, we're getting there. But it's not really tied to a `Carnival of Souls`, so let's add a tag, `demonic`, so that our entry looks like `the Carnies (workers, demonic)`. We delete the text, and click on `Generate Entry` again. After multiple generation we get the following: ``` There used to be dozens of carnival sideshows across the Old World, each run by independent owners. Some held the rights to perform specific acts while others specialized in particular attractions like fortune-telling tents, freak shows, and even torture devices. These days there are very few carnivals left, due to the efforts of the Church Universal and Triumphant to stamp out evil wherever they find it. They've outlawed most forms of entertainment that aren't directly related to worshiping Satan or spreading his word. This means no traveling actors, mimes, jugglers, musicians, magicians, acrobats, dancers... you name it. Even licensed carnival workers can lose their licenses if caught performing an act deemed "unholy." So now there are just a handful of carnival sideshow operators still running around the globe. Most use their profits to fund underground operations such as demonology research. If anyone needs them, they're usually available. The work isn't always glamorous but, unlike most other jobs, working on a carnival side show doesn't require much training. ```

This is really interesting, but not quite what we're looking for. So we reverse the order of tags: `the Carnies (demonic, workers)`, and press `Generate Entry`: ``` After hundreds of years of service, carnival entertainers were given demonic contracts so that they would continue performing even if forced out of Hell. These demons now work alongside humans in the mortal realm, providing entertainment while aiding humanity in battle against evil entities like vampires and serial killers. Most carnivals still feature human performers but some carnivals have begun hiring demon employees instead. Some examples include Circus Maximus in Las Vegas, which hires both demons and traditional circus stars alike. Other carnivals hire professional clowns, jugglers, acrobats and trapeze artists. In addition, there are also small-scale carnival events that take place around large cities such as Seattle or San Francisco, these smaller events often focus on live music performances by local bands. ``` OK, wow! This is exactly the sort of thing we want, so let's store this lorebook entry. We save it as `Faction: Carnies`, keyed to `workers`, `sideshow`, and `carnies`.

![Screen Shot 2021-09-13 at 1.12.43 PM.png](5Bngz-oXU-Screen Shot 2021-09-13 at 1.12.43 PM.png) So let's generate another faction `the Carnival Management`. We click on `+ Add Entry`, and then we select `Faction` from the Category drop-down, and we key in our prior keys, `Carnies, Carnival` to give the Lorebook Generator more context.

We then type in `the Management (carnival, demonic)` -- it takes a few tries to get the right sort of vibe we're looking for, but we get:

``` Many demons seek employment with carnivals because of how well paid and stable jobs tend to be compared to working under someone else. Others come simply because they enjoy entertaining crowds. Still others come merely to escape boredom. Either way, carnivals provide everything necessary to sustain life in Hell. Demons earn money enough to keep themselves fed and clothed without ever lifting a finger. They can spend most of the rest of each day lounging about doing nothing important, save perhaps enjoying a nice meal. As far as amusements go, few things could possibly satisfy them better than carnivals. Every single attraction has been painstakingly designed to make demons smile.

The management of a carnival consists mostly of high level demons called "masters." Masters oversee operations across multiple locations and manage the various attractions within specific areas. All masters receive gifts from God upon reaching Level 50. Their duties consist mainly of overseeing security forces and making sure no damage occurs to any part of the carnival grounds. If anything does happen, it must first be reported to an officer before going through proper channels. ```

This generated good content for demons, so we split the first paragraph into a new Lorebook entry, `Species: Demon`, and we save the second paragraph as `Faction: Management`.

Now would be a good time to show the `Generation History` feature -- it will show the last 50 generations across contexts.

![Screen Shot 2021-09-13 at 1.21.12 PM.png](3szwU0u7u-Screen Shot 2021-09-13 at 1.21.12 PM.png) Thus far, we have the following lorebook entries:


 * Faction: Carnies (keys: Carnies, sideshow, workers)
 * Faction: Management (keys: management, manager)
 * Species: Demon (keys: demon, demons)
 * The Carnival of Souls (keys: Carnival, Souls)

![Screen Shot 2021-09-13 at 1.25.55 PM.png](oEqqAT77i-Screen Shot 2021-09-13 at 1.25.55 PM.png)
 * 1) Characters

Now that we have the basic skeleton of `Concept`, `Faction` and `Species`, let's create a few characters!

We click on `+ Add Entry`, select from the `Category` drop down `Person`.

We make sure that our lorebook keys incorporate all our entries: `carnival, demon, carnies, management`

Hmm, we need a ringmaster! So, we type in `the Ringmaster (demonic, management)`. And because of all the context we've built up so far, it actually gives us an interesting and relevant character on the first shot!

``` Lord Samhain is one of the highest ranking demons living in Hell. He oversees several different types of carnivals throughout the land. One of these carnivals includes Circus Maximus, one of the largest circuses currently operating in the mortal realm. The carnival served as a training ground for Lord Samhain himself, allowing him to hone the skills needed to run one of these massive operations. ```

Good enough, so let's save this as `Character: Lord Samhain`, keyed to `ringmaster`, `samhain`, `lord`, and `management`. We also insert `, the Ringmaster` to tell Sigurd that this is our Ringmaster: ``` Lord Samhain is the Ringmaster, and one of the highest ranking demons living in Hell. ```

![Screen Shot 2021-09-13 at 1.36.30 PM.png](WkmESK36Y-Screen Shot 2021-09-13 at 1.36.30 PM.png)

Let's create a lower level employee, maybe a sideshow attraction? We follow the same steps above, and we enter in `a sideshow attraction (carnie, worker)`

``` The Freakshow hosts a number of attractions, including displays of body modification, hypnotism, contortionists, fire eaters, and more. There are plenty of freaks here, too. Many of them have unusual abilities, some more surprising than others. Some of the freakiest exhibits include Miss Lizzie West—an incredibly talented female illusionist whose ability allows her to control light; Mr. Bones —a skeleton soldier who fights using his own bone gun; and Dr. Frankenstein...who makes you forget your name! But he's not alone. His assistant, Igor, knows more tricks than anyone alive. For example, did you know that Igor can turn invisible? And that he'll steal your soul right off your bones?! The ringmaster is always watching. ```

OK, this didn't generate a specific character, but this makes a neat lorebook entry for `Location: The Freakshow`, so we store that entry and key it to `freakshow`, `carnies`, `carny`.

Let's use the characters in the `Location: Freakshow` above to generate more lorebook entries. We click on `+ Add Entry`, and for the entry: `Miss Lizzie West (female illusionist, freakshow)`. This demonstrates as well that the description itself will invoke lorebook keys, such as `freakshow`.

We get on the first shot: ``` Miss Elizabeth "Lizzie" West is a young girl who works at Circus Maximus. She began performing magic tricks at age six, after discovering she loved entertaining people. Since then, she has developed many new illusions using both sleight of hand and stagecraft techniques. After performing at several carnivals across America, she eventually made her way to Circus Maximus. While there, she performed many shows, earning herself quite a reputation among the other guests. According to the manager, Miss West is the best magician in all of the American carnival circuit.

Her talent lies in creating elaborate illusions that hide secrets inside of objects. Her favorite trick involves hiding tiny, hidden compartments filled with gold coins behind seemingly ordinary props like playing cards, fruits, and eggs. ```

Nice! So let's store this as `Character: Miss Lizzie West`, and key it to `Lizzie`, `West`, `Elizabeth`, `illusionist`.

Next up, we create `Mr. Bones`. Same process to create a new entry, and we type in `Mr. Bones (skeleton, freakshow)`.

And, nice output from Sigurd!

``` Mr. Bones likes to think that he isn't really dead after all. No matter what happens, he just needs another chance to start over again. That said, when people see him coming down the street, they usually scream in fear. This causes many people to avoid walking past the entrance of the circus, despite the fact it would be much easier if they didn't. Instead, they choose to hide behind buildings or trees, hoping that the skeletons won't notice them. Even then, they don't want to walk very close. After all, Mr. Bones doesn't need eyes to track people down. Since his arrival at Circus Maximus, Mr. Bones has learned quite a bit about the practice of magic. While he hasn't mastered it yet, he certainly understands the principles. Due to this knowledge, he plans to use his newly discovered talents to help other members of the circus. Perhaps if everyone worked together, they might stand a chance against enemies like Dracula. ```

We save this as `Character: Mr. Bones`, keyed to `skeleton`, `bones`.

And now for the final freakshow character, `Dr. Franky`! We've renamed him from `Frankenstein` so that it doesn't draw from Mary Shelly's work. Same process, but this time we type: `Dr. Franky (mind control, freakshow)`.

``` Dr. Franky uses mind-controlling drugs to create illusions and distractions while performing feats of superhuman strength. Unlike many other carnival performers, however, he isn't just trying to entertain people; rather, he wants to help humans gain power over their minds. To do this, he needs to trick everyone into thinking they've witnessed something incredible—something that they won't soon forget. This is why he doesn't need to perform flashy tricks or use strong muscles to impress onlookers. Instead, he relies on magic to confuse the audience. By means of clever misdirection, magical effects, and hypnosis, Dr. Franky draws attention away from what really matters. Then, after the crowd becomes distracted, he plucks out whatever information he desires. ```

Nice. We store it as `Character: Dr. Franky`, keyed to `franky`, `doctor`.

We could get into `Igor`, his assistant, but to keep this tutorial shorter, we won't. We now have four neat characters:


 * Dr. Franky (keys: franky, doctor)
 * Lord Samhein (keys: Samhein, ringmaster, lord)
 * Miss Lizzie (keys: Lizzie, Lizzie West, Elizabeth, illusionist)
 * Mr. Bones (keys: bones, skeleton)

![Screen Shot 2021-09-13 at 1.55.55 PM.png](12_3yxS9P-Screen Shot 2021-09-13 at 1.55.55 PM.png)
 * 1) Locations

We already have one `Location` by fortituous happenstance earlier, so maybe we need to describe the `Bridge of Souls` mentioned in the `Concept` generation earlier?

So, we create a new entry, select `Place`, and type in: `Bridge of Souls (Bourbon street)`. And on the **first generation** we get an awesome description, because of all the lore we've built up!

``` Bourbon Street runs parallel to Canal Street, connecting New Orleans Proper with the French Quarter. Amongst the many bars and clubs along this strip, one stands out above all others. Known simply as "the Bridge," it spans over Styx River in order to connect Bourbon Street directly with the underworld below. Most tourists visit this bridge exclusively for sightseeing purposes; however, locals know that crossing Styx Bridge is actually the best way to reach the afterlife. From here, travelers can use the bridge to travel between the two realms in seconds rather than hours. The Bridge is made entirely of steel, concrete, and stone. Its height varies depending on the season, ranging anywhere from ten feet to twenty feet tall. ```

We store this as `Location: Bridge of Souls` keyed to: `bridge`, `souls`, `canal`, `bourbon`.


 * 1) Testing

Now that we've pulled together `Concept`, `Factions`, `Characters`, and `Locations`, let's run a test prompt.

``` I've heard a lot about the Carnival of Souls, and I'm rather curious about it. So I arrive at Bourbon Street in New Orleans, and I see the Freakshow placed at the entrance. ```

We generate, and we get back: ``` A sign hangs overhead reading: Welcome to the Freaksville Circus of Souls. Come one, come all! We're having an amazing show tonight! Don't miss it! "Wow!" I exclaim aloud. This place really does seem like something straight out of a fairytale or nightmare. As I approach, a man dressed as a clown calls my attention. He waves me over. "Hey there, stranger. What brings you to our little circus?" asks the Clown. "Well..." My eyes dart around nervously. "...I was just wondering what kind of shows go on here." The Clown laughs heartily. "Oh boy, do we ever! You'll love 'em, trust me! Now, let's get inside so we don't keep everyone waiting." ``` Hmm, the Clown seems like an interesting character. So let's create a lorebook entry for him. We highlight `the Clown`, and right click on the context menu -> `Generate Lore` -> `Person`. As it uses the lorebook keys we have been carrying from generation to generation, we get back:

``` Willard, originally known as "Clown," is a male circus performer. Originally hailing from Earth, Clown left behind family and friends when he came to live among the other clowns in Hell. Now, Clown works alongside fellow demons to entertain crowds while keeping evil spirits at bay. Despite working closely together, Clown tends to avoid social interaction. This helps to protect his identity, as Clown doesn't want to risk outing himself to anyone outside the circus. In addition to fighting evil spirits, Clown uses his magic acts to help the denizens of Hell achieve enlightenment and return home after death. By summoning powerful spirits to aid in battles, Clown can throw whole armies into disarray. ```

Nice! So, let's store this lorebook entry under `Character: the Clown`, keyed to `Willard` and `clown`. We also add `freakshow` to the key, to make sure he's with that group.

We continue generating, and we get:

``` We enter through the front door and walk down a dark corridor lit by flickering torches. Finally, we stop before a large wooden double-door. The Clown knocks twice, then opens both doors simultaneously. The crowd erupts into cheers.

Inside, the venue resembles a small stadium. In the center of the arena sits a raised stage surrounded by several tiers of seating. Several dozen performers are already seated upon these platforms. They wear colorful costumes and dance wildly to the music playing throughout the room.

A number of people sit atop the lowest tier, watching the performance. Others stand nearby, drinking drinks that appear to be made entirely from alcohol. There is even someone who appears to have been turned completely black; they are dancing with a white woman wearing nothing but body paint. All of them laugh loudly as their bodies move rhythmically.

A few feet away from this group stands another cluster of revelers. These people are laughing uproariously, slapping each other on the back and hugging each other tightly. It seems almost as though they were enjoying some sort of religious experience.

Other groups of people gather in different areas of the stadium. ```

So, we've come from zero to a neat immersive world -- using text generated purely by Sigurd and a strategic choice of modules!