Enhancing Gaming Engagement through the Integration of Game Design Document and Finite State Machine: A Study on Optimizing Non-playable Character Responsiveness

Abstract


A. Introduction
In game development, there is a term called Non-Playable Character (NPC). NPCs are characters that players cannot control. NPCs contribute significantly to the gaming experience. Objects called NPCs allow players to engage in dialogue, attack if the NPC acts as an enemy, ask for help, and so on [1]. NPC was first coined and introduced 1975 in Dungeons and Dragons [2]. Furthermore, if there are NPCs in a game, it is necessary to apply artificial intelligence so that the NPCs become responsive and adaptive to what the players are doing. The responsiveness of NPC impacts players with an exciting and intense playing experience [3]. A literature study was conducted to obtain relevant references for this study [4]. Previous research has successfully applied the Finite State Machine (FSM) Computational Model for Non-Playable Character Behavior [5]. FSM can also be applied through game design with Unity3D tools [6]. The FSM Computing Model can also be applied to develop NPCs in games with elements of culture and themes in Indonesia [7]. In addition, FSM is also used to design several game genres, such as 2-dimensional horror games [8] and games with the theme of endless runners [9].
Implementation is an expansion of activities that adjust to each other; for that, the implementation of FSM on NPC is needed in game design in this study [10]. FSM implementation is needed so that activities, actions and actions can be planned to increase the responsiveness of the NPC, which is one of the objectives of this study [11]. Increased Responsiveness on NPC correlates with artificial intelligence (AI) [12] [13].
Another study found that games are integral to forming a child's personality [14]. In a book entitled "A Theory of Fun for Game Design," games become an interactive experience that gives players patterns about the gameplay that they have learned to become increasingly challenging and can eventually be mastered [15]. Meanwhile, the Survival Horror genre, which was chosen as the theme in this study, is a genre construction that has existed for a long time because it was formed through the experience of fear in real life [16][17] [18]. The Survival Horror game in this study was designed with Unity tools and the C# programming language, which is equipped with the main character, and supporting characters in the form of the main character's allies and enemy characters. Initially, the NPC in this game could not act intuitively so that the NPC acting as an enemy could not act responsively to chase the player when the player passed a random time interval between 60-70 seconds resulting in the enemy NPC not moving from an idle position, with x-axis worth 0, the y-axis is worth -0.14, and the z-axis is worth 0. NPCs who act as allies of the main character also experience the same problem, which they cannot act intuitively, such as responding according to the main character's movement; the expected response is to have discussions with the main character and ask for help.

B. Research Methodology
Game Design Document (GDD) is one of the methods included in the Software Design Document category. The process in GDD has many steps but focuses on four different attributes of the program, namely data structure, software architecture, interface representation, and details of the algorithms used [19]. Before the game enters the design stage, it is necessary to have a descriptive document for designing [20].
Finite State Machine (FSM), also known as Finite State Automata (FSA), is a computational model that can also be used to simulate logical sequences or represent execution sequences and conditions [21]. One example of implementing a Finite State Machine is an automatic vending machine. The Finite State Machine method is also commonly used as a basis for designing communication protocols, designing game software, web applications, and so on [5]. There are two types of Finite State Machines, and it generally has five tuples {Q, Σ, q, F, δ} with the explanation below: A simple example of a Finite State Machine representation is as follows: The M symbol represents the set of Finite State Machine tuples. Notation Q as a set of all states having two elements {S0, S1}, Σ as a set of events having two elements {0, 1}, initial state/state being {S0}, and set of final states having one element namely {S1 }. Alpha Testing was carried out to test the results of the application of FSM in designing this survival horror game, which is a method used to test a game and look for errors in the games that have been made [22]. At the same time, Beta Testing involves users trying already functionally functioning games. Respondents in this beta testing were selected based on their experience and expertise in playing the game [23]. Qualitative research involving interviews with five experienced horror gamers was conducted to gather information for designing the game. Selection of informants considered their expertise and familiarity with interactive games from previous research reviews [24][25] [26].

C. Results and Discussion
Based on the application of the Game Design Document (GDD) method, it generated games that can be played; the appearance of the game is presented with screenshots and explanations below:

