Blending Levels from Different Games Using Lstms
Total Page:16
File Type:pdf, Size:1020Kb
Blending Levels from Different Games using LSTMs Anurag Sarkar and Seth Cooper Northeastern University, Boston, Massachusetts, USA [email protected], [email protected] Abstract well as blending existing levels (Guzdial and Riedl 2016b). Moreover, Gow and Corneli (2015) proposed a theoretical Recent work has shown machine learning approaches to be effective in training models on existing game data for in- framework for generating new games by blending not just forming procedural generation of novel content. Specifically, levels but entire games, showing that it is possible to blend ML techniques have successfully used existing game levels two games to create a third whose aesthetics and mechanics to train models for generating new levels and blending exist- are combinations of those of the original two games. ing ones. Such blending of not just levels, but entire games, In this work, we take a step towards implementing this has also been proposed as a possible means of generating framework by leveraging PCGML and concept blending. new games. In this paper, we build on these works by train- Specifically, we train Long Short Term Memory recurrent ing Long Short Term Memory recurrent neural networks on neural networks (LSTMs) on existing levels of the plat- level data for two separate platformer games—Super Mario formers Super Mario Bros. and Kid Icarus. We then sample Bros. and Kid Icarus—and use these models to create new from the trained models to generate new levels that encode levels that are blends of levels from both games, thus creating a level generator for a novel, third game. structural characteristics and properties of levels from both games. We thus create a level generator that can produce lev- els for a third game whose levels contain properties of levels Introduction from the two games used for training. We also implement a Procedural content generation (PCG) is the automatic cre- parametrized version of the generator that allows a designer ation of game content via procedural or algorithmic methods to control the approximate amount of each original game de- (Shaker, Togelius, and Nelson 2016). Since its use in games sired in the final blended levels. like Elite (Braben and Bell 1984) and Rogue (A.I. Design 1980), PCG has been widely adopted for generating levels, Related Work maps, weapons, rules, terrain, etc., and has been an active PCG via Machine Learning (PCGML). PCGML has field of games research. Traditional PCG methods include emerged as a promising research area as evidenced by many search-based optimization (Togelius et al. 2011), constraint successful applications of ML for content generation. Neural satisfaction (Smith and Mateas 2011) and grammar-based networks in particular have seen wide use for level and map methods (Smith, Whitehead, and Mateas 2011), to name a generation. Hoover, Togelius, and Yannakakis (2015) gener- few. However, these often rely on designer-authored rules, ated Super Mario Bros. levels by combining a music com- parameters and constraints to guide the generation process position technique (functional scaffolding) with a method and ensure that the generated content has desired proper- for evolving ANNs (NeuroEvolution of Augmenting Topolo- ties and characteristics. Aside from being time consuming, gies (Stanley and Miikkulainen 2002)). Autoencoders have such methods may unintentionally capture designer biases. also found related applications, with Jain et al. (2016) train- PCG via Machine Learning (PCGML) has thus emerged as ing one on existing levels to generate new levels and repair an alternative to the traditional methods to help overcome generated levels that were unplayable. N-gram models have their limitations. Summerville et al. (2017) define PCGML also been used by Dahlskog, Togelius, and Nelson (2014) as “the generation of game content using models that have for generating Super Mario Bros. levels. Guzdial and Riedl been trained on existing game content.” By training on game (2016a) used probabilistic graphical models and clustering data that one wishes to emulate or create novel variations to create levels for Super Mario Bros. by training on game- of, one can capture the desired properties within the trained play videos. Besides platformers, Summerville et al. (2015) model and sample from it to generate new content. used Bayes Nets for creating The Legend of Zelda levels. Recent work has shown that models trained on exist- They also used Principal Component Analysis to interpolate ing Super Mario Bros. levels can generate new levels via between existing Zelda dungeons to create new ones (Sum- both sequence prediction (Summerville and Mateas 2016) as merville and Mateas 2015). Copyright c 2018, Association for the Advancement of Artificial Markov models have also found use in generating con- Intelligence (www.aaai.org). All rights reserved. tent. Snodgrass and Ontan˜on´ have done extensive work in ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( generating levels for Super Mario Bros., Kid Icarus and - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Lode Runner (Broderbund 1983) using multi-dimensional - - - - - - - - - - - - - - - - - Markov chains (Snodgrass and Ontan˜on´ 2014), with hi- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - erarchical (Snodgrass and Ontan˜on´ 2015) and constrained - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Snodgrass and Ontan˜on´ 2016) extensions as well as using - - - - - - - Q - - - - - - - - - - - - - - - - - - - - - - - - - - Markov random fields. In particular, our work in blending - - - - - - - - - - - - - - - - - levels is most similar to their work on domain transfer using - - - - - - - - - - - - - - - - - - Q - - - S ? S Q S - - - - - - - Markov chains for mapping levels from one game to another - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - < > - - (Snodgrass and Ontan˜on´ 2017). - - - - - - E - - - - - - [ ] - - Finally, Long Short Term Memory recurrent neural net- X X X X X X X X X X X X X X X X X works (LSTMs) have been particularly effective in gener- ating game levels. Summerville and Mateas (2016) used Figure 1: Super Mario Bros. Level 1-1 and its text represen- LSTMs to generate Mario levels by treating each level as a tation. character string and using these strings to train the network. # - - - - - T T T T - T T T T T ( The trained network could then use an initial string as a start- # - - - - - - - - - - - - - - - ( ing seed to generate new characters, thereby producing new # - - - - - - - - - - - - - - - ( # - - - - - - - - - - D # - - - ( levels. Though most level generation using LSTMs focuses # - - - - - - - - - - D # - - # ( # - - - - - # # # # # # # # - # ( primarily on Super Mario Bros., the method can be used to # - - - - - # # - - - - - - - # ( create generators for any game whose levels are represented # - - # # # # # - - - - - - - # ( # - - # - - - - - - # # # # # # ( as sequences of text. The success of such techniques for level # - - # - - - - - - - - - - # # ( # T - # - - - - - - - - - - # # ( generation informed our use of LSTMs in this work. # - - # - # # # # - - - - - # # ( # - - # - - - - - - - - - - # # ( Mixed-Initiative PCG. This refers to content generation by # - T # - - - - - - - - - - # # ( # - - # - - - - - # # # # - # # ( harnessing the capabilities of a procedural generator and a # - - # - - - - - - - - - - # # ( human designer working in concert. Such generators, like # T - # - - - - - - - - - - # # ( Tanagra (Smith, Whitehead, and Mateas 2011), combine the generator’s ability to rapidly produce multiple levels with Figure 2: Kid Icarus Level 1 and its text representation. the human ability to evaluate them using superior creativity and judgment. Authorial control in procedural generators al- lows designers to guide generation towards desired content. levels of a game, but to games in their entirety. They pre- Thus, we implemented a parametrized variant of the blended sented a framework for generating a novel game by using the level generator which lets the designer control the percent- four space blending process of selecting two input games to age of either game in the final blend. Yannakakis, Liapis, and blend, creating a generic game concept and then producing Alexopoulos (2014) offer an extensive analysis of mixed- a new blended game by combining the generalized elements initiative design tools and their effects on creativity. of the input games. They used the Video Game Description Concept Blending. Concept blending states that novel con- Language (VGDL) (Schaul 2014) to generate a novel game cepts can be produced by combining elements of existing by combining VGDL specifications of The Legend of Zelda concepts. The “four space” concept blending theory was (Nintendo 1986b) and Frogger (Konami 1981). proposed by Fauconnier and Turner (1998; 2008) and de- scribes a conceptual blend as consisting of four spaces: Dataset • input spaces Two constituting the concepts prior to being The Video Game Level Corpus. The data for this work is combined taken from the Video Game Level Corpus (VGLC)1. The • generic space A into which the input concepts are pro- VGLC (Summerville et al. 2016) is a corpus of levels from jected and equivalence points are identified a number of games, represented in parseable formats such • blend space A into which the equivalent points from the as Tile, Graph and Vector. It is small compared to tradi- generic space are projected and new concepts are evolved tional ML datasets and the general dearth of