scieee AI-readable full text Open interactive document viewer

Developing a distributed, customizable multiplayer card game

Buforn Tena, José Ángel

Abstract

This document is the technical proposal of the Bachelor’s Degree in Video Game Design and Development Thesis. In the thesis, will be developed a video game that emulates a real card game in most of its aspects, including different screens for each of the places where the cards should be. The application stands out for the interaction between them wirelessly in real time emulating a realistic interaction between the players.

Full text

Developing a distributed, customizable multiplayer card game Jose Angel Buforn Tena Final Degree Work Bachelor’s Degree in Video Game Design and Development Universitat Jaume I July 5, 2020 Supervised by: Manuel Francisco Dolz Zaragozá To my parents who always had care of me. Acknowledgments First of all, I would like to thank my Final Degree Work supervisor, Manuel Francisco Dolz Zaragozá, PhD, for his help and being there whenever I needed, even when outside his working hours. I also would like to thank Sergio Barrachina Mir and José Vte. Martí Avilés for their inspiring LaTeX template for writing the Final Degree Work report, which I have used as a starting point in writing this report. To all the people in Unity and Bolt forums trying to help with all the things where I got stuck. Also, the ones in the Bolt’s discord server [10], including some of the authors of the multiplayer system whose bugs reported were fixed or given workarounds for this project. I would like to thank all my classmates, this was the best class from all I was, everybody helping others and no signs of belligerence in all the years. That was amazing. I would also thank all my family for supporting me from the distance, these has been hard days. i Abstract This document is the technical proposal of the Bachelor’s Degree in Video Game Design and Development Thesis. In the thesis, will be developed a video game that emulates a real card game in most of its aspects, including different screens for each of the places where the cards should be. The application stands out for the interaction between them wirelessly in real time emulating a realistic interaction between the players. iii Contents Contents v 1 Introduction 1 1.1 WorkMotivation................................ 1 1.2 Objectives.................................... 2 1.3 Environment and Initial State . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.4 Relatedsubjects ................................ 2 2 Planning and resources evaluation 5 2.1 Planning..................................... 5 2.2 ResourceEvaluation .............................. 9 3 System Analysis and Design 11 3.1 RequirementAnalysis ............................. 11 3.2 SystemDesign ................................. 16 3.3 SystemArchitecture .............................. 20 3.4 InterfaceDesign................................. 21 4 Work Development and Results 23 4.1 WorkDevelopment............................... 23 4.2 Results...................................... 36 5 Conclusions and Future Work 37 5.1 Conclusions................................... 37 5.2 Futurework................................... 38 Bibliography 39 v 6 Planning and resources evaluation The project tasks have been distributed in the following way: •Art: The first week is dedicated to make and gather the game arts. Regarding the menu, some icons and backgrounds are made with Gimp. With respect to the card art, the Spanish variant for the front cards is taken from the GNU operating system given that the arts have enough quality for the game and they can be freely used due to its GPL license. They have been slightly retouched for matching the game sizes via Gimp. •Design: The applications were designed as two different ones in the beginning (client and server), but this is very unpractical for the users and it was changed for being only one. Also, the design of the applications should be almost identical for the user, and it will take two weeks for all the design to be finished. •Audio: This is planned to do in one whole week, make a pair of simple seamless pieces can be easily done in this period of time. •Programming: This is the most time and resources consuming for this project taking 3 months to complete it. It alone takes double time than the rest of the parts. So it is divided in more task and sub-task than the others. Programming an online multiplayer game is divided in the server application and the client application. In this project there is no online server, the server is one of the applications connected. Because of this, the server and the client must be done in parallel, this should take two and a half months for this. In the programming part, there will be three days to make the software design, and two weeks for the game base code, this will be made for the server application and for the client at a time. One month and one week for the game rules with the player turns, deck and game zones. This will be done only with the server part, the client will obey this rules because the authorization movement of the cards. Ten days for creating the network and to implement the communication protocol among applications. It will also be needed two more weeks to make the application handle the network events that allow the applications to synchronize. Finally, the remaining two weeks will be dedicated to create all the animations and effects needed for the game. These tasks have been accordingly described in a Gantt chart (made via GanttProject) that shapes the schedule (see Figure 2.2). In it, it can be seen four big sections: design, art, programming and audio. The programming part is done simultaneously on both parts, the server and the client. There is no sense to make only one part and expect it will work with the other tasks pending to be done. 2.1. Planning 7 Figure 2.1: Planning table 8 Planning and resources evaluation Figure 2.2: Gantt chart. 2.2. Resource Evaluation 9 2.2 Resource Evaluation The costs of the work that is going to be undertaken must be estimated in advance. The human and equipment costs must be quantified so that the work can be assessed and so that, in a real case, the economic viability of the work could be evaluated. The average salary of a junior programmer in different companies in the industry is 23.480 ¤/year [7], so this project made in 300 hours should cost 3.355¤plus taxes in salaries. Also there are some hardware and software to consider: •Hardware: One computer, it does not need to be especially powerful, the app’s graphical part is rather simple. The computer can be used for other projects too, but it is needed. Despite this, a computer is needed and it would cost 600 ¤. •Software: Unity is free if the company’s revenue in the last 12 months are $100k or less, if the revenue is between $100k and $200k it costs $40 per month (+177¤for this project), and if the revenue is greater than $200k the price is $150 per month (+664¤for this project). The IDE used is Rider, it costs $349 the first year (310 ¤for this project), but Microsoft’s Visual Studio can be used too and it is free. The total amount for this project will be 4.442¤including all the software, hardware and salary. Chapter 3 System Analysis and Design Contents 3.1 RequirementAnalysis........................... 11 3.2 SystemDesign............................... 16 3.3 SystemArchitecture............................ 20 3.4 InterfaceDesign .............................. 21 In this chapter we provide the requirements analysis, the system design and architecture of the proposed game, as well as, its interface design. 3.1 Requirement Analysis 3.1.1 Functional Requirements A functional requirement defines a function of the system that is going to be developed. This function is described as a set of inputs, its behavior, and its outputs. The functional requirements can be: calculations, technical details, data manipulations and processes, and any other specific functionality that defines what a system is supposed to achieve. The functional requirements are: •When the user requests information about the assets available, all the assets must be returned divided into four categories: States, Objects, Commands and Events (see Table 3.1). •When the user right-clicks on an empty zone in the bolt assets window and selects new asset’s type, a new one of that category with the default name will be created (see Table 3.2). 11 12 System Analysis and Design •When the user holds down the Ctrl+button, a little red “x” will pop up next to all assets and properties allowing to delete them (see Table 3.3). •The system will compile the assets when the user clicks the little green arrow icon in the Bolt Assets window or through the Bolt/Compile Assembly menu option (see Table 3.4). •When the user clicks the “Server” button and starts a new game being the server, a new game room will be created and the player joins in automatically. The scene changes to the defined game (see Table 3.5). •When the user request information about the game rooms available, they will be returned (see Table 3.6). •When the user clicks on the button of the game room ID, the player will join that game room and the scene changes automatically where the server is (see Table 3.7). •When the player drags a card across the board, the system will make the card move equally in all devices (see Table 3.8). •When the player double taps where a card is, the card will change from face down to face up or vice versa (see Table 3.9). •When the user requests the options available, they will be presented to them (see Table 3.10). •The user can select the style of the buttons used in the menu (see Table 3.11). •The user can select the back face of the cards used in the game (see Table 3.12). •The user can change the volume of the music used in the game (see Table 3.13). •The system will save automatically the options selected by the user (see Table 3.14). •The system will load automatically the options saved, if they do not exist, a random ones will be used (see Table 3.15). Input: Available assets query Output: Available assets The user requests the bolt assets available. When the user requests information about the assets available, all the assets must be returned divided in into four categories: States, Objects, Commands and Events. Table 3.1: Functional requirement «Bolt assets query» 3.1. Requirement Analysis 13 Input: The user add a new bolt asset. Output: New asset created. The user right click on an empty zone in the bolt assets window and select new asset’s type and a new one of that category with the default name will be created. Table 3.2: Functional requirement «New bolt asset» Input: Remove bolt asset. Output: Selected asset deleted. If the user holds down the Ctrl button, a little red x will pop up next to all assets and properties allowing to delete them. Table 3.3: Functional requirement «The user deletes a bolt asset» Input: The user compiles all the assets. Output: A bolt.dll file will be created with all the assets compiled. To make Bolt aware of the assets it is needed to compile them, this can be done either through the Bolt/Compile Assembly menu option or with the little green arrow icon in the Bolt Assets window. They both do the exact same thing. Table 3.4: Functional requirement «Compile assets» Input: In the game, the user creates a game server. Output: A game room is created and the user joins in. In the game, the player clicks the "Server" button and starts a new game being the server, a new game room will be created and the player joins in. The scene changes to the defined game. Then they wait for start the game while other players can join in. Table 3.5: Functional requirement «Create game server» Input: Available game servers. Output: Game rooms for this game. Each game has its own game rooms, when the player requests information about the game rooms available, this will be returned. Table 3.6: Functional requirement «Game server query» 14 System Analysis and Design Input: In the game, the user joins a created game. Output: The user joins a game room. In the game, the player clicks the button with the room id and joins in, the scene changes to the same where the server is. Table 3.7: Functional requirement «Join game» Input: In the game, the player drags a card. Output: The selected card moves in all devices. In the game, the player can drag a card across the board and the card moves equally in all devices. Table 3.8: Functional requirement «Card movement» Input: In the game, the player double taps a card. Output: The selected card rotates face down or face up. In the game, the player can turn down or up the cards by double tapping them. If it is face down it will turn face up, and if it is face up it will turn face down Table 3.9: Functional requirement «Card rotation» Input: In the game, available options. Output: The options available. In the game, the player can request the options available and they will be presented to them Table 3.10: Functional requirement «Game options» Input: In the game, button background selection. Output: Button background selected. In the game, the player can change the buttons style used Table 3.11: Functional requirement «Game buttons» 3.1. Requirement Analysis 15 Input: In the game, card game back. Output: Back card selected. In the game, the player can replace the design on the reverse of the cards with alternate designs Table 3.12: Functional requirement «Game cards back» Input: In the game, volume. Output: Music volume changed. In the game, the player has a slider for change the music volume or deactivate it completely. The volume changes in real time Table 3.13: Functional requirement «Game music volume» Input: None. Output: Saved options. In the game, the system will save the options selected by the user automatically whenever they are set. Table 3.14: Functional requirement «Game save user options» 3.1.2 Non-functional Requirements Non-functional requirements express how the system should be in overall, not what will be capable of. Some of them are: •The system needs to be able to connect to the matchmaking server and the other devices. •The network entities will be controlled only by the user who has authority over them. •The network entities need to be updated in real time. Input: In the game, volume. Output: Music volume changed. In the game, the options saved will be loaded automatically every time the application starts without the interaction of the user. Table 3.15: Functional requirement «Game load user options» 22 System Analysis and Design Figure 3.8: Options Menu Design to accessing the options in the game. Also, there is a button to move the camera and change the view from the player’s cards to the cards in common or in the table, this button will be on the top left corner. On the top mid will be the score if the game has one. Figure 3.9: Game Interface Design Chapter 4 Work Development and Results Contents 4.1 WorkDevelopment ............................ 23 4.2 Results ................................... 36 In this chapter is where all the developed work is explained. The work in a video game has different aspects to cover, these aspects are described below. Also, there is an explanation of the result achieved in this project. 4.1 Work Development 4.1.1 Art Here we can distinguish two parts, the menu and the Heads Up Display (HUD [15]) icons, and the card frames: •Icons: The icons in the menu must be simple and easily understandable by anyone just by looking at them. A simple cross says the same than "click here for close this" and does not overload the screen (see Figure 4.1). Familiar icons are used to accomplish common tasks. Figure 4.1: Icons. 23 24 Work Development and Results The buttons have a selectable style, all of them not too dark so the black characters on the buttons are easily read. •Card faces: The cards have two sides; on the front we have the art, and it can be the spanish style with 4 suits and 10-12 cards per suit, or the french style with 4 suits and 10-13 cards per suit (see Figure 4.2). Figure 4.2: Different front faces. On the back face there are some different card frames (see Figure 4.3), the one desired can be selected in the options menu. Figure 4.3: Different back faces. 4.1.2 Design The application needs a design, it was made following the flowcharts shown in the last chapter (see Figure 3.2, figure 3.3 and figure 3.9). The menu has the aspect planned, the logo on top and three buttons for each one of the operations (see Figure 4.4). 4.1. Work Development 25 Figure 4.4: Final version of the main menu. The options menu has three different zones: on the top is where the button style is selected, in the mid there is a slider for control the music volume, and on the bottom is the back card image selection (see Figure 4.5). Figure 4.5: Final version of the options menu. 26 Work Development and Results 4.1.3 User Experience As Celia Hodent says in her study [9], the user experience (UX) entails a person’s perceptions and interactions with a product or software (such as a video game) and the satisfaction and emotions elicited via this interaction. UX overall refers to an overarching discipline focused on the evaluation and improvement of users’ experience of a given product or software in development. The user interface and the user experience are closely linked. This game is a puzzlelike kind of game, the user interface needs to be simple for the user being focused in the game. This game tries to emulate a real-life game. The most important aspect of the emotional game design is the "game feel", the tactile sensation of interacting with the virtual cards. The feeling of moving the cards is smooth and natural while dragging them (see Figure 4.6). The heuristics developed in this game take into account the limitations of the human brain in perception, attention, and memory, being the interface and the controls the most simple possible, or if it has some doubt on how to do anything, the first guess from the user is the right one. Figure 4.6: Game feel. Moving a card. 4.1. Work Development 27 4.1.4 Programming This is the part what took the most of the work, and the most extensive one. For convenience, it is going to be split into parts below. Menu The menu part is done with the GUILayout class in Unity as it is a very efficient way to implement this feature [12]. Indeed, this feature permits us to use the application as a server or as a client by doing the right button labelling (see Figure 4.7). In the server part, there is a selection of games available, and after choosing one, a game room is created and the game waits for the clients to connect (see Figure 4.8). In the client part, there is a list of games created where the player can join the room to play in it (see Figure 4.9). Figure 4.7: Main menu. In both parts, server and client, there will be a temporal information box that tells how many people is connected, including some information about the last connected or disconnected client (see Figure 4.8). It is also implemented a section for the options where the user can set the different customizations, like the button style, card backfaces or the music volume (see 28 Work Development and Results Figure 4.8: Server connecting. Figure 4.9: Client connecting. 4.1. Work Development 29 Figure 4.10). These options are locally saved when the user goes back to the main menu and loaded when the application starts (if they exist). This is done using the Unity PlayerPrefs [13] because it has support for multiple platforms in an easy way to add the saved options for all the players in the games. Figure 4.10: Options. Network When an object is needed to be replicated over the network, we need something called assets. The assets are pre-compiled in the editor and, after doing it, that network entity can be added to the game objects. When compiling, Bolt will go through all of the prefabs and other Bolt-related assets and compile a very efficient network protocol for them, which is then stored inside of the bolt.user.dll assembly which you can find in Assets/Photon/PhotonBolt/assemblies folder. Assets are broken down into four categories: •States: these are the meat of most games built, they allow the programmer to define features like the player name, health, transform, animation parameters, etc. (see Figure 4.11). 30 Work Development and Results Figure 4.11: State window. •Objects: objects are a way of logically grouping several properties in the same way a programmer does with a C# class. As an example, if an inventory has to be implemented for a player in an RPG game, an Object called Item can be created and assign it properties like ItemId,Durability, etc. Then, the State creates an array of Item objects (see Figure 4.12). •Commands: these are used exclusively for the authoritative features and are used to encapsulate user input and the result of applying the input to a character in the game (see Figure 4.13). •Events: these are simply messages. Events allow the programmer to much easier decouple the different parts of the game from each other, as it can have several listeners to a single event active at the same time (see Figure 4.14). 4.1. Work Development 31 Figure 4.12: Object window. Figure 4.13: Commands window. 38 Conclusions and Future Work The code is hosted on github [1] publicly available. Everybody can check it and see how it is made. 5.2 Future work This project can be extended in the following ways, for example: •New games can be added as modules, each one with its own rules. •Voice chat, so the players can communicate just talking. •Server migration. If the server disconnects, another client assumes the server role and the game does not need to finish. Bibliography [1] Jose Angel Buforn. Project repository. https://github.com/JoseAngelB/TFG2020. Accessed: 2020-02-28. [2] Svitozar Cherepii. Dia programm. http://live.gnome.org/Dia. Accessed: 2020-02- 28. [3] Exit Games. Bolt entity ownership. https://doc.photonengine.com/en-us/bolt/ current/in-depth/entity-ownership. Accessed: 2020-02-28. [4] Exit Games. Bolt network callbacks. https://doc.photonengine.com/en-us/bolt/ current/reference/state-callbacks. Accessed: 2020-02-28. [5] Exit Games. Photon engine. https://www.photonengine.com/en-us/Photon. Accessed: 2020-02-28. [6] Exit Games. Photon engine, creating a game. https://doc.photonengine. com/en-us/bolt/current/demos-and-tutorials/advanced-tutorial/chapter-1. Accessed: 2020-02-28. [7] Inc. Glassdoor. Average junior programmer salaries. https://www.glassdoor.com/ Salaries/junior-programmer-salary-SRCH_KO0,17.htm. Accessed: 2020-02-28. [8] Don Glover. Unet deprecation faq. https://support.unity3d.com/hc/en-us/ articles/360001252086-UNet-Deprecation-FAQ. Accessed: 2020-02-28. [9] Celia Hodent. Cognitive Psychology Applied to User Experience in Video Games, pages 1–6. Springer International Publishing, Cham, 2016. [10] Discord Inc. Bolt discord server. https://discord.gg/0ya6ZpOvnShSCtbb. Accessed: 2020-02-28. [11] The GIMP Team. Gimp homepage. https://www.gimp.org/. Accessed: 2020-02-28. [12] Unity Technologies. Guilayout reference. https : / / docs . unity3d . com / ScriptReference/GUILayout.html. Accessed: 2020-02-28. [13] Unity Technologies. Playerprefs reference. https : / / docs . unity3d . com / ScriptReference/PlayerPrefs.html. Accessed: 2020-02-28. 39 40 Bibliography [14] Unity Technologies. Unity requirements. https://docs.unity3d.com/Manual/ system-requirements.html. Accessed: 2020-02-28. [15] Wikipedia. Heads-up display (video games). https://en.wikipedia.org/wiki/HUD_ (video_gaming). Accessed: 2020-02-28.