Figure 2. Gameplay screenshot
The implementation of the labyrinth as a dungeon has various stages. The first stage is creating a maze design using a Maze Generator. The maze can be made with various customizations, starting from the shape, width, height, inner width, inner height, and so on. In this case, the maze is created to be 15 in width, 15 in height, and orthogonal in style. After the labyrinth design is generated, implementing it into the game project Invading Darkness in Unity is the next step. The maze design will be embedded in an object called terrain using the stamp feature. This stamp will later stamp the labyrinth design on the intended terrain. After completing this process, the final step that must be done is to place the maze into the terrain, resulting in Figure 4.
The button for activating the Night Vision Goggle (NVG) is integrated with scripts, while for creating NVG effects, an effect called post-processing is used. When the NVG button is tapped, the button emits a sound indicating that the tool is active, the entire screen turns gray, and the viewing radius increases by 29.4. Figure 5 shows the game display before NVG was activated. Figure 6 shows the game display before NVG was activated. With the appearance changing to gray and the visibility getting more precise and farther with the post-processing statistics as follows:     In this game, the NPC Enemy is depicted as a unique model, resembling two small children conjoined at the body but with separate heads. Their lower body portion features a sharp tip, adorned with blood-like stains. The implementation of this enemy involves integrating a three-dimensional model with a red point light, creating an eerie effect where the children's bodies emit a red glow resembling blood ( Figure 9). To govern the behavior of both enemy and allied NPC objects, a Finite State Machine (FSM) computational model is employed during the coding process. Upon successful implementation of the FSM, the enemy NPC exhibits responsive behavior triggered by a random interval of 60-70 seconds. This periodicity adds unpredictability and suspense to the gameplay, enhancing the overall horror experience for players. The testing phase, including alpha testing, represents a critical stage in this research, where the functionality of the game is thoroughly examined. During alpha testing, developers rigorously assess the game's performance, identifying and addressing any bugs, glitches, or balance issues that may impact the players' immersion and enjoyment. By combining the intricate design of the NPC Enemy model with the adaptive nature of the FSM, the game aims to deliver a gripping and engaging experience. Players can expect a hair-raising encounter with the eerie conjoined children, whose unpredictable actions and haunting appearance will heighten the tension and thrill throughout the gameplay.

Navigation Button Digital Analog
Moving the main character in various directions can make the main character walk.

Sprint
It makes the main character run fast. Successfully

Settings Button
Access settings for game configuration. Successfully

Sensitivity Settings
Set the gaming motion sensitivity. Successfully

Scene Main menu
Scene to display the main menu. Successfully Gameplay Scene to start playing.

Successfully Win
The scene that is displayed if you win the game. Successfully

Lose
The scene is displayed if the enemy kills the main character. Successfully

BGM MainMenu BGM
The music that plays while in the MainMenu scene Successfully

Gameplay BGM
The music that plays while in the Gameplay scene Successfully

Enemy BGM
The music plays while the enemy is chasing the main character. Successfully

Logics, AI Finite State Machine
A computational model is applied to enemy NPCs so they can chase and kill the main character in 60-70 second time intervals.

NoteAppearTrigger
The object serves as a trigger to bring up the chronological record of Rosale's kidnapping.

