Adaptive Difficulty in Earthquake Mitigation Game Using Fuzzy Mamdani

. Earthquake disasters cause a lot of casualties. Therefore, needs to be education on earthquake disaster mitigation to minimize losses. In addition to counseling and teaching in schools, mitigation education can also be through games. Some education games for earthquake disaster mitigation have circulated quite a lot but have disadvantages, namely the difficulty level that hasn't been adaptive. A game requires an adaptive level of difficulty that can adjust between the ability and playing experience of the player with the level of difficulty so that players do not feel bored or frustrated. Purpose: This study aims to provide earthquake disaster mitigation education and discuss making the level of difficulty in the game adaptive to suit the abilities and experience of the player. Method: From the research carried out by applying the Mamdani Fuzzy Logic, the game's difficulty level for each player becomes more adaptive or different for each player according to the ability and experience of each player in the previous stage measured from 6 input parameters. Result: The level of difficulty that is obtained becomes adaptive. It changes according to conditions or is adjusted based on the player's ability. It is from the playtesting experiment conducted on 20 players. The minimum difficulty level's score is five, and the difficulty level's score is 28.36. Novelty: This paper's purpose is an educational game for earthquake mitigation with the feature of adaptive level based on fuzzy Mamdani.


INTRODUCTION
Earthquake is a natural disaster that occurs in many countries. Earthquakes are caused by shifts in the earth's plates and other biological factors where the incident causes casualties and material losses [1]. Indonesia is the one country that is prone to earthquakes. Indonesia is in the confluence of three of the world's tectonic plates that cause the thousand island countries to have high earthquake susceptibility levels and part of the Pacific belt (Ring of fire) [2]. One of the cases was the earthquake in Donggala, Central Sulawesi. The earthquake occurred on Sept. 28, 2018, at 17.02, with a scale of 7.4SR, which claimed as many as 744 people died [1], [3]. Apart from Indonesia, the region in China also experienced an earthquake on Aug. 8,2017, in the city of Jiuzhaigou. It claimed that 25 people died, and 525 were injured [4]. After the Pacific Belt, the second most active seismic region is the Alpine-Himalayan orogenic belt. The area is located in Iran and along the Himalayan mountains. This region also includes China, India, and Nepal, which often experience earthquakes [5].
Education about disaster mitigation for the community is critical. It can minimize victims and material losses because it has many victims and a high earthquake vulnerability. Therefore, earthquake mitigation education has been carried out through outreach to the community or government [6] or teaching about earthquakes in schools [7]. In addition to outreach and education, earthquake mitigation education can be carried out through a game [8]- [12]. Therefore, video games are an excellent and exciting education medium, especially for children [13]- [15].
Narrative video games are used to provide earthquake disaster mitigation knowledge to children [8]. The game also uses a User Experience evaluation with a User Experience Questionnaire. Another earthquake disaster mitigation game is physical (Snake and Ladder), specifically for children with special needs [9], [10]. The Snake and Ladder game is also applied to normal children by observing their response to natural disasters, especially earthquakes [10]. Serious web-based games are used to prepare children for earthquakes [11]. This Serious game also has a quiz feature to evaluate player knowledge. In addition, games based on Virtual Reality (VR) are used to train earthquake preparedness [12]. This game is intended not only for children but also for adults. From some of the research and games mentioned earlier, there is a drawback: the level of difficulties in games that have not been adaptive.
Game difficulty levels that are still static or not yet adaptive allow players to choose their level of difficulty, which makes it less flexible with abilities and player experience [16] so that, in the end, it can lead to boredom or frustration. It can be illustrated by the theory of flow in games that if the level of the game difficulty is too high compared to the player's ability to enter the frustration zone and vice versa [17], One technology to create an adaptive or dynamic game is fuzzy logic. Several studies related to fuzzy logic for adaptive games have been done before by Pratama et al., which is research to organize the behavior of the bots obtained based on the player's ability [18]. Futhermore, Fuzzy logic is frequently utilized to provide dynamic behavior in-game aspects, such as difficulty setting [16], player involvement assessment [19], and Non-Playable Character (NPC) behavior in player interactions [20]. In addition, fuzzy logic is frequently utilized because it is simple to implement, does not complicate in-game processing, and can result in dynamic, intelligent agent behavior [21].
To make the game exciting and not dull and the players are still in the flow zone, there needs to be an adaptive level of difficulty that can adjust to the player's ability and experience. However, our study not only focuses on the game for earthquake mitigation but also considers the game's flow. So, our study has several contributions: 1. We create an educational game for earthquake mitigation for all ages deployed on the Android Platform. 2. We design adaptive difficulty inside our game using fuzzy Mamdani to make dynamic interactions based on user experience in every game level applied to the table's movement and the obstacle falling speed.

Game Design
This game generally tells of a child trapped in a room when an earthquake occurs. The child must be able to survive by being under the table. Meanwhile, the table used for shelter moved erratically because of the earthquake shaking. Therefore, falling obstacles must not hit him. Within a certain period, there will be a door that can be used to exit, and the player will win. However, you will lose if time or health points run out. Besides, there are also some items to increase health points. There is also a victim character that will appear randomly that the child can help. This game is named "Quake Run." All ages can play this game on the Android platform. The controls in this game are illustrated in Figure 1. Players can control the child character by swiping right and left. Besides that, players can also tap on certain items to get the effects of these items. The difficulties level on this game is environment adaptation. There is table movement during the earthquake and the obstacle falling speed. Therefore, it is challenging for a player because if the table's movements or obstacle falling speed is fast, the player has difficulty controlling the game. In our case, we use Fuzzy logic to make those adaptations.

