Starting with Setting

My procedural novel generator (see also part one, part two, and part three) has now been augmented with some rudimentary support for settings, both time and place. An example follows:

Here is a tale from the world of Samoa. Samoa is mostly populated by Italians.

I, Giusa Rosi, am a thirty-nine-year-old woman. I have black hair. I have green eyes. I stand 146 centimetres tall. I am somewhat reluctant to accept new ideas. I am easily disturbed or irritated.

Baffaele Bianchiccino is a fifteen-year-old boy. He has black hair. He has green eyes. He stands 184 centimetres tall. He is very open to new ideas and experiences.

I do not know Baffaele Bianchiccino very well. I scorn Baffaele Bianchiccino. I do not trust Baffaele Bianchiccino.

One thousand three hundred sixty-four seconds ago, I walked to Lita.

Seven hundred fifty-four seconds ago, I met Baffaele Bianchiccino. Then, Baffaele Bianchiccino and I walked to Rovo.

Ten seconds ago, Baffaele Bianchiccino kicked me. I kicked Baffaele Bianchiccino.

Clearly, I have been focusing more on the story itself rather than the writing style (no serious author would mark up each line with the exact number of seconds ago the event took place).

Advertisements

Character Traits

This is part 3 of my procedural novel generator series. In the first two parts of this series (Part 1 and Part 2), I begun on the very basics of a procedural novel generator. Mostly it was simply name generation. Now I have added some rudimentary character traits, physical and psychological. To begin, here’s a sample of what can be generated now:

Here is a tale from the world of Carins.

I, Edwal Gan, am a seventeen-year-old boy. I stand 183 centimetres tall. I have a contusion of the skin. I am conscientious. I am somewhat reserved. I am somewhat reluctant to accept new ideas. I am not agreeable.

Ving Murphy is a twenty-seven-year-old woman. She stands 150 centimetres tall. She is often the centre of attention. She is agreeable.

I do not know Ving Murphy very well. I scorn Ving Murphy. I do not trust Ving Murphy.

Twenty seconds ago, I met Ving Murphy. Then, Ving Murphy punched me, inflicting a contusion of the skin. I punched Ving Murphy.

At present, as is probably obvious, the entire plot is scripted. This means that the characters currently do not have free will and so the character traits are inconsequential. However, they exist now and will provide a back-end for more complex functionality in the future. In addition to character traits, an injury system is present now, although injuries do not bother the characters one bit.

The personality traits already affect the outcome of meetings, however, with more alike people getting along better (unfortunately, this bonus to relations is nullified by the scripted attacks, which means the relationship between the characters is always negative) and the physical traits already affect the severity of the injuries. Unfortunately, making the plot unscripted is a very difficult task, so it’s likely that the next few parts will involve more character work before free will can even be considered.

A Procedural Novel Generator, Part 2

Some small amount of progress has been made on the procedural novel generator I started recently.

Firstly, I’ve improved how text is written. Instead of requiring each word be hard-coded, new backend functionality exists to make writing easier.

def describe(self, perspective=None):
    """Return a list of words describing the meeting."""
    if perspective in self.characters:
        others = [char for char in self.characters if char is not perspective]
        return writer.pack(
            syntax.Word('I'),
            writer.Verb.MEET.conjugate(1),
            writer.make_list(others),
            syntax.PERIOD
        )
    else:
        return writer.pack(
            writer.make_list(self.characters),
            writer.Verb.MEET.conjugate(2),
            syntax.PERIOD
        )

The above code shows using the new functionality to conjugate verbs and to make lists, two annoying things in English that are good to have finished.

The very basics of character generation have been dealt with. Now each character has a name, age, and sex. There are still no character traits and the descriptions of characters are extremely plain.

A new time and event system is now in place in the world. Currently the time system is very linear; events can only follow other events. The events are also hard-coded at present and not generated on the fly. Finally, there are only two types of events at present, and neither is fleshed out. The events system is mostly there as a skeleton for future refinements. Consequently, the system is not yet very flexible.

Here’s a sample of what is generated at present:

Here is a tale from the world of Manontome.

I, Rosentina Rombante, am a forty-one-year-old woman. Giovigicelchiosa Savettino is a twenty-eight-year-old man.

Fifteen seconds ago, I met Giovigicelchiosa Savettino. Five seconds ago, Giovigicelchiosa Savettino punched me.

I hope to get some more variation in the stories in the near future—right now the only change from one story to the next is the names of the characters.

Read the next part on character traits.

A Procedural Novel Generator

I have embarked on a weeks-long journey to demonstrate computational creativity. I will start with a procedural novel generator. The goal of this project is to generate a world, characters, and a plot, and then express that plot as a novel.

I anticipate that this will be a large project, so I’ve brought in machinery from LIJN (a past project of mine) to get it started. So far, piggybacking on LIJN’s sentence tokenizer, I’ve gotten done a rudimentary way for the computer to “write”:

story = [syntax.Word('this'),
         syntax.Word('is'),
         syntax.Word('a'),
         syntax.Word('test'),
         syntax.Word('story'),
         syntax.COMMA,
         syntax.Word('set'),
         syntax.Word('in'),
         syntax.Word('the'),
         syntax.Word('world'),
         syntax.Word('of'),
         syntax.ProperWord(self.setting.name),
         syntax.PERIOD,
         syntax.NEXT_PARAGRAPH,
         syntax.Word('it'),
         syntax.Word('is'),
         syntax.Word('a'),
         syntax.Word('demonstration'),
         syntax.Word('of'),
         syntax.Word('what'),
         syntax.Word('is'),
         syntax.Word('to'),
         syntax.Word('come'),
         syntax.PERIOD
         ]

…which when reassembled will produce this not-so-interesting output:

This is a test story, set in the world of Cinova.

It is a demonstration of what is to come.

The name of the world is generated with a Markov chain algorithm also conveniently already included in LIJN.

I hope to get some more done on this in the following weeks and post updates when there’s something interesting.

You can read Part 2 here.