dariusk / NaNoGenMo-2015

National Novel Generation Month, 2015 edition.
340 stars 21 forks source link

Propp-guided simulation with rudimentary emotions/behaviours #22

Open PPKFS opened 8 years ago

PPKFS commented 8 years ago

I've been thinking about this for a while, actually. I definitely want to try something ala what @cpressey mentioned - avoiding more unpredictable stuff and adjusting existing stories.

I'm still undecided on an approach. I think I'll try going top down (plot -> events -> text) rather than just making random sentences from a grammar.

A prediction from the start? This isn't going to end up with 50,000 words in any sane capability. I think something which seems a lot more like a very long, linear, short story IS possible; that is, the plot events become incredibly granular and small (if a normal novel has, say, 10 different major events in 50k words - this will probably have 200-300).

It could also be that this is all complete garbage and I'll swap to a destructive approach from existing material. But who knows, we'll see.

Also undecided between using Prolog, C#, or maybe finding something else to use.

enkiv2 commented 8 years ago

For NaNoGenMo 2013 I worked a bit with translating the CMU NELL knowledge base to prolog. If you're planning to produce an internally consistent but reasonably free-form story and you're familiar with prolog (and particularly using DCGs), there are worse ways to go.

On Mon, Oct 26, 2015 at 12:45 PM Mark Garnett notifications@github.com wrote:

I've been thinking about this for a while, actually. I definitely want to try something ala what @cpressey https://github.com/cpressey mentioned

  • avoiding more unpredictable stuff and adjusting existing stories.

I'm still undecided on an approach. I think I'll try going top down (plot -> events -> text) rather than just making random sentences from a grammar.

A prediction from the start? This isn't going to end up with 50,000 words in any sane capability. I think something which seems a lot more like a very long, linear, short story IS possible; that is, the plot events become incredibly granular and small (if a normal novel has, say, 10 different major events in 50k words - this will probably have 200-300).

It could also be that this is all complete garbage and I'll swap to a destructive approach from existing material. But who knows, we'll see.

Also undecided between using Prolog, C#, or maybe finding something else to use.

— Reply to this email directly or view it on GitHub https://github.com/dariusk/NaNoGenMo-2015/issues/22.

PPKFS commented 8 years ago

Ooh, that's neat.

I've done some DCG stuff before - failed attempts at text adventures and MUD-y stuff that never got off the ground in my head, let alone in code.

I'm still not entirely sure about ontologies for this kind of thing. I can imagine them being incredibly neat (with so much data to pick from) but also incredibly silly ('The man went outside and saw a chinese mitten crab and a Alfa Romeo 155 with Acetaldehyde Ethyl Phenylethyl Acetal in').

enkiv2 commented 8 years ago

Definitely. NELL is notable because it's an ontology generated via machine learning from the internet (specifically, I think it's reading twitter and wikipedia?). As a result, it's a little less completionist & a little more skewed toward things people care about.

I never got much further than converting a large subset to prolog and producing a large set of true but uninteresting statements about categories.

On Mon, Oct 26, 2015 at 12:53 PM Mark Garnett notifications@github.com wrote:

Ooh, that's neat.

I've done some DCG stuff before - failed attempts at text adventures and MUD-y stuff that never got off the ground in my head, let alone in code.

I'm still not entirely sure about ontologies for this kind of thing. I can imagine them being incredibly neat (with so much data to pick from) but also incredibly silly ('The man went outside and saw a chinese mitten crab and a Alfa Romeo 155 with Acetaldehyde Ethyl Phenylethyl Acetal in').

— Reply to this email directly or view it on GitHub https://github.com/dariusk/NaNoGenMo-2015/issues/22#issuecomment-151207135 .

PPKFS commented 8 years ago

After spending a while awake in bed thinking, I've decided on two driving points: a) Given how much work people have put into narrative generation and yet even the best academic systems aren't there yet, trying to do something of that scale in a month is silly. b) I'm a borderline perfectionist and wouldn't be overly happy with something 'meh' just because I tried doing far too much.

As such, I'm still going to be trying to do far too much! But...differently!