Input and Output Definition
In this study, the research method used is Fuzzy Mamdani logic with multilevel Fuzzy, divided into three stages, where the research was conducted with the fuzzification step first. In fuzzification, it needs to determine the input and output parameters and the membership function of each parameter (Fuzzification).
The input parameters used are as follows: 1. "HPP," the parameter of the remaining health points owned by the player, has three fuzzy sets: {Weak, Medium, Strong}. Equations 1, 2, and 3 show the membership function for each fuzzy set.
The "Level" is the output parameter that will determine the game's table movement speed and obstacle motion. It has five fuzzy sets: {Very Easy, Easy, Medium, Hard, Very Hard}. The graph of the Membership function is depicted in Figure 2.

Rules Definition
Because it uses multilevel fuzzy, the rules are made according to the stage, such as Stage 1 is for Safety, Stage 2 is for Reflex, and Stage Level. Therefore, those three stages have fuzzy rules, as shown in Tables 1, 2, and 3.

RESULT AND DISCUSSION Game Result
This game has a background of conditions at the time of the earthquake. A player will be in the room where later he will be under the table for shelter during an earthquake. The table will move randomly, and players must stay under it as much as possible so that obstacles don't hit it, which can reduce the player's health points. Players can move characters by clicking and sliding to the right or left. Then obstacles will fall due to earthquake vibrations, and players must avoid them by staying under the table. Also, a quest collects mitigation items that fall until the game quest is complete so that the door exits to the next stage appears. In addition, there are also useful items that can help players stay in the game. Figure 3 depicts the in-game interface result.

Fuzzy Mamdani Scenario Test
The research conducted produces a game with the theme of mitigating earthquakes whose level of difficulty is set using Fuzzy Mamdani logic to match with player abilities. The following is an example of manual calculation fuzzy testing using sample input remaining player stats "HPP" of 35, "STimer" of 15, "nItemHP" is 6, "nItemTimer" is 7, "JObs" is 8, and "nSelamat" is 5. In this study, we will use multilevel fuzzy so that the first will calculate game stage 1, proceed to game stage 2, and then calculate stage levels. The calculation is as follows:

Stage 1
The first stage is calculating Mamdani fuzzy logic to find the value Safety using HPP, STimer parameters. The steps are: A. Fuzzification The first step is to calculate the membership degree of each input based on the membership function that has been created. In this case, the memberships degrees of HPP weak is µ( (35)) = 0.6 and medium µ( (35)) = 0.4. Thus, the memberships degrees of STimer moderate is µ( (15)) = 0.5, and STimer high is µ( ℎ (15)) = 0.5.

B. Inference
The inference process uses Min-Max operations with the table rules that have been made. There are two processes: the implication process using the MIN operator and the composition process using the MAX operator. There are several rules whose results of inference are 0, so there is no need to calculate them. The fulfillable regulations are 2, 3, 5, and 6 rules id. The detailed inference is described below:

Stage 2
The second stage is calculating Mamdani fuzzy logic to find the value Reflex using nItemHP, nItemTimer, and JObs parameters. The steps are: A. Fuzzification The first step is to calculate the membership degree of each input based on the membership function that has been created. In this case, the memberships degrees of nItemHP low is µ(nItemHP (6)) = 0.8 and moderate µ(nItemHP (6)) = 0.2. The memberships degrees of nItemTimer slight is µ(nItemTimer ℎ (7)) = 0.6, and nItemTimer fair is µ( (7)) = 0.4. The memberships degrees of jObs low is µ(JObs (8)) = 0.4, and jObs moderate is µ(JObs (8)) = 0.6.

B. Inference
There are two processes: the implication process using the MIN operator and the composition process using the MAX operator. There are several rules whose results of inference are 0, so there is no need to calculate them. The fulfillable regulations are 1, 2, 4, 5, 10, 11, 13, and 14 rules. The detailed inference is described below:

Stage Level
The last stage is calculating Mamdani fuzzy logic to find the value of stage level using Safety, Reflex, and nSelamat parameters. The steps are: A. Fuzzification The first step is to calculate the membership degree of each input based on the membership function that has been created. In this case, the memberships degrees of Safety low is Based on the case example above with the condition that the player's remaining health points (HPP) are 35, the remaining timer (STimer) is 15, and the number of health point boosting items (nItemHP) taken is 6. The number of times increasing items (nItemTimer) taken is 7, and the obstacle that hits there are eight players (JObs). The number of victims saved (nSelamat) is 5. It results in a difficulty level of 18.14 which will later become table speed and obstacles.

Playtesting Experiment
Subsequent tests were carried out by conducting experiments on 20 players aged 8 to 43 years old. After the players have finished playing the game, each player will be evaluated by noting the parameters used for the fuzzy logic system and the difficulty level they get. The results of the 20 players are shown in Table 4 for only the last best speed. From the results of the tests carried out 20 times with the data shown in Table 4, it can be concluded that each player's difficulty level is almost different for each stage. Therefore, the difficulty level obtained becomes adaptive. It changes according to conditions or is adjusted based on the player's abilities, which can be seen from the value of each parameter of the fuzzy logic system obtained when players play games. Also, it is according to the rule table that has been made. In the test data table, the minimum difficulty level is five and the maximum difficulty level is 28.36 (indicated as speed).

CONCLUSION
A game to provide knowledge on earthquake mitigation has been successfully made under the name Quake Run. This game is an endless game equipped with an adaptive difficulty level feature. Using the Mamdani fuzzy logic system, the adaptive difficulty level was successfully applied to the table's movement and the obstacle falling speed. It is measured from the input parameters in the game. The result can be seen in the playtesting conducted by 20 players, where each stage has a different speed. In the playtesting, the minimum difficulty level obtained is five, and the maximum adaptive difficulty level obtained is 28.36.