Intertwining World and Narrative Generation for a Mobile Role-playing Game Joel Jonasson1 , Brenden Lech2 , Sasha Azad2 , Chris Martens2 1 Blast Bit Enterprises AB, Sweden 2 North Carolina State University, USA joel.jonasson@blastbit.net,{bglech, sasha.azad, mawellni}@ncsu.edu, crmarten@ncsu.edu Making a game where the environments, characters, and story are all procedurally generated is a complex task. We are a small studio in Sweden trying to develop such a game for the mobile market (working title “Lance a Lot”). Our game adopts role-playing game conventions, such as an ex- plorable world map, non-player characters, and quests. It is our aim to develop as our ”story engine” a system capable of procedurally generating quests and narratives to guide the Figure 1: A root area is an area with the world root as its gameplay experience. Such a system would encourage re- parent. When the player enters a new root area all content playability and ensure players never run out of content to inside is expected to have been instantiated into the game experience, while affording players more agency to shape world. the narrative and the world through their actions. Our approach to knitting together multiple kinds of pro- cedural generation involves two types of generators: abstract Our abstract generators receive as input possible player and concrete. The abstract generators construct representa- interactions, facts about the world and terrain, details avail- tions of game content as sentences in first-order logic, and able in the knowledge base, and hyper-parameters such as the concrete generators that instantiates the in-game repre- a series of morphological functions (Propp 2010), pacing or sentations of those logical sentences. story beats (Mateas and Stern 2005), and other thematic vari- The abstract generators include generating the history of ables. the world, cultures and belief systems, character personality The abstract generators work in a gradual process of mak- and backstory. When the player enters a previously unvisited ing information more concrete until the properties of an area area, the engine generates the next area (see Fig. 1), begin- are defined to the degree that the information can be used ning with the generation of the terrain, including the area’s as input to the concrete generators. An example of some of biome, preliminary information about connecting areas, and the properties associated with regions are locative properties any other high-level terrain definition information required. (such as resources, or settlements), the non-player charac- ters in the region (including details of their species, or in- Copyright © 2021 for this paper by its authors. Use permitted teractions available to them), and quest information for the under Creative Commons License Attribution 4.0 International player. The first iteration will employ a partially planning- (CC BY 4.0). based approach to quest generation. Each concrete (content) generator (see Fig. 2) defines a category of objects and thereby also what properties and relations may be specified for an object of that category. For example, a content generator for vegetation may de- fine a plant as a type of content, with properties like ed- ible and poisonous defined as unary predicates (for in- stance, edible(plant)), and defining locations as binary predicates (for example via, at(plant, area)). Similarly, the agent generator controls available interactions in the world, for instance, avoids(agent, agent), dazed(agent), or initiates(agent, agent, F ight|Dialogue). These con- tent generators are registered with the narrative system, en- abling the abstract generators to see them as object cate- gories. Figure 4: An expansion on Fig. 3 with two connected areas. Please note that the image on the right is somewhat mislead- ing as it does not reflect that the two areas are connected via specific bridge parts. References Mateas, M., and Stern, A. 2005. Structuring content in the façade interactive drama architecture. In AIIDE, 93–98. Propp, V. 2010. Morphology of the Folktale, volume 9. University of Texas Press. Figure 2: An example of interface code (in C#) between a concrete generator and the abstract generators. A fact can be added by calling the matching predicate method. Figure 3: An example of how the generator from Fig. 2 might be used to construct a definition of the world, a sim- plified sketch of the result and how it looks once instantiated into the game world. Currently we are in the process of iterating on game me- chanics and improving the content generators in the game. We are actively collaborating with an academic group to de- sign a cohesive system that will be underpinned by Answer Set Programming, Linear Logic, and/or AI planning tech- niques. We are interested in sharing our current approach with the EXAG community and receiving feedback on our initial prototypes.