Professional Documents
Culture Documents
Abstract— Interactive fiction (IF) is a type of computer games have often been judged by the quality of their AI
games in which players use text commands inside a and praised if they used an innovative approach like the
literary narrative in order to influence the environment, ghosts in Pacman™ which had individual personality traits
the story and/or characters. These games can fit into (1980), Creatures™ which used neural networks for character
various genres but are most prominently adventure or development (1996), Black & White™ which used the be-
role-playing games that include various puzzles or quests lief desire intention (BDI) model (2000), F.E.A.R.™ which
for the player to complete in order to advance through used automated planning algorithms (2005) and many others
the narrative. In this paper we will review a number of (see [2, pp. 8–15] for a very detailed overview). Artificial
possibilities of including artificial intelligence (AI) methods intelligence in games is not only used for NPC or opponent
into such games including but not limited to natural implementation, but also for various other parts of games
language processing, autonomous agents, expert systems, [2, pp. 151–203] including but not limited to generation of
content generation and similar. In the end we provide content (graphics including levels and maps, sound, narratives,
proof-of-concept implementations of games which include rules and mechanics or even whole games like the Angelina
the reviewed methods and show the benefits of using them. game-generating system [3]), player behaviour and experience
modeling [2, pp. 203–259], as well as bot development and
Keywords— interactive fiction, artificial intelligence, com-
automated game testing [2, pp. 91–151].
puter games
Integrating AI into IF seemingly presents a interesting
challenge due to specifics of the medium, and there are
I. I NTRODUCTION
examples in industry which used various AI techniques in such
Interactive fiction (IF), text adventures, gamebooks and even games, some of which we will address. Herein we present a
in some cases visual novels comprise computer games in review on the possibilities AI can provide for IF games and
which players interact with the game using text commands show proof-of-concept applications on how these methods can
[1]. These narrative worlds usually consist of a number of be applied. In particular we will focus on natural language
rooms (whereby the term "room" is very broadly defined and processing (NLP), autonomous agents and multiagent system
can include any kind of imaginable space or even states of (MAS), expert systems as well as content generation.
mind) connected by doors (again very broadly defined), and The rest of this paper is structured as follows: firstly in II
in which objects or things can be placed that can be examined we provide an introduction to IF. In section III we review
and interacted with. Such things can, for example include non- various possibilities in which AI can be introduced in IF
playing characters (NPCs) that the player can communicate games. In section IV we provide four proof-of-concept game
with, containers that might have other objects within, edibles implementations which show some of the aspects that can be
that can be consumed, wearables that can be used as clothes or addressed in IF games using AI methods. In the end in section
equipment, etc. As opposed to most computer games focused V we provide our conclusions and give guidelines for future
on graphics, IF is focused on the story and narrative which research.
makes it an interesting and different medium similarly as
printed novels differ from movies. II. I NTERACTIVE F ICTION
An important aspect of game design is the integration of From computer games stance, IF is a type of a game that is
artificial intelligence (AI) [2]. Computer games have always most often a text adventure or a text game [1]. In our example,
been connected to the development of AI. From the earliest our focus is set to a text adventure. A such game includes a
chess minmax algorithm by Claude Shannon in 1949 to the story and a narrative that guides a player through it. A player
more recent AlphaGo™ in 2015, computer games provide an interacts with the game by using text commands. Interaction
ideal testing environment for AI methods. Similarly, AI has implies directly to the control of a player’s character (for an
always been an important part of computer games. Computer example, movement) or changes applied to the environment
In the context of developing an artificial autonomous player
of IF, methods of AI are used for: creating language models,
based on a genre-related corpus, suitable for a specific limited
game domain [16], implementing knowledge-based players
that utilise decision type specifications [13], testing an agent
that utilises the conversational learning approach on IF built
as an escape room [22], having agents mimic the behaviour
demonstrated by human players [24], agents building their
knowledge of the world while exploring the game and gen-
erating actions based thereon [9], increasing efficiency of
generating and evaluating player actions through agents using
multi-passage reading comprehension [11], simplifying quick
development of player agents [14], building deep reinforce-
ment learning models to be utilised by agents for playing
from game-provided feedback alone [15], solving games using
Fig. 1: A Screenshot of the game A Lecture implemented by model-checkers for C programs [17], and facilitating player
the authors performance using semantic parsing [25].
Having IF coupled with AI provides many application
opportunities, like adapting the storyline based on the in-game
(for an example, collection of an item). The user commands decisions of players [21] or combining elements of IF with
and narrative speech is natural and descriptive enabling players virtual reality (VR) (namely with cinematic VR [23], and
to imagine they are indeed part of a fiction. artificial storytellers [26]).
Since IF games don’t provide a graphical interface, a player A notable example of AI used in combination with IF is
needs to rely on its commonsense knowledge and be aware of AI Dungeon2 , an online text adventure game that utilises the
the environment its character is located at. Another challenge power of GPT-3 [20] since July 2020 to dynamically generate
that a player is confronted with are interaction commands. the world wherein the player is located. The generated world
Commands often use natural language, however, there is a is highly dependent on the performed actions of the player,
limited set of them available to the player. A story genre may yet the generated story is cohesive, thus providing for a "rich
also be of a significant importance on how a player progresses and engaging experience" [28].
through the game. To build our examples of integrating AI into IF, we have
Figure 1 previews a sample IF game developed in Inform used Inform 7. As stated earlier, it is a programming language
7,1 a declarative programming language for the development that utilises natural language syntax. The language exposes a
of IF based on natural language. In the upper part, we can broad set of commands covering the most frequent use-cases
see narrative output, while in the bottom part there is a player (for example, some of the commands are: take, go, examine
input. etc.). It also supplies the developer with various concepts to
build their narrative. The main concepts we used are: rooms,
III. A RTIFICIAL I NTELLIGENCE FOR IF items, persons and actions.
Being a predominantly textual medium due to text-based in- The beauty of Inform 7 also lays in the fact that to describe
put of relevant commands, IF is a relevant application domain a fiction, a developer uses a natural language syntax which
for AI-related concepts such as NLP and machine learning motivates the developer to behave and feel as if they were
(ML). According to the set of select recent publications, which writing a story on a piece of paper. The following code shows
are detailed below, these are being applied to the domain of IF a way to describe a world:
mainly as a means of generating the worlds of those narratives "The Dungeon" by "Markus Schatten".
and developing autonomous agents who act as players of Release along with an interpreter.
developed IF narratives. Furthermore, modern AI methods Release along with a website.
When play begins:
are used for testing developed narratives [18] and developing
say "You find yourself in a dungeon
dynamic in-game characters [27] as well. ,→ surrounded by darkness. The stench
More precisely, AI is, utilising various approaches, used ,→ is awful." ;
for: authoring instances of open interactive narratives based The pit is a room. The description is "This is
on crowdsourced example stories [12], making it easier to ,→ the place where you woke up. What a
,→ scary place!"
successfully process natural language player input [10], pro- A torch is here. The description is "You can
cedurally generating in-game content and quests [19], [7], and ,→ see a dim light flickering a few steps
procedurally generating whole worlds founded on knowledge ,→ away from you."
graphs inspired by stories from books [8]. ...
[13] M. Hausknecht, R. Loynd, G. Yang, A. Swaminathan, and J. D. Cinematic Virtual Reality,” in Proceedings of the 9th International
Williams. NAIL: A General Interactive Fiction Agent. [Online]. Conference on Digital and Interactive Arts. ACM, pp. 1–8.
Available: http://arxiv.org/abs/1902.04259 [24] J. Rivera-Villicana, F. Zambetta, J. Harland, and M. Berry, “Exploring
[14] M. Hausknecht, P. Ammanabrolu, M.-A. Côté, and X. Yuan, “Interactive Apprenticeship Learning for Player Modelling in Interactive Narratives,”
Fiction Games: A Colossal Adventure,” vol. 34, no. 05, pp. 7903–7910. in Extended Abstracts of the Annual Symposium on Computer-Human
[15] V. Jain, W. Fedus, H. Larochelle, D. Precup, and M. G. Bellemare, Interaction in Play Companion Extended Abstracts. ACM, pp. 645–
“Algorithmic Improvements for Deep Reinforcement Learning Applied 652.
to Interactive Fiction,” vol. 34, no. 04, pp. 4328–4336. [25] B. Swanson and B. Smus, “Usnea: An Authorship Tool for Interactive
[16] B. Kostka, J. Kwiecien, J. Kowalski, and P. Rychlikowski, “Text-based Fiction using Retrieval Based Semantic Parsing,” in Proceedings of the
Adventures of the Golovin AI Agent,” pp. 181–188. 58th Annual Meeting of the Association for Computational Linguistics:
[17] M. M. Lester, “Program Transformations Enable Verification Tools to System Demonstrations. Association for Computational Linguistics, pp.
Solve Interactive Fiction Games,” in 7th International Workshop on 263–269.
Rewriting Techniques for Program Transformations and Evaluation. [26] S. Thorne, “Hey Siri, tell me a story: Digital storytelling and AI
Université Sorbonne Paris Nord, p. 10. authorship,” vol. 26, no. 4, pp. 808–823.
[27] M. Zhang, “Application of Artificial Intelligence Interactive storytelling
[18] ——, “ScAmPER: Generating Test Suites to Maximise Code Coverage
in Animated,” in 2020 International Conference on Control, Robotics
in Interactive Fiction Games,” in Tests and Proofs, ser. Lecture Notes
and Intelligent System. ACM, pp. 37–41.
in Computer Science, W. Ahrendt and H. Wehrheim, Eds. Springer
[28] Latitude Team. AI Dungeon: Dragon Model Upgrade.
International Publishing, vol. 12165, pp. 169–179.
Latitude Team. [Online]. Available: https://aidungeon.medium.com/
[19] A. Summerville, S. Snodgrass, M. Guzdial, C. Holmgard, A. K. Hoover,
ai-dungeon-dragon-model-upgrade-7e8ea579abfe
A. Isaksen, A. Nealen, and J. Togelius, “Procedural Content Generation
[29] J. Palanca, A. Terrasa, V. Julian, and C. Carrascosa, “Spade 3: Support-
via Machine Learning (PCGML),” vol. 10, no. 3, pp. 257–270.
ing the new generation of multi-agent systems,” IEEE Access, vol. 8,
[20] T. B. Brown, B. Mann, N. Ryder, M. Subbiah, J. Kaplan, P. Dhariwal, pp. 182 537–182 549, 2020.
A. Neelakantan, P. Shyam, G. Sastry, A. Askell, S. Agarwal, [30] G. G. Smith, R. Haworth, and S. Žitnik, “Computer science meets
A. Herbert-Voss, G. Krueger, T. Henighan, R. Child, A. Ramesh, D. M. education: Natural language processing for automatic grading of open-
Ziegler, J. Wu, C. Winter, C. Hesse, M. Chen, E. Sigler, M. Litwin, ended questions in ebooks,” Journal of Educational Computing Re-
S. Gray, B. Chess, J. Clark, C. Berner, S. McCandlish, A. Radford, search, vol. 58, no. 7, pp. 1227–1255, 2020.
I. Sutskever, and D. Amodei. Language Models are Few-Shot Learners.
[Online]. Available: http://arxiv.org/abs/2005.14165
[21] D. H. Choi, “LYRA: An Interactive and Interactive Storyteller,” in
2019 IEEE International Conference on Computational Science and
Engineering (CSE) and IEEE International Conference on Embedded
and Ubiquitous Computing (EUC). IEEE, pp. 148–153.
[22] C. Kowald and B. Bruns, “New Learning Scenarios with Chatbots
– Conversational Learning with Jix: From Digital Tutors to Serious
Interactive Fiction Games,” vol. 12, no. 2, p. 59.
[23] M. C. Reyes and G. Dettori, “Combining Interactive Fiction with