Generation of space shooter level using genetic approach

In this article, we used genetic algorithm and geometric-based approach to generating level for 2D space shooter game. We used the defined fitness value from game designer to limit the fitness value of the genetic algorithm process. And the geometric-based is used to generate base level from the best chromosome in genetic algorithm. The geometric generator will take a random object for each corresponding game element from the chromosome. This approach minize the time to generating the object, we directly used object geometry for the data in chromosome so it can minimize process and memory cost. This approached minimizing the content that must be created manually. From the result, to generation level with controlled difficulty, we must change the chromosome length too, so the fitness value can fit the target fitness and not show any linear difficulty. Our result showed this method capable of generating different level and controlled difficulty


I. Introduction
Game world is an important aspect int Game. Game world is artificial world, an imaginary place where the game event occur [1]. Mostly, game world is designed by game or level designer. This is not a big problem for small scale games. However, if the game scale is growing bigger it will take more time and resources. Game development required quite a lot cost and time [2]. While, it requires a few time to play it. This is one of the trap when developing new game, the lack of ability to interest the player to play the game again and make the game can not last longer [3]. Procedural content generation aims to generate content automatically and reduce the cost of design and game development [4][5] [6]. Procedural conteng generation (PCG) is game content that created by algorithm with limited or indirect input from user. In other words, PCG refers to software that able to create content alone or together with one or more human players or designers [7]. By using PCG, the game contet will be richer. Such as, every time player play new game, the game world will be different. This will provide the player with challenge and appeal. The presented method is aimed to implementing PCG using genetic algorithm and grammar-based approach on top down shooter game. Using the chromosome data from genetic algorithm dan creating level base with grammar approach, resulting in a level with set able difficulty and different level.

II. Method
The aproach for generating level described in Fig. 1. It start with a small random chromosome for initialize genetic algorithm. The genetic algorithm will process the chromosome and return the best chromosome. The level generator will take the best chromosome to perform base level generator. to form base level, chromosome or game element generated and evaluated using genetic algorithm. Base level created using the data from the Genetic Algorithm. After generating the base level, the level will decotate with some collectable object. In this article, we choose health. In this game, health is a perfect exaple of colletable object. The parameter of genetic algorithm and level generator is set by human designer. Paramaters include population size, chromosome size, elithsm, game element, range each element, rest area, target fitness. Rest platform is an empty space before game element appear.

A B S T R A C T
In this article, we used genetic algorithm and geometric-based approach to generating level for 2D space shooter game. We used the defined fitness value from game designer to limit the fitness value of the genetic algorithm process. And the geometric-based is used to generate base level from the best chromosome in genetic algorithm. The geometric generator will take a random object for each corresponding game element from the chromosome. This approach minize the time to generating the object, we directly used object geometry for the data in chromosome so it can minimize process and memory cost. This approached minimizing the content that must be created manually. From the result, to generation level with controlled difficulty, we must change the chromosome length too, so the fitness value can fit the target fitness and not show any linear difficulty. Our result showed this method capable of generating different level and controlled difficulty.

A. Generation of Chromosome
The chromosome is just an array data structure that holds the data of geometry for generating the game world. It shows which geometry will be used in the game world. To form the chromosome, first we need mapping from language to numbers. Table 1 shows this mapping for each game element.

B. Genetic Algorithm
Genetic algorithm has been choosen to create the chromosome. Using this method, there is no need to filter the generated chromosome, because this algorithm will produce polished chromosome, not juts some random ones (Fig. 2). Choosing the right fitness function is crucial in genetic algorithm to work properly. There is need function that tell us which one is good and not. So, the target fitness can be defined by curve or direct value from designer. The target fitness value will be the threshold for the fitness calculation. If the fitness value if fullfil the target fitness, the algorithm will stop. To calculate fitness value, we give hardness value between transition of elements ( According to the Table 2 hardness value with the highest value is when player need to perfom more than one action, in example avoiding bullet or enemy and shooting the enemy ship. We calculate the sum of hardness value for the fitness value.
After creating the chromosome, to generate playable level based on the chromosome. The cromosome is passed into level generator. For given element, many objects can be impelemented, but here we just use one object foreach game element. Random game object will be choose to generate a new level and the position of the object will be adjust automatically based on element index in chromosome. The collectible Item will be placed in random place based in range between first game element and last game element. Shows in Table 3. Unity3D and C# is used to impelement the proposed method. There only 3 element in this implementation, we can add more element to the game by adding more element and corresponding geometries. We want to start game from the easy one so we used the chromosome with the lowest fitness value. Fig.3 shows an example of level that generated by the proposed method.  We limit the population to 10 and stop the algorithm if there is no change in fitness value for 10 generation. From the result, there is still high error from target fitness an actual fitness, shows in Table  4. However, the generated level and difficulty still can be controlled by changing the parameter value. For the next result we increase the population size by to for each target fitness and it shows in Table  5. The comparison between default parameter and modified parameter shown in Fig. 4, show if the change in chromosome length is affecting the actual fitness.

Figure 4. Comparison between default parameter and modified parameter
From the comparison, the modified parameter perform better result in generatin new level, the value is not decrese excessive. So the level can give a rest level to the player after playing some level if the hardness value is less than the previous value.

IV. Conclusion
In this article, we proposed a method to produced a generated level with difficulty value by human game designer. A prototype has been developed. Genetic algorithm has been used to created the chromosome of element with fitness function which is the sum of hardness value. Level Generator generate the correspoding object randomly based on the grammar. In the future work, we decide to normalize the fitness value, add new element, and change the placement of the object generate by level generator.