A rough overview of my plans - for now: 1- Get a very rough propp-based plot. Translate the plots into goals (e.g. the 'return' Propp function is a goal to end up at location X). 2- Throw in a whole bunch of characters, locations, objects, etc. I'll see if a corpus exists, otherwise I'll probably manually find some from e.g. IF games. 3- Give each character a small number of emotions and beliefs - e.g. hunger, safety, greed, whatever. This is the novel bit, I think. it's also the bit most likely to completely fall flat. 4- Let the characters run amok ala The Swallows (which I must say is absolutely brilliant and has given me and my friends a sore throat from laughing). 5- Generate the story - which, I am hoping, might end up looking a little like something from dwarf fortress. Everyone loves a dwarf grabbing a goblin by the tongue with their pinky, ripping it out, and beating them to death with it!

1) shouldn't be too hard - the resource list in @MichaelPaulukonis' NaNoGenMo2014 is absolutely staggering. Originally I was talking about using Plotto for a plot, but that's just going to lead to extreme templatisation - something I don't really want at all. 2) also shouldn't be bad. Worst case? Grab an ontology or similar and go to town. Could be downright hilarious if, for instance, the hero really needs to go collect the magical Acetaldehyde Ethyl Phenylethyl Acetal by riding in his Alfa Romeo 155. Which goes about 5mph. 3) This is where it all falls down, I imagine. I've been interested in this kindof model but never really looked into it. We'll have to see! 4) Shouldn't be too hard. Just got to make sure I add some kind of urgency so we don't get them running around in circles for too long. 5) Also not too bad.

Anyway, we'll see.

MichaelPaulukonis commented 8 years ago

Flattered!

I think you're working in a reasonable direction for a month-long project. Seeing the bodies of academic work on small-scale text generation can be humbling. Especially when I don't understand the bulk of their work. But I love the angle of attack that NaNoGenMo brings to the problem - sideways, cargo-cult, worst-practices surface-FX that leap-frog over academic problems to get to a semi-readable end-point. Eliza is dumb from an AI standpoint, but continues to be an important touchstone, showing how simple effects can be used (believed, read, whatever) by a non-academic user/reader.

And am a bit jealous, because I have no clear goal yet for this month..... I think scaling back to a single type of story might be interesting (The Giant Who Had No Heart in His Body or Koschei the Deathless). Not necessarily the output, but I might find it interesting to work on.

PPKFS commented 8 years ago

I'm also a massive contender for an award titled 'person who has never understood the idea of scope'; I seem to always end up with 'I should do X, maybe Y...oh look, now it is a 30 year project'.

Just really hoping I'm able to catch myself in time if this turns out to be overly ambitious. I'm imagining scale back approaches:

MichaelPaulukonis commented 8 years ago

I really wish I had worked harder on characters, objects, locations, etc. in the early stages of my propp-gen. That would have made things a lot easier. With a landscape/world movement can be done - and descriptive expansion is "easier" to tack on once that exists.

PPKFS commented 8 years ago

I've gotten a copy of Propp and given it a semi-quick read through. It's odd that you can only seem to find the first 2 chapters online; the rest are fairly short, but really interesting. Anyway.

I've fairly decided that I'll be doing this in Prolog. I'm a bit rusty, but it's not exactly a complicated language. It should be especially handy for:

If I do encounter serious speed problems, I'm competent enough with the SWI C++ interface to try and work that way. Ideally it won't be needed.

Anyway:

A lot of the Proppian...microfunctions? are rather specific. I might generalise these away; e.g. a4 is 'lack of the egg of death' from 1 tale; RsX seem to be equally specific (help from specific people, or doing specific things).

I've also thought about how much extra fluff I could (or should) add. I think a story which consists of nothing but absolute key elements - hero, villain, donor, magical artifact, etc - would be dull. However, adding an entirely interactive world with dozens of items, characters, etc might get very clouded. I think I'll err on the side of clouding; otherwise I'm going to - if it even terminates - be very short on things to fit in 50k words.

enkiv2 commented 8 years ago

@michaelpaulukonis did something with Propp's motifs last year. You could probably pull the interesting stuff from his code: https://github.com/MichaelPaulukonis/malepropp

On Sat, Oct 31, 2015 at 10:20 AM Mark Garnett notifications@github.com wrote:

