«Abstract. Using Punch and Judy as a story domain, we describe an interactive puppet show, where the ﬂow and content of the story can be inﬂuenced ...»
5.2 Norms as percepts When an event occurs, it is added to the event timeline, which is used to query the ASP (Answer Set Programming) solver to obtain the set of norms that hold after the new event has occurred. The new permissions and obligations are then added to each agent as percepts. Each time this happens, the set of permitted and obliged actions that an agent sees is changed to be only those that apply at that instant in time, with the previous norms being discarded.
Agents choose between permitted and obliged actions based on their emotional state at the point of decision making. Obliged actions are given a higher priority over permitted ones for most of the emotional states that an agent can be in, though not always. If an agent is in a sulky mood, for example, they may decide to ignore what they are obliged to do by the narrative, even though they know there will be consequences.
For example, in the scene where Joey gives the sausages to Punch, Punch may see that he has permission to eat the sausages, drop them, ﬁght the crocodile, run away (leave the stage) or shout for help at the crocodile or audience. His obligation for the scene, in accordance with the Punch and Judy narrative world, is to either eat the sausages himself, or let the crocodile have them. This ends Propp’s interdiction story function with a violation function. Note that his obligation in this case is not to guard the sausages as asked to by Joey. While Joey’s entrusting of the sausages is certainly an obligation in itself, Punch’s main obligations are to the narrative. Lesser obligations towards characters in the story can be implemented as having a lower prority than those of the story itself.
Similarly, at times of extreme emotion, an agent may decide to disregard their set of permitted actions entirely, instead acting out their innermost desires. For example, an angry Punch might decide to just attack Joey instead of agreeing to look after the sausages, or he might just decide to give up and leave if he’s depressed. The key point is that the norms act as the will of the narrative, guiding the story forward, rather than a strict set of rules that the agents must follow at all costs.
Violation events add percepts to the agents telling them that they are in violation of the narrative norms. Once an agent receives such a percept, an emotional variable is changed. Typically, their dominance will decrease. The reasoning behind this is that if agents are unwilling to participate in the story, they should have less inﬂuence in its course of events.
6.1 Multi-Agent System We use the JASON framework for belief-desire-intention (BDI) agents , programming our agents in the AgentSpeak language.
The VAD emotional model is represented inside each agent as a set of beliefs. Each agent has beliefs for its valence, arousal and dominance levels, each of which can take the value of low, medium or high, as discussed in section 4. This combination of VAD values creates one of the 27 emotional states shown in ﬁgure 5, affecting whether or not an agent breaks from its permitted or obliged behaviour.
6.2 Institutional Framework
To describe our institutional model, we use instAL , a domain-speciﬁc (action) language for describing institutions that compiles to AnsProlog, a declarative programming language for Answer Set Programming (ASP). InstAL’s semantics are inspired by the Situation Calculus  and the Event Calculus . It is used to describe how external events generate institutional events, which then can initiate or terminate ﬂuents that hold at certain instances in time. These ﬂuents can include the permissions and obligations that describe what an agent is permitted or obliged to do at speciﬁc points in time, as described in section 3.
For example, if an agent with the role of dispatcher leaves the stage, it generates the
absentation Propp move in the institution:
1 leaveStage(X) generates intAbsentation(X) if role(X, dispatcher), activeFunction(interdiction);
The absentation institutional event gives the crocodile permission to enter the stage if there are any sausages on the stage. It also terminates the permission of the absented
agent to leave the stage, as they have already done so:
1 intAbsentation(X) initiates perm(enterStage(croc)) if objStage( sausages);
2 intAbsentation(X) terminates onStage(X), perm(leaveStage(X));
InstAL rules like those shown above are compiled into AnsProlog. Once this is done, we use the clingo answer set solver  to ground the program, and ‘solve’ queries by ﬁnding all permissions and obligations that apply to any agents, given a sequence of events as the query input. The agents’ percepts are then updated with their permitted and obliged actions from that moment in time onwards. Thus, the institutional model acts as a social narrative sensor, interpreting actors’ actions in the context of the concrete narrative and the abstract story moves detach (instantiate) the norms that guide the actors in the direction of the conclusion of the story arc.
Listing 1.3 shows how the sausages scenario would be described using ASP, for the ﬁrst two events of the scene.
Starting with an initial set of ﬂuents that hold at t0, only ﬂuents that have been initiated and not terminated hold at the next instant.
Sausages scene using ASP 1 holdsat(perm(tellprotect(dispatcher, villain, item), t0).
2 occurred(tellprotect(dispatcher, villain, item), t0).
4 initiated(active(interdiction), t1).
5 initiated(perm(give(donor, villain, item)), t1).
6 terminated(tellprotect(dispatcher, villain, item), t1).
7 holdsat(perm(give(donor, villain, item)), t1).
8 holdsat(active(interdiction), t1).
9 occurred(give(donor, villain, item), t1).
11 initiated(active(receipt), t2).
12 initiated(perm(leavestage(donor)), t2).
13 terminated(perm(give(donor, villain, item)), t2).
14 holdsat(active(interdiction), t2).
15 holdsat(active(receipt), t2).
16 holdsat(perm(leavestage(donor)), t2).
If the user allows the program access to their microphone, they can cheer or boo the actions of the agents by shouting into the microphone. Otherwise, they can simulate these actions by clicking on ‘cheer’ or ‘boo’ buttons at the bottom of the screen. In situations where a large audience is cheering or booing at the show, ambiguous audience input can be overcome by having a person click these buttons according to whichever response they think to be more popular.
7 Audience Interaction
The puppet show is designed to be run in front of either a single user’s computer, or on a large display in front of an audience. The user/audience is instructed to cheer or boo the actions of the characters of the show, which will be picked up by a microphone and ‘heard’ by the agents. This will then affect the emotional state of the agents and change the actions they make in the show. Their actions are constrained by the set of ‘Punch and Judy’ world norms as described in the institutional model.
There are many different ways in which the audience’s responses can affect the outcomes of the show. If the audience craves a more ‘traditional’ Punch and Judy experience, then they can cheer Punch into beating and killing all of his adversaries (including his wife, Judy). Alternatively, a more mischievous audience could goad Judy into killing Punch and then taking over his role as sadist and killer for the rest of the show. The narrative outcomes are dependent on how the audience responds to the action, yet still conform to the rules of the Punch and Judy story world.
With our approach to interactive narrative generation, we regulate the rules of the story domain using an institutional model. This model describes what each agent is permitted and obliged to do at any point in the story. This approach alone would be too rigid, however. The audience’s interactions (cheering or booing) may alter the course of the narrative, but the agents would still have to blindly follow a pre-determined set of paths.
By giving our agents emotional models that change their willingness to follow the narrative, a degree of unpredictability enters each performance, giving the impression that the agents are indeed characters capable of free will. Moving forward, the VAD emotional model could be replaced with a more sophisticated model based on the appraisal theory of emotion. Also, Propp’s formalism is too speciﬁc to Russian folktales and could be replaced with something more general, such as Lehnert’s story functions . However, these simple approaches have provided a ﬁrst step towards developing an institutional model for narrative and a preliminary validation of the WIT model.
1. Junghyun Ahn, St´ phane Gobron, David Garcia, Quentin Silvestre, Daniel Thalmann, and e Ronan Boulic. An NVC emotional model for conversational virtual humans in a 3D chatting environment. In Articulated Motion and Deformable Objects, pages 47–57. Springer, 2012.
2. Alexander Artikis, Marek Sergot, and Jeremy Pitt. Specifying norm-governed computational societies. ACM Transactions on Computational Logic (TOCL), 10(1):1, 2009.
3. Pablo Cayetano Noriega Blanco-Vigil. Agent mediated auctions: the ﬁshmarket metaphor.
PhD thesis, Universitat Aut` noma de Barcelona, 1998.
4. Rafael H Bordini, Jomi Fred H¨ bner, and Michael Wooldridge. Programming multi-agent u systems in AgentSpeak using Jason. John Wiley & Sons, 2007.
5. Henrique Lopes Cardoso and EugENio Oliveira. Institutional reality and norms: Specifying and monitoring agent organizations. International Journal of Cooperative Information Systems, 16(01):67–95, 2007.
6. Owen Cliffe, Marina De Vos, and Julian Padget. Specifying and reasoning about multiple institutions. In Coordination, Organizations, Institutions, and Norms in Agent Systems II, pages 67–85. Springer, 2007.
7. Nicoletta Fornara, Francesco Vigan`, and Marco Colombetti. Agent communication and o artiﬁcial institutions. Autonomous Agents and Multi-Agent Systems, 14(2):121–142, 2007.
8. Martin Gebser, Benjamin Kaufmann, Roland Kaminski, Max Ostrowski, Torsten Schaub, and Marius Schneider. Potassco: The potsdam answer set solving collection. AI Communications, 24(2):107–124, 2011.
9. Robert Kowalski and Marek Sergot. A logic-based calculus of events. In Foundations of knowledge base management, pages 23–55. Springer, 1989.
10. Jeehang Lee, Vincent Baines, and Julian Padget. Decoupling cognitive agents and virtual environments. In Frank Dignum, Cyril Brom, Koen Hindriks, Martin Beer, and Deborah Richards, editors, Cognitive Agents for Virtual Environments, volume 7764 of Lecture Notes in Computer Science, pages 17–36. Springer Berlin Heidelberg, 2013.
11. Seung Lee, Bradford Mott, and James Lester. Learning director agent strategies: An inductive framework for modeling director agents. In AAAI Conference on Artiﬁcial Intelligence and
Interactive Digital Entertainment, 2011 (retrieved 9th June 2015). Online proceedings: http:
12. Wendy G Lehnert. Plot units and narrative summarization*. Cognitive Science, 5(4):293–331, 1981.
13. Pablo Noriega, Julian Padget, Harko Verhagen, and Mark d’Inverno. Meandering through socio-cognitive technical systems. In Nir Oren, Pankaj Telang, Aditya Ghose, and John Thangarajah, editors, COIN Selected Papers 2014, LNCS. Springer, 2014. To appear.
14. Vladimir Propp. Morphology of the folktale. 1928. Trans. Svatava Pirkova-Jakobson. 2nd ed.
Austin: U of Texas P, 1968.