Application of the Finite State Machine Method to Determine the End of the Story Based on User Choice in Multiple Role Playing Games

— The development of games in Indonesia is fast enough to make games as part of life that is difficult to separate from the life of modern society as a means of delivering information that is more interactive, or also as an alternative means of entertainment for young people to adults. Interest in the game penetrated all circles of society. Even now there are e-sports where games are one of the most popular and promising brain sports contingents for users. Dynamic or non-monotonous game genres that can determine the end of the story according to the user's choice are interesting things to discuss. Therefore, the researcher raises the issue of how to determine the ending of a game using the finite state machine method which is applied to role playing games. The results of this study are that there are 3 chapters in which there are 27 combinations of variables from the 3 choices of items provided. The final result of this research is an interactive game application program.


I. INTRODUCTION
The development of technology is an undeniable phenomenon, almost in every aspect of human life using technology, including game technology which is experiencing rapid development with the emergence of various types of games from various genres, both action to platform. One of the game genres that applies the turning point of the story is the Role Playing Game, where the genre applies how the development of events or events that focus on the story. RPG is a strategy-based game, it contains the value of acting and storytelling that can make players feel like a character in a story, and also make players know the characters in the story [1] RPG games take place in a realistic world arrangement and a certain shape, or in the world of imagination by being represented by characters who can make us think and solve various tasks along the way of the game [2]- [6] Finite State Machine is a machine that defines several events to generate new conditions. Each state that changes will determine the behavior of the object in question. The problem raised is how to apply the Finite State Machine in determining the ending of the story based on the user's choice in the Multiple Role Playing Game.

Doppler Interactive GDLC
Game development process consists of three key activities: (1) Design and prototype: the process of creating initial game design, game concept, and put it into a form of playable prototype, (2) Production: the process of making the source code, creating the assets, and integrating them as one, (3) Testing: the process of playingtesting, whether it is conducted by internal team members or third party testers [7].

Finite State Machine
Finite State Machine (FSM) is an abstract machine that functions to define a set of conditions that determine when a state must change. Each state that is being executed determines the behavior that occurs in the object in question. The FSM state diagram is depicted in Figure 1 as follows [8]. The application of the Finite State Machine (FSM) method in a game will produce a dynamic response that will help players understand the storyline [9]. Finite State Machine is a method to regulate the behavior of a system by using the working principle of the state (State), events (Event) and action (Action) [10]. The way it works, one of the states will be active, namely the first state or state 0. The system can move to another state if it gets certain input or events, either from external devices or components in the system itself. Each state will produce different actions according to the desired system. The action taken can in the form of simple actions or involving relative process chain.

Games
Game comes from the English word which means game. The game is something that is used to play which is played with certain rules [11]. Game is a game that uses electronic media, is an entertainment in the form of multimedia that is made as attractive as possible so that players get something so that they get inner satisfaction [12]. Another opinion states that the game is a form of art in which participants, called players, make decisions to manage their resources through objects in the game in order to achieve goals [13]. Types of games can be divided into several categories or better known as game genres. Genre also means the format or style of a game. The format of a game can be purely a genre or it can be a hybrid of several other genres [14].
Based on the representation, games can be divided into 2 types, namely 2-dimensional (2D) and 3-dimensional (3D) games [10]. 2D games are games that mathematically only involve 2 elements of Cartesian coordinates, namely x and y, so the concept of the camera in 2D games only determines the image in the game that can be seen by the player. Meanwhile, 3D games are games that, apart from involving x and y elements, also involve z elements in the calculations so that the concept of a camera in a 3D game really resembles the concept of a camera in real life.

System Description
This multiple game is an imaginative adventure game where the user enters a parallel world where each parallel world is described as a chapter. In each chapter provided options. Each of the available options is neither true nor false. Each choice determined by the user will get different rewards depending on the combination of choices throughout the game.

Storyline
Game master is looking for a volunteer to follow the game he made, where the game has 3 stages that must be completed sequentially. The first stage is choosing a class to get the item plate. The second stage is selecting chests to get items. The last stage is answering questions, then the player gets equipment based on the question points that have been answered.
The following is a detail of the game components which are divided into 3 chapters and 1 FSM check.

Dunhill forest
In this chapter the game master asks the user to choose one type of open class, there are 3 class choices, namely:  Socerer class which, if selected, the user will get a Socerer plate item  Swordman class which, if selected, the user will get a Swordman plate item  Hunter class which if selected by the user will get a Hunter plate

Dusk Farm
In this chapter the user is asked to choose one of the 3 items provided by waffle, namely:  A brown chest which, if selected, the user will get a potion  A silver chest which, if selected, will give the user a stimulant  A yellow chest that, if selected, the user will get a dispel herb.

Figure 3 Map Dusk Farm
After selecting the chest, the illustration of the game is shown in Figure 4.

Mountain Village
In this chapter Stormy provides 3 questions that must be answered by the user where each question is true and false. If correct get 1 point, if wrong 0 point.
Users who answer correctly all three questions get 3 points which means they get a resistance item, 2 points for an agility item and 0/1 for a luck item.
After the user completes all the questions, the reward quest is opened which is then transferred to the FSM test map, namely House Mountain Village. Illustration of the game when answering the questions in Figure 5 below.    Figure 7 below provides an illustration of the FSM check table as shown in Table 1 above.

Figure 7. FSM pengecekan check table
The results of checking the FSM table are illustrated in Figure 8 below, which is the ending of the game.

IV. CONCLUSION
The application of FSM in the role playing game titled Multiple produces an intelligent game mechanism in the form of 9 ending categories with 27 variables based on item selection according to the user's choice which is divided into 3 chapters, namely Dunhill Forest, Dusk Farm and Mountain Village.
The final result of this Interactive Games Implementation is a project for animation. Each ending category obtained by the user gets different rewards depending on the variable item combination chosen because FSM offers every choice throughout the game.