A Procedural Method for Automatic Generation of Spelunky Levels Walaa Baghdadi1, Fawzya Shams Eddin1, Rawan Al-Omari1, Zeina Alhalawani1, Mohammad Shaker2 and Noor Shaker3 1Information Technology Engineering of Damascus, Damascus, Syria 2Joseph Fourier University, Grenoble, France 3IT University of Copenhagen, Copenhagen, Denmark walaabaghdadi, fawziashamseddin91, rawan.alomari91, zeina.helwani, [email protected], [email protected] Abstract. Spelunky is a game that combines characteristics from 2D platform and rogue-like genres. In this paper, we propose an evolutionary search-based ap- proach for the automatic generation of levels for such games. A genetic algorithm is used to generate new levels according to aesthetic and design requirements. A graph is used as a genetic representation in the evolution process to describe the structure of the levels and the connections between the rooms while an agent- based method is employed to specify the interior design of the rooms. The results show that endless variations of playable content satisfying predefined difficulty requirements can be efficiently generated. The results obtained are investigated through an expressivity analysis framework defined to provide thorough insights of the generator’s capabilities. 1 Introduction Procedural Content Generation (PCG) is receiving increasing attention due to the ad- vantages it provides in terms of speeding up the content generation process, enabling on-line generation, reducing the development budget and facilitating the creation of endless content variations [1]. Furthermore, since most PCG methods are based on ex- tensive search in the content space [2], it is likely that utilising PCG approaches for generating content will yield novel solutions that can be directly used in the game [3, 4] or employed as a form of inspiration for human designers. Different techniques have been explored to automatically generate different aspects of content for different game genres [5, 3, 4, 6] and some of them achieved remarkable results in commercial games [7–10]. Rogue is one of the early games where PCG is successfully employed to generate infinite variations of content as the game is being played. The game inspired many others and the automatic generation of dungeons is well investigated and used in several well-known games such as Diablo and Dungeon Siege. Most of the techniques used so far for dungeon generation however suffer from the lack of controllability as it is usually hard to specify design constraints or require- ments and they mostly tend to produce neat structures [1]. One of the recent well-known commercial game that combines characteristics from the dungeon and platform games is Spelunky. The game successfully employes PCG techniques to generate variations of structures that are unique with every replay. Such as most rough-like and dungeon generation methods, randomness forms the basis of diversity and hand crafted templates are used to control the level structures. In this paper we present a procedural approach that allows the generation of vari- ant content for a Spelunky-like game while permitting control over important content aspects. We analyse the game aspects and we employ the search-based approach of PCG [2] to generate game content. More specifically, a Genetic Algorithm (GA) is used to evolve game content where levels are represented using an indirect representation in the form of graphs that specify the navigation order of the rooms and the connections between them. A separated agent-based approach is then implemented to define the in- ner structure of each room. Rooms are then filled with different items according to a distribution scheme. We define a difficulty measure that scores levels according to their final structure and the presence of certain items and their placement. We show that infi- nite playable levels of varying difficulties can be generated and we present a thorough analysis of the results obtained. 2 Spelunky Spelunky is an action adventure indie game that combines the characteristics of two genres: rogue-like and 2D platform games. The game was created by Derek Yu in 2008 as an open source game for PCs. An updated version of the game was released for Xbox Live Arcade which attracted millions of players. The main game mechanic in Spelunky, similar to platformers, is jumping to collect items and to kill enemies. Much the same as in dungeon crawl games, the game is struc- tured in rooms filled with collectable items and monsters. A common feature between Spelunky and most rough-like games is the presence of randomness which is the key element in generating the structure of the levels and placing enemies and decoration items (more details about the method used can be found in [1, 11]). The player controls Spelunker, the main character of the game. To win the game, the player should possess good playing skills as well as being able to efficiently manage different types of resources such as ropes, bumps and money. Spelunky exhibits a number of properties that motivates exploration of the applica- bility of PCG and AI methods. It is a 2D game that combines properties from platform games in terms of gameplay with the graphical representation and layout of rogue-like games. Automatic generation of content for such a game is therefore an interesting problem as one should consider the characteristics of both genres. The game is also receiving an increasing interest in research as a benchmark for computational and arti- ficial intelligence algorithms was recently proposed around this game [11]. 3 Modifications to The Original Game We used the source code available for the first published version of the game as a base for our implementation. We made several modifications to the original code to allow complete automatic level generation with desired difficulty. Our modifications include adding an extra goal to the game, namely, Spelunker should save the princess; this (a) (b) (c) (d) Fig. 1. (a) An example of an evolved graphical representation of a level and (c) the actual corre- sponding level map. The key rooms are presented in blue in (b) and the path is presented as direct links between the rooms. A gray room can contain anything. The different colours in the resultant level stands for different types of items as presented in the legend. requires finding and carrying her along while navigating safely to the exit. We also chose to lock the princess in a closed room to make the game more interesting since this necessitate searching for bombs to break the walls and enter the room. The bombs are placed in hidden places in one of the 16 rooms of the level. In short, we are using the same art assets used in the original game but the game- play in our version, called InfiSpel, consists of starting the journey in the entrance room, navigating through the level searching for the bomb, locating the princess and using the bomb to enter her room, carrying the princess and heading to the exit while overcom- ing challenges such as monsters and traps. These new requirements entailed heavily modifying the original source code. 4 Evolving content in InfiSpel In our level generation approach, a Genetic Algorithm (GA) method is employed to evolve content. When using GA, there are two main factors that are essential to the quality and performance: content representation and content quality. 4.1 Level Representation The phenotype (level structure) is represented as an integer vector where each level consists of 16 rooms organised in a 4 × 4 matrix (such as in the original game). This representation is used to visualise the generated levels and to measure their quality. Since we are interested in the placement of items and the presence of paths between the rooms and from the entrance to the exit, the genotype is represented indirectly where the complete level is represented as a graph in which each room is a node. The links between nodes are translated into direct connections between rooms while a missing link indicates a wall. This means that starting in the entrance room and following the links should lead to the exit in a playable level. More specifically, the genotype is a vector of codons carrying the following information: five integers identifying the start room, the bomb room, the princess room, and the exit room, the length of the path from the entrance to the exit (measured as the number of rooms passed). These are followed by fields for storing the total number of monsters, the total number of collectable items and a list of connections. The total number of connections between the rooms is 28 (notice that we don’t allow loops) and therefore the list of connections consists of 28 binary slots. Fig. 1 presents an example level with its graph representation. 4.2 The Interior Design of Rooms To construct the layout of each room, a digger algorithm is used and applied on each room separately. This method has been previously used to construct maps for First- Person Shooter games and showed fast performance and interesting results [12, 13]. The method is used in a similar way in this paper. Initially, each room is filled with bricks (walls) with all cells having the value 1. The digger moves in the room switching the value of some of the cells from 1 to 0 hence generating walkable areas. To dig one room, the digger performs the following steps: 1. The digger agent is placed in the center of a room. 2. The agent randomly choses one of the following directions for his next move: right, left, up and down. The agent moves in the direction chosen and change the value of the destination cell from 1 to 0. 3. The above process is repeated until a maximum number of moves is reached (35 moves is used in our implementation).
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages12 Page
-
File Size-