I've gotten a copy of Propp and given it a semi-quick read through. It's odd that you can only seem to find the first 2 chapters online; the rest are fairly short, but really interesting. Anyway.

I've fairly decided that I'll be doing this in Prolog. I'm a bit rusty, but it's not exactly a complicated language. It should be especially handy for:

  • constraint stuff when choosing what Proppian functions to pick and choose
  • sanity checking events (a character can't start doing things if they're dead or whatever)
  • picking between things.

If I do encounter serious speed problems, I'm competent enough with the SWI C++ interface to try and work that way. Ideally it won't be needed.

Anyway:

A lot of the Proppian...microfunctions? are rather specific. I might generalise these away; e.g. a4 is 'lack of the egg of death' from 1 tale; RsX seem to be equally specific (help from specific people, or doing specific things).

-

I can't seem to find anything explicitly about what can and can't be negated or contrarian; it makes sense that e.g. the donor's help isn't accepted, but not for it to happen with the Victory (the hero loses? it just..well, breaks the entire structure).

Originally I thought multiple moves (story arcs) would be covered easily by the simulation section. However, now I'm less sure. Propp's identified 6 different ways for multiple moves to fit together; I might stick with just sequential ones/interrupting ones, rather than simultaneous plots.

The micro-talespin source that @rbechtel https://github.com/rbechtel linked in their issue is interesting. ( http://eliterature.org/images/microtalespin.txt) It could be a good starting point for the simulation side. Things like promises could be very interesting to add in.

I've also thought about how much extra fluff I could (or should) add. I think a story which consists of nothing but absolute key elements - hero, villain, donor, magical artifact, etc - would be dull. However, adding an entirely interactive world with dozens of items, characters, etc might get very clouded. I think I'll err on the side of clouding; otherwise I'm going to - if it even terminates - be very short on things to fit in 50k words.

— Reply to this email directly or view it on GitHub https://github.com/dariusk/NaNoGenMo-2015/issues/22#issuecomment-152742197 .

PPKFS commented 8 years ago

Yep, he's done some amazing stuff. :)

He's got a lot of...template-based ideas, though; I'm really aiming to see how far this is possible without using templates, however. Obviously there's templates for a lot of it, but I'm seeing how little I can hardcode in and still get something out.

PPKFS commented 8 years ago

2 days down, 29 to go!

I'm going to try and get all 5 elements in a somewhat working state, then see about expanding on them. I've got 2 in the works!

First, I've started on a Proppian plot generator. Currently it'll randomly select elements - such that pairwise functions and the like are respected (so it won't try and violate an interdiction but not ever give an interdiction). It also outputs a very brief overview of the plot, just using Propp's titles:

Once upon a time, an introduction to the hero.
Later, an interdiction is given to the hero.
Later, the villain attempts to deceive their victim to take possession of them/their belongings.
Soon after, the villain causes harm or injury to a member of the family.
Later, one member of a family either lacks something or desires something.
Soon after, misfortune or lack is made known; the hero is approached with a request or command; they are allowed to go or are dispatched.
Later, the seeker agrees to or decides upon counteraction.
Soon after, the hero leaves home.
Later, the hero is tested.
Later, the hero reacts to the actions of the future donor.
Then, the hero acquires the use of a magical agent.
Later, the hero and villain join in direct combat.
Then, the villain is defeated.
Then, the initial misfortune is liquidated
Then, the hero returns.
Soon after, the hero, unrecognised, arrives home or in another country.
Then, a false hero presents unfounded claims.
Then, a difficult task is proposed to the hero.
Later, the task is resolved.
Soon after, the hero is recognised.
Then, the false hero is exposed.
Later, the hero receives a reward.
The end.

Currently working out a good mix of having plenty of elements and not just using every single possible event.

I took a quick detour to write a small script to extract useful data from the NELL ontology - I figured this might give some more interesting data for e.g. objects. It has over 37,000 things it labels as 'food'! Sadly it seems I can't get names from this, but I can get objects (food, drink, types of locations, etc).

I've also settled for medieval stasis. Each story will be set in a world with (at least one) a city, a small village, and a 'wilderness' location. Then, potentially, there may be extra cities, villages, and wilderness locations.

Currently I can add characters, put them somewhere, move them..but they don't do anything:

Bob is in the Hillington city gate and has done nothing.
Alice is in the Hillington city gate and has done nothing.

Probably need to get some directions there so they're standing by the gate or whatever.

And for current goals (next day or so):

With regards to actors, I'm going for something like talespin. Each character ('characters' are people and special interest/magical animals) has a number of needs; hunger, thirst, safety, socialising, potentially more. These increase or decrease. If they hit a certain limit, the character gets a new goal. A character can have many current goals (e.g. safety will be the highest priority). Every world step, the character will do something to complete a goal. If they have no goals, they'll probably wander around/socialise/explore/try to find things out. I hope.

The propp functions will be part of these goals. For the specific characters (hero, donor, etc) they will be considered as a need. This need goes up as the story progresses to make sure progress actually happens; e.g. if in the violation phase but the violation hasn't happened, the hero will get a low-priority goal to actively violate the interdiction. I'm not sure whether this'll work. It could be that the story never progresses unless they explicitly aim for it, which'd be odd ('here is 10 pages of Bob looking around the forest and chatting to his mum, then he decides the best idea is to go marry the princess') - but given I'm trying to feed as much as I can from a corpus and I might end up with a character deciding to eat 'Kit Anderson's Bad Attitude Barbecue Sauce'...it'll be good.

I hope!

marythought commented 8 years ago

^^This sounds so cool! I'm subscribing for updates...

PPKFS commented 8 years ago
Added a new goal: Bob is now trying to hunger

Bob has become hunger

Added a new goal: Bob is now trying to look

Bob is doing look

Added a new goal: AliceI is now trying to hunger

Alice has become hunger

Added a new goal: Alice is now trying to look

Alice is doing look

I just realised I've basically made a forager situation. Goals seem to be working fine. Currently the hunger ticks up (they do nothing), and when it hits the threshold they'll get a hunger goal (I AM BECOME HUNGER). There's a list of things they do under certain conditions - I love prolog so much for this - and each of those will add a new goal at higher priority (very slightly - so it'll override hunger, but not anything more important). The rough ordering currently is to get food (if they know it's nearby), look for food (if they don't), ask someone (if someone is nearby), go to the nearest food they've seen before (exploring along the way), or to explore areas they've not been to try and find food.

PPKFS commented 8 years ago

Been a bit swamped with real-world work so not done much, but just a quick update.

I've got goals working! The example I've got is hunger; it works well, I feel: http://i.imgur.com/OWKaaXu.png

The best bit about Prolog is how homogeneous everything is; by changing 2 words from 'food' to 'character' I've managed to create cannibals! http://puu.sh/l9mcy/186576eeec.png You might notice that Bob tries to pick up Bob and fails...there was a bug originally where characters could pick up themselves. This ended up with an...interesting situation where Bob picked up Bob, and then ate himself. Alice also picked herself up..and ate herself. They still existed, in the void - just..having eaten themselves. At least it stopped them being hungry, I guess.

I also had a realisation that I was going under some serious feature creep. As such, for now - and probably it'll be left as such - the world will be the same between stories. Names, people, plot - all different; however the layout of the city and world and stuff will be the same and is hardcoded in for now.

Another realisation (as I think I discussed in the Slack) is that I couldn't continue with my original plan - that is, have something reading like The Swallows, but have a sensible and realistic plot thread throughout. The best idea was to move to one or the other, and I've chosen the former. Getting sensible, realistic plot and whatnot is far too hard for 3 weeks. I'm now entirely rolling with the absurdity! I can predict the story will be something like:

Bob went and ate some food.
Bob walked around and talked about birds.
Bob's mum went to sleep.
Bob's mum died suddenly. (As the absentation goal fires).
Bob eats food.
Bob goes to sleep.
Bob leaves for the city. (As the hero departs).

If this actually stretches to 50,000 words...I can imagine 30 pages of utter nonsense followed by 2 sentences containing the entire plot, repeated 30 times.

All I hope is that I can make it good enough!

cpressey commented 8 years ago

This ended up with an...interesting situation where Bob picked up Bob, and then ate himself. Alice also picked herself up..and ate herself.

I suppose you could call this a bug, but I fail to see how it is not also extremely entertaining literature.