Intelligent Narrative Generation: Creativity, Engagement, and Cognition Mark Riedl riedl@cc.gatech.edu @mark_riedl
Tell me a story 2
Storytelling Storytelling is pervasive part of the human experience Books, movies, computer games, training scenarios, education, every-day communication, etc. Narrative Intelligence: narrative is a fundamental means by which we organize, understand, and explain the world Instill computational systems with the ability to craft and tell stories in order to be better entertainers, educators, trainers, communicators, and generally more capable of relating to humans 3
Why study story generation? Stories are everywhere Humans make up stories all the time, but computers do not Cognitive science Computational creativity Practical creativity Popular Mechanics, 1931 4
There is a woman named Jasmine. There is a king named Jafar. This is a story about how King Jafar becomes married to Jasmine. There is a magic genie. This is also a story about how the genie dies. There is a magic lamp. There is a dragon. The dragon has the magic lamp. The genie is confined within the magic lamp. King Jafar is not married. Jasmine is very beautiful. King Jafar sees Jasmine and instantly falls in love with her. King Jafar wants to marry Jasmine. There is a brave knight named Aladdin. Aladdin is loyal to the death to King Jafar. King Jafar orders Aladdin to get the magic lamp for him. Aladdin wants King Jafar to have the magic lamp. Aladdin travels from the castle to the mountains. Aladdin slays the dragon. The dragon is dead. Aladdin takes the magic lamp from the dead body of the dragon. Aladdin travels from the mountains to the castle. Aladdin hands the magic lamp to King Jafar. The genie is in the magic lamp. King Jafar rubs the magic lamp and summons the genie out of it. The genie is not confined within the magic lamp. King Jafar controls the genie with the magic lamp. King Jafar uses the magic lamp to command the genie to make Jasmine love him. The genie wants Jasmine to be in love with King Jafar. The genie casts a spell on Jasmine making her fall in love Popular Mechanics, 1931 with King Jafar. Jasmine is madly in love with King Jafar. Jasmine wants to marry King Jafar. The genie has a frightening appearance. The genie appears threatening to Aladdin. Aladdin wants the genie to die. Aladdin slays the genie. King Jafar and Jasmine wed in an extravagant ceremony. The genie is dead. King Jafar and Jasmine are married. The end.
Story Generation Interactive Narrative Narrative Intelligence
Automated story generation Automatic creation of meaningful fictional sequences is hard Complexity, subtlety, nuance, mimesis Focus on plot Two nearly-universal properties of story Causal progression Perception that the main events of the story make up causal chains that terminate in the outcome Character believability Perception that characters act in a manner that does not distract from one s suspension of disbelief Characters are perceived to be intentional agents It s hard if you want to show computational creativity 7
Computer as author Creative writing is a problemsolving activity Author goals vs. character goals Plan out the events that should occur in the narrative 8
Narratives as plans Partial-order plan is a good representation of plot Action, temporality, causality Planning: find a sound and coherent sequence of actions that transforms the initial state into one in which the goal situation holds Wolf is alive Wolf is alive Wolf knows Granny Initial State Wolf knows Red Wolf is alive Red Greets Wolf Red Tell Wolf About Granny Wolf knows Red Wolf Eats Red Wolf is alive Wolf Eats Granny...... Outcome
Planning stories But, is planning a good model of story creation? Conventional Planning Single or multiple agents Goal state is agents desired world state Agents intend to enact the plan Narrative Planning Multiple characters Goal state describes outcome of the story Outcome is not necessarily intended by any characters Augment planning algorithm to reason about author goals and character goals 10
Fabulist Conventional causal dependency planning Provides logical causal progression Joe intends has(villain, $$$)...... Coerce (Villain, Joe) Rob-Bank (Joe, Bank) has (Joe, $$$) Give (Joe, $$$, Villain) has (Villain, $$$) Outcome Kidnap (Villain, Joe s-family) Reasoning about character intentions Use a cognitive model to determine whether characters appear intentional and revise the plan otherwise Insert actions that explain character goals 11 Riedl & Young. Journal of Artificial Intelligence Research, 39, 2010.
Falls-in-Love (King, Jasmine, Castle) Order (King, Aladdin, has(king, Lamp)) Travel (Aladdin, Castle, Mountain) at (Aladdin, Mountain) Slay (Aladdin, Dragon, Mountain) ~alive (Dragon) at (Aladdin, Mountain) at (Aladdin, Mountain) Pillage (Aladdin, Lamp, Dragon, Mountain) has (Aladdin, Lamp) Travel (Aladdin, Mountain, Castle) at (Aladdin, Castle) Give (Aladdin, Lamp, King, Castle) at (Aladdin, Castle) has (King, Lamp) Summon (King, Genie, Lamp, Castle) at (Genie, Castle) controls (King, Genie) at (Genie, Castle) at (Aladdin, Castle) Appear-Threatening (Genie, Aladdin, Castle) Command (King, Genie, loves(jasmine, King)) loves (King, Jasmine) Love-Spell (Genie, Jasmine, Castle) at (Genie, Castle) loves (Jasmine, King) Slay (Aladdin, Genie, Castle) Marry (King, Jasmine, Castle)
Falls-in-Love (King, Jasmine, Castle) There is a woman named Jasmine. There is a king named Jafar. This is a story about how King Order Jafar (King, becomes Aladdin, has(king, married Lamp)) to Jasmine. There is a magic genie. This is also a story about how the genie dies. There is a magic lamp. There is a dragon. The dragon has the Travel (Aladdin, Castle, Mountain) magic lamp. The genie is confined within the magic lamp. at (Aladdin, Mountain) King Jafar is not married. Jasmine is very beautiful. King Jafar at (Aladdin, Mountain) Slay (Aladdin, Dragon, Mountain) sees Jasmine and instantly falls in love with her. King Jafar wants to ~alive (Dragon) at (Aladdin, Mountain) marry Jasmine. There is a brave knight named Aladdin. Aladdin is loyal to the death to King Jafar. Pillage King (Aladdin, Jafar Lamp, orders Dragon, Aladdin Mountain) to get the magic lamp for him. Aladdin wants King Jafar to have the magic lamp. Aladdin travels from the has (Aladdin, castle Lamp) to the mountains. Aladdin slays the dragon. The dragon is dead. Aladdin takes the magic at (Aladdin, Castle) lamp from the dead body of the dragon. Aladdin travels from the Give (Aladdin, Lamp, King, Castle) mountains to the castle. Aladdin hands the magic lamp to King Jafar. The genie is in the magic has lamp. (King, Lamp) King Jafar rubs the magic Marry (King, Jasmine, Castle) Travel (Aladdin, Mountain, Castle) lamp and summons the genie out of it. The genie is not confined Summon (King, Genie, Lamp, Castle) within the magic lamp. King Jafar controls the genie with the magic at (Genie, Castle) lamp. King Jafar uses the magic at (Genie, lamp Castle) to command the genie to controls (King, Genie) make Jasmine love him. The genie wants Jasmine to be in love with King Jafar. The genie casts a spell on Jasmine making her fall in love Command (King, Genie, loves(jasmine, King)) with King Jafar. Jasmine is madly in love with King Jafar. Jasmine wants to marry King Jafar. The genie has a frightening appearance. loves (King, Jasmine) The genie appears threatening Love-Spell to Aladdin. (Genie, Jasmine, Aladdin Castle) wants the genie to die. Aladdin slays the genie. King Jafar and Jasmine wed in an extravagant ceremony. loves (Jasmine, King) The genie is dead. King Jafar and Jasmine are married. The end. at (Aladdin, Castle) Appear-Threatening (Genie, Aladdin, Castle) at (Genie, Castle) Slay (Aladdin, Genie, Castle) Talk about knowledge: library of actions, characters, world state propositions at (Aladdin, Castle)
The goodness question Does the story generator know that it is creating something good? How can a computational system generate a suspenseful story? Falls-in-Love (King, Jasmine, Castle) Order (King, Aladdin, has(king, Lamp)) Travel (Aladdin, Castle, Mountain) at (Aladdin, Mountain) Slay (Aladdin, Dragon, Mountain) ~alive (Dragon) at (Aladdin, Mountain) at (Aladdin, Mountain) Observe event Compute affect Problemsolve Pillage (Aladdin, Lamp, Dragon, Mountain) has (Aladdin, Lamp) Travel (Aladdin, Mountain, Castle) at (Aladdin, Castle) Give (Aladdin, Lamp, King, Castle) at (Aladdin, Castle) has (King, Lamp) at (Aladdin, Castle) Summon (King, Genie, Lamp, Castle) at (Genie, Castle) at (Genie, Castle) controls (King, Genie) Appear-Threatening (Genie, Aladdin, Castle) Command (King, Genie, loves(jasmine, King)) Part of script? N Y Track script Forecast w/script Forecast w/ simulation & rules Y Goal violation? N loves (King, Jasmine) Love-Spell (Genie, Jasmine, Castle) at (Genie, Castle) loves (Jasmine, King) Slay (Aladdin, Genie, Castle) Marry (King, Jasmine, Castle) New author goal 14 O Neill & Riedl. Proc. ACII 2011 Conference.
Story Generation Interactive Narrative Narrative Intelligence
Interactive narrative A form of digital entertainment in which the player influences a dramatic storyline through actions
Interactive narrative Narrative branches in response to player actions Combinatorics of authoring 1 4 5 Drama manager: 9 7 13 8 10 Monitors the virtual world Intervenes to drive the story in a particular direction 58 15 20 32 31 43 62 55 45 57 22 34 21 33 14 23 50 38 48 40 19 16 28 24 27 26 39 42 116 52 54 29 Surrogate for the human author/storyteller 77 91 101 103 80 95 106 111 81 82 110 96 98 109 60 76 78 100 104 75 46 47 65 67 73 59 64 86 87 85 102 37 114 83 99 49 68 69 55 76 51 70 90 63 72 92 97 Page # 112 113 107 17 Riedl, Bulitko. AI Magazine, 34(1), 2013.
Automated story director Generative drama manager: uses a story generator to construct alternative branches Start with an exemplar narrative (generated or hand-authored) Monitor player actions: Constituent: part of the narrative plan Consistent: do not affect narrative execution Exceptions: derail the narrative plan How to detect exceptions? How to respond to exceptions? 18 Riedl, Stern, Dini & Alderman. ITSSA, 3, 2008.
Initial State Wolf is alive Wolf is alive Wolf is alive Player kills Wolf Red Greets Wolf Wolf knows Red Wolf is alive Red has cake Player takes cake Red Tell Wolf About Granny Wolf knows Red Wolf knows Granny Wolf Eats Granny Wolf Eats Red Granny eaten Red eaten Player Kills Wolf Wolf not alive Granny Escapes from Wolf Wolf not alive Red Escapes from Wolf Granny not eaten Red not eaten Red Gives Granny Cake Outcome Granny has cake
Initial State Intermediate State 5: Red Greet Wolf 11: Fairy Resurrect Wolf 4: Red Tell Wolf Granny Wolf not alive 6: Wolf Eat Red 3: Wolf Eat Granny 18: Red Tell Gr 6: Wolf Eat Red 3: Wolf Eat Granny 9: Player Kill Wolf 17: Grendel Eat R 9: Player Kill Wolf 10: Red Escape Wolf 8: Granny Escape Wolf 13 10: Red Escape Wolf 8: Granny Escape Wolf 7: Red Give Granny Cake 16: Red Escape 7: Red Give Granny Cake Red not has cake Outcome 19: Outcome Intermediate State Inte 11: Fairy Resurrect Wolf 10 3: Wolf Eat Granny 16: R 9: Player Kill Wolf 15: Red 10: Red Escape Wolf 8: Granny Escape Wolf 14: G 7: Red Give Granny Cake 13: P
Automated story director Pre-compute branches Semi-autonomous virtual characters 21
Personalized drama management When dungeon master, learned the hard way that if players don t get what they want, they fight you. Problem: players don t know how their actions will impact unfolding narrative Need to account for individual preferences for how story should unfold Can we learn a model of player story preferences? Leave your home Enter the movie theatre Attacked by vampires Captured! Can a drama manager guide a player through his or her most preferred story trajectory? Chased by zombies Escape from theatre 22 Yu & Riedl. AAMAS 2012 Conference.
Player modeling Collaborative filtering: observe many players and find statistical similarities with which to recommend next plot point Sequential recommendation: recommendation of plot point is dependent on history of plot points experienced so far Convert branching story graph into a prefix tree and recommend next prefix node A A1 1 1 1 2 2 3 3 4 4 B B1, 1, 2 2 C C1, 1, 2, 2, 6 6 D D1, 1, 2, 2, 3 3 6 6 5 5 E E1, 1, 2, 2, 6, 6, 5 5 F F1, 1, 2, 2, 3, 3, 4 4 G G1, 1, 2, 2, 3, 3, 5 5 23 (a) (a) (b) (b)
T In. our In our simple simple spell-casting action action role-playing game game ribed in the in the next next section), U is Uthe is the player player ( user ), I isi is pell l type type ( item ) and and T is T the is the time time of the of the performance rding. CP CP decomposition is aisgeneralization a of singular of e decomposition from fromatrices to tensors. to In CP In CP decomiothe the three-dimensional Z tensor Z tensor is decomposed is into into ighted combination of three of three vector vector latent latent factors, Prefix-based collaborative filtering Non-negative matrix factorization over story prefixes KX KX Z Z kw kw k k h k h k q k q k k=1 k=1 eis the is the vector vector outer outer product, k are k are positive weights e factors, w k ware k are player player factors, h k hare k are spell spell type type facdand q k are q k are time time factors. K is Kthe is the number of components of rfor each each factor factor as an as an approximation of the of the true true struc- struc- facepinkeeping the the set set of the of the K Kmost most important components d (Kolda and and Bader Bader 2009). 2009). The The decomposition can can be be puted by by minimizing the the root root mean mean squared error error behn the factor factor inner inner product above above and and true true data data values, values, be- tively fitting fitting each each of the of the factors factors while while fixing fixing values values of of ther r factors factors until until convergence. We We employ the the N-way N-way ox (Andersson and and Bro Bro 2000) 2000) to perform to this this decom- ion.. Predictions in this in this model model consist consist of taking of taking the the in- in- 24
Experimental results Non-sequential recommendation indistinguishable from random PCBF improves story experiences: Compared to other approaches (using synthetic players): 26
Player agency No player agency -- system picks the best trajectory on behalf of the player Modify story graph: more than one option/action between plot points Collaborative filtering to also predict rank order of options A 1 3 4 2 Drama manager guides player by selecting which options to present to the player B C 33% 75% 66% 25% 27
Computer game generation Challenge tailoring Choose and order the challenges the player should experience Challenge Contextualization Provide motivating story context between challenges
Difficulty Challenge tailoring Zook & Riedl. Proc. AIIDE 2012 Conference. Time
Challenge contextualization Take water bucket Pour water on witch Witch drops shoes Pick up shoes Show shoes to king King trusts you Tell about princess Move to lair Kill dragon Free princess Teleport princess to palace Marry princess Li & Riedl. Proc. AIIDE 2010 Conference. Hartsook, Zook, Das & Riedl. Proc. CIG 2010 Conference.
Story Generation Interactive Narrative Narrative Intelligence
Open story generation Narrative intelligence is knowledge-intensive, resulting in micro-worlds Can we overcome the knowledge engineering bottleneck? Can an intelligent system learn to tell stories about any imaginable domain?
Sociocultural storytelling Humans rely on a lifetime of experiences from which to explain stories, tell stories, or act in the real-world Computational systems can now live in a rich information ecosphere, including the Web, other agents, and humans Possible approaches: Read natural language corpora & websites Mine commonsense knowledge bases Learn from humans 34
Crowdsourcing narrative intelligence A crowd of humans on the web a supercomputer Insight: humans learn from stories Use a crowd to simulate a lifetime of experiences by asking people to tell stories about a specific type of situation Crowdsource a highly specialized corpus of narrative examples and learn a generalized model of sociocultural situations Automatically generate stories and interactive experiences without a priori domain knowledge authoring 35
Scheherazade Just-in-time model learning Collect written stories via Amazon Mechanical Turk Learn model via semantic parsing, pattern mining, global optimization Barthes: human narratives implicitly encode causality Grice: maxims of quality and relevance (and quantity) Collect Stories! Learn Model! Memory! Create Story! 36 Li, Lee-Urban, Appling & Riedl. Advances in Cognitive Systems, 2, 2012.
Sociocultural knowledge representation Model a situation as a script Representation of procedural knowledge Tells one what to do and when to do it Correlated with expertise Set of temporally ordered events... walk/go into restaurant read menu wait in line choose menu item take out wallet place order pay for food... 37
Learning to tell stories 1. Query the crowd 2. Identify the salient events 3. Determine event ordering 4. Mutually exclusive events Crowd control: Segment narrative Use one verb per sentence Avoid conditionals and compound structures Avoid using pronouns 38
Learning to tell stories 1. Query the crowd 2. Identify the salient events 3. Determine event ordering 4. Mutually exclusive events Crowd control simplifies NLP Compute semantic similarity between sentences Cluster sentences into events Order food * Precision 85% Eat food 39
Learning to tell stories 1. Query the crowd 2. Identify the salient events 3. Determine event ordering 4. Mutually exclusive events Seek evidence for temporal relations Binomial confidence testing Search for the most compact graph that explains the stories Story 1 Story 2 Story 3 Story 4 walk/go into restaurant read menu wait in line choose menu item take out wallet place order pay for food 40
Learning to tell stories 1. Query the crowd 2. Identify the salient events 3. Determine event ordering 4. Mutually exclusive events Measure mutual information between events Mutual information is high and co-occurrence is low Generalization of or relations choose restaurant drive to restaurant walk/go into restaurant mutex drive to drive-thru 41
choose restaurant Fast food restaurant drive to restaurant walk/go into restaurant read menu drive to drive-thru wait in line choose menu item take out wallet place order pay for food drive to window wait for food get food find table sit down eat food clear trash leave restaurant drive home 42
arrive at theatre go to ticket booth wait for ticket choose movie buy tickets go to concession stand order popcorn / soda show tickets buy popcorn enter theatre find seats Going on a date to the movies turn off cellphone sit down eat popcorn watch movie use bathroom talk about movie discard trash hold hands kiss leave movie 43 drive home
John covers face Bank robbery John enters bank John sees Sally John waits in line John approaches Sally Sally is scared Sally greets John John hands Sally a note John pulls out gun Sally reads note John points gun at Sally Sally screams John shows gun John demands money John gives Sally bag The note demands money Sally opens cash drawer Sally collects money Sally give John money Sally puts money in bag Sally presses alarm Sally gives John bag John collects money John takes bag John opens bank door John leaves bank John gets in car Police arrives John drives away Police arrests John Sally calls police 44
Narrative generation Script defines a space of linear sequences Search for most typical, least typical, specific events, surprising, etc. Evaluation shows generated stories comparable to humanauthored stories Collect Stories! Learn Model! Memory! Create Story! 45
Interactive narrative generation Li, Lee-Urban & Riedl. Proc. Intelligent Narrative Technologies 2012 Workshop.
The road ahead Starting with basics of plot causality and character believability Progressively layering complexity Computational aesthetics Data-driven tailoring Story generation in the real world 47
Conclusions Story generation is a key capability that unlocks many practical, real-world applications Create and manage user experiences in virtual worlds Games, interactive narratives, training simulations, narrative learning environments, virtual characters Narrative intelligence is a step toward human-level intelligent systems Creative, expressive computational systems 48
Acknowledgements Boyang Li Brian O Neill Alexander Zook Hong Yu Ken Hartsook Michael Drinkwater Steve Lee-Urban Sauvik Das Rania Hodhod Mohini Thakkar Sanjeet Hajarnis George Johnston Charles Isbell R. Michael Young Thanks! Questions? riedl@cc.gatech.edu @mark_riedl 49