# Procedural Video Game Scene Generation by Genetic and Neutrosophic WASP Algorithms
## 3 Scene Layout Modeling and Optimization Algorithm
### Game Scene Procedural Generation Criteria List  
After discretization, we choose a set of criteria that define our game layout requirements. We proposed to use 4 fitness criteria functions and 3 constraint functions, which use function results to calculate the total fitness value with the WASPAS-SVNS algorithm for each iteration of the genetic algorithm. Aesthetics are defined by the symmetry and empty-space balance criteria. Usefulness is defined by the safe zone and player exit distance criteria. Criteria were selected based on recurrence in the literature [26, 27, 28, 29, 30], game design principles, and creativity definitions [2, 4, 5]. If one of the constraint functions does not pass, the total fitness is multiplied by zero.  
The results of the criteria are normalized to fit in the 0 to 1 range to have a reference point for different criteria metrics [17]. Zero represents the worst possible value, and 1 represents the best possible value. The final values for each criterion are also multiplied by 0.9 so they will not get too close to 1, as it may skew the results in the evaluation steps using neutrosophic sets. Scalar values are converted to single-valued neutrosophic sets during evaluation. The fitness functions are as follows:  
* Symmetry calculation for aesthetic purposes. The chromosome grid is crossed with a horizontal and vertical slice to form 4 smaller 5 \(\times\) 5 grids. Each object is checked to determine if it has an identical vertically and horizontally symmetrically matching object (Figures 2 and 3) in the 5 \(\times\) 5 grid. The final results are calculated by dividing the symmetrical matches by the maximal possible matches (each object has two matching objects with touching 5 \(\times\) 5 grids) (1). \(x\) and \(y\) represent the size of the grid, \(s\) is a binary value, the value of which is 0 if the object does not have a matching pair. Each object is measured twice for each axis.  
Figure 1: Single-chromosome data example.  
\[m=\frac{\sum_{i=0}^{2 xy}s}{2 xy} \tag{1}\]  
Figure 3: Symmetry calculation for single grid axis.  
Figure 2: Symmetry calculation.  
Balance criteria for aesthetic purposes. Calculate how close to 50% is the ratio between empty game object count and total object count (Figure 4).  
Mathematically, it can be expressed in these steps (2), where \(e\) is the total empty space ratio normalized from 0 to 1, \(t\) is the sum of the empty objects (they are reversed if they exceed 50% of the grid), \(x\) and \(y\) represent the grid size, and \(s\) is a binary value, which value is 1 if the object is empty. \(t\) can be calculated by counting all empty space objects (3) and then reversing the value if it exceeds 50%.  
\[e=\frac{t}{\frac{t}{\frac{t}{2}xy}} \tag{2}\]  
\[\left\{\begin{array}{c}t=\sum\limits_{i=0}^{n}s\\ t=\frac{1}{2}xy-t_{1}-\frac{1}{2}xy\end{array}\right. \tag{3}\]  
Distance between player and exit game objects. \(x\) and \(y\) represent the coordinates of the player and exit (4). This rule makes sure that the player can see as much of the generated scene as possible while traveling to the exit point;  
\[d=\sqrt{(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)} \tag{4}\]  
Figure 4: Empty-space balance.  
The safe zone criteria calculate the amount of Hazzard-type objects in a defined square around the Player and divide the result by the total area of this square (5).  
\[z=\frac{x_{1}y_{1}}{x_{2}y_{2}} \tag{5}\]  
Criteria are calculated for each member of the population (Figure 5) and can be modified on demand. The criteria calculations are the building blocks of the fitness function.  
Constraint functions are:  
* Scan the chromosome grid and check if Player object exists;
* Scan chromosome grid and check if an exit object exists;
* Pathfinding algorithm to check if there is a passable way between Player and Exit.