NightVision Button Button to turn Night Vision Toggle on/off. Successfully Flashlight Button
Button to turn Flashlight on/off. Successfully The scenario used in this FSM is to measure time using a stopwatch, placing the main character's object at a random position to find out whether the implementation of the FSM computational model on enemy NPCs can work or not. In Table 2, testing is carried out by placing the position of the main character object on a random axis position to ensure that the enemy NPC can chase the main character in any position without any problems in the form of a silent NPC not responding when it has passed a random time interval of 60-70 second. The initial position of the enemy NPC is idle, with the x-axis having a value of 0, the y-axis having a value of -0.14, and the z-axis having a value of 0.5. The test results can be seen in the column that explains the position of the enemy NPC in a game over state. In the first to the 30th iteration, it was found that the enemy NPC caught up with the main character and attacked him. In the enemy NPC sub-column, the chasing condition is not included in the table because the chasing condition of the enemy is moving to and from toward the main character; it causes the value of the axis position to be not constant and is not included in the testing.
Meanwhile, in the game over state, the enemy NPC's axis position is constant because the main character has been killed, and the enemy NPC stops moving, which includes the game over state in the testing table. Chasing state => game over state, meaning game over state will not occur if the chasing state is unsuccessful. The average result of the NPC arrival time interval in this Alpha testing is 68 seconds, indicating the response follows planning.
After doing Alpha testing, the following testing stage is to do Beta testing, where an application is tested directly by the player. This beta testing was conducted to test the feasibility of NPC interactivity when played by players. The number of respondents in Beta testing is as many as seven people. Each respondent has a background as someone who has played Horror games. Respondents will be asked to play this game and then fill out an online questionnaire to obtain information about the tester's experience regarding the game. The questionnaire contains 15 statements that seven testers must fill in. The following is a list of the 15 statements: The game is scary. 2 The game is easy to play. 3 The buttons on this game work as they should. 4 UI (User Interface) in the game looks attractive. 5 The game's UX (User Experience) is simple and straightforward for the player. 6 Orbs object works fine (disappears when hit by the player). 7 The number of total orbs increases as orbs are collected. 8 The button to turn on Night Vision works fine. 9 The button to turn on the Flashlight works fine. 10 NPCs acting as main character allies work well. (when approaching the NPC, text appears on the screen explaining the state of the NPC) 11 NPCs acting as enemies work fine. (Can penetrate building objects; within a specific time, can chase the main character; the main character dies if touched by the NPC) 12 The background music used in the game gives a scary/intimidating impression. 13 The labyrinth gives a scary and intimidating impression because of its slightly "crowded" or narrow shape. 14 The dark lighting level in Resurrection of Darkness gives a scary impression. 15 You will want to play this game again in the future.
In the questionnaire used in the Beta testing facility, the scoring parameter uses a Likert scale which has five scales in the following format: 1=Strongly disagree, 2=Disagree, 3=Neutral, 4=Agree, 5=Strongly agree. The scale determines the level of agreement with a series of statements regarding the experience of playing this game. The following is a summary of the data obtained from each tester who filled out the questionnaire: Table 4. Questionnaire Recapitulation Age S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 S11 S12 S13 S14 S15 23  4  5  4  4  4  4  4  4  4  4  4  4  4  4  4  18  4  3  2  3  3  4  3  5  5  5  5  5  5  5  4  22  5  3  5  4  5  5  5  5  5  5  5  5  5  5  4  18  5  5  4  4  5  5  5  5  5  5  4  4  5  5  5  23  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  21  4  4  5  4  3  4  4  5  5  5  4  5  5  5  4 The first stage first calculates the total score of each respondent with the T x Pn formula, where T means the total number of respondents selected and Pn is the Likert score number choice. After calculating the score, the next step is to interpret the calculated score to find out the score with the highest and lowest scores. The score with the highest score is represented by the symbol (X), and the score with the lowest score is represented by the symbol (Y); the following is the calculation: X = 5 x 7 = 35 and Y = 1 x 7 = 7 After these calculations, it can be seen that the highest score for X is 35, and Y is 7. Next is the pre-completion stage to find out the interval and interpretation of the percent with the following formula: Based on the percentage results obtained, the average percentage of all statements is 80%, which means very good and worth playing.

D. Conclusion
The game was successfully designed with increased responsiveness in interacting with the main character, either as an enemy or an ally, proven by Alpha testing that all aspects function properly and the Finite State Machine computational model can be applied with the test results that the enemy NPC can chase the main character in any position with an average arrival time interval of enemy NPCs is 68 seconds and allied NPCs can respond if the main character approaches. In beta testing, the average interpretation of the score in the form of a percentage of tester answers to all beta testing questionnaire statements is 80%, which implies that the game is worth playing.

E. Acknowledgement
We extend our heartfelt gratitude to Universitas Multimedia Nusantara for their invaluable support, which played a pivotal role in the successful completion of this research endeavor. Their substantial contribution was instrumental in achieving our objectives, and we are deeply grateful for their unwavering assistance.