VIETNAM NATIONAL UNIVERSITY, HANOI INTERNATIONAL SCHOOL GRADUATION PROJECT PROJECT NAME Building online tactical action games based on Unity and CSharp Student’s name Nguyen Bao Quang Hanoi - Year 2024 VIETNAM NATIONAL UNIVERSITY, HANOI INTERNATIONAL SCHOOL GRADUATION PROJECT PROJECT NAME Building online tactical action games based on Unity and CSharp SUPERVISOR: Dr. Nguyen Dang Khoa (Academic title, academic degree, full name) STUDENT: Nguyen Bao Quang STUDENT ID:19071625 COHORT: SUBJECT CODE: MAJOR: Informatics and Computer Engineering Hanoi - Year 2024 1 LETTER OF DECLARATION I confirm that the graduate project titled "Building online tactical action games based on Unity and CSharp" is the result of independent work and has not been previously published. All conclusions in the project are derived from my independent research and my own module, and proper citations have been provided for all references. This project was completed under the guidance by Dr.
Nguyen Dang Khoa. Also, I am guarantee that whole this project is not taken from another source. All intergraded module, which I created is not taken and modified from website. All 3D gun model which I used in my project is free-to-use so there is no copyright reregulation and do not violate the intellectual property rights of any third party.
I assume complete responsibility for the graduating project's correctness, including any data, figures, and other written materials. Hanoi, 11th-June 2024 Nguyen Bao Quang 2 ACKNOWLEDGEMENT I would like to express my sincere gratitude to Dr. Nguyen Dang Khoa for his invaluable mentorship and guidance throughout the completion of my final project. His advice, direction, and unwavering support were instrumental in shaping the outcome.
Despite my limited experience, I acknowledge that errors may occur, and I eagerly await feedback from the academic community on how to enhance the project further, thereby establishing a robust foundation for future endeavors. I also extend my heartfelt thanks to all my instructors, friends, and family for their consistent encouragement, which has been indispensable to my personal growth and development. I sincerely thank you! Hanoi,11th-June,2024 Nguyen Bao Quang 3 LIST OF CONTENTS LIST OF CONTENTS. 4 LIST OF FIGURES:.
6 LIST OF ABBREVIATIONS. 8 LIST OF TABLES .12 Comprehensive Understanding and Development of an Online Tactical Action Game Using Unity .12 Expected Results of the Online Tactical Action Game Project: An Academic Analysis. 16 Game Programming Skills Using Unity. 17 Final Product Achieved .1 Reasons for Choosing the Topic.2 Objectives of the Topic .25 Chapter 2: Introduction of unity engine.
Basic Concepts in Unity. Basic Components of the Unity Editor .5 Introduction of Photon .6 Visual Studio and how to use it .7 Introduction of Playfab .8 How to apply model and make an animation .51 Chapter 3: Photon and how Photon work ? .2 How does Photon SDK work in Unity Hub ? .4 Problem in Photon SDK in my project .59 Chapter 4: Playfab and how player database work .1 Setup for unity engine .2 Example how playfab works in my project .3 List of testcase .4 Actual figures in testing .76 Chapter 5: Tactical online game analysis .2 How the gun shooting in the game (definition of raycast) .99 5 LIST OF FIGURES: Figure 1 Project in Unity .27 Figure 2 Scene view in Unity. Error! Bookmark not defined. Figure 3 Prefab in Unity.28 Figure 4 Game Object .30 Figure 5 Inspector view.
Error! Bookmark not defined. Figure 6 Some types of content that can be imported into Unity .31 Figure 7 An example of a script in Unity. Error! Bookmark not defined. Figure 8 Scene windows .33 Figure 9 Game windows .34 Figure 10 A Hierarchy window .36 Figure 11 A Inspector windows for Room Manager prefab .38 Figure 12 A project windows .39 Figure 13 Setup an IDE tool for Unity Engine .44 Figure 14 A texture inspector for material model .49 Figure 15 In this figure, there is no animations .50 Figure 16 This is an animation when turn on a record button .51 Figure 17 An overview of a saved heavy sniper shooting animation after turn off record .51 Figure 18 Animator for a heavy sniper .41 Figure 19 Photon Dashboard .43 Figure 20 The setup Photon SDK panel .54 Figure 21 An overview in Photon SDK work in Unity .54 Figure 22 Playfab website .45 Figure 23 interface of the playfab home page .60 Figure 24 Playfab extension file .61 Figure 25 The example of studio and title id does nothing .66 Figure 26 Login use case diagram .66 Figure 27 Game login screen .68 Figure 28 The signup screen .69 Figure 29 A record player database .69 Figure 30 Customize a spartan suit in Halo game series .70 Figure 31 A customize character work .70 Figure 32 A simple customize player model .72 Figure 33 Player add-on a glass .72 Figure 34 Add-on enable will return valve true, otherwise it returns valve false .73 Figure 35 Login screen .77 6 Figure 36 A raycast in Mathematic (example: point O with two vector x and y) .79 Figure 37 ADS use case diagram .80 Figure 38 ADS is not enable .81 Figure 39 ADS is enable .82 Figure 40 Movement diagram use case .83 Figure 41 An overview of Input Manager .85 Figure 42 A MouseLook use case diagram .87 Figure 43 A camera view in scene mode .88 Figure 44 A Player View in play mode .89 Figure 45 A gun shop in video game .90 Figure 46 A diagram use case how a gun store work.90 Figure 47 A simple gun shop in my project .91 Figure 48 A code for create a gun record.
Error! Bookmark not defined. Figure 49 A diagram use case data static .92 Figure 50 All gun records will be saved in this panel .94 Figure 51 Code a gun shop. Error! Bookmark not defined. Figure 52 Test between two player .58 Figure 53 Issue with customized character connecting to the game(issue.59 Figure 54 Test login screen .75 Figure 55 After login, player sent to Playfab server .76 Figure 56 Testing a gun store.
Error! Bookmark not defined. 7 LIST OF ABBREVIATIONS Abbreviation Definition a/b testing split testing or bucket testing ADS Aim down sight AI artificial intelligence API Application programming interface Bool Boolean point C# C sharp C+ C plus Clamp restricts a given value between an upper and lower bound e. For example, etc. Et cetera Float Floating point FPS first-person shooter ID identification IDE integrated development environment Int Integer point lerp Linear interpolation, PUN Photon Unity Networking RPC Remote Procedure Calls 8 SDK Software development kit TCP Transmission Control Protocol TextMeshProUGU text in a canvas I UDP User Datagram Protocol UI user interface VFX visual effects 9 LIST OF TABLES Table 1 Use case for Login .68 Table 2 Use case for Customize characters .71 Table 3 Use case for ADS function .81 Table 4 Use case for movement .84 Table 5 Use case for a gun store.91 Table 6 List of test case.
Error! Bookmark not defined. 10 ABSTRACT This academic project explores the comprehensive development of an online tactical action game using Unity and C#. The objective is to create a sophisticated multiplayer gaming experience that highlights the importance of teamwork, strategy, and quick reflexes. The project entails a deep dive into Unity's robust architecture, its networking capabilities via Photon PUN, and player data management through Playfab.
Key elements of the development process include implementing realistic player movement, precise shooting mechanics, and a robust health and damage system. The study begins with a thorough understanding of Unity’s component-based system, enabling modular and flexible game design. It then progresses to the development phase, focusing on core gameplay mechanics, such as player interaction and tactical combat scenarios. Networking is a critical aspect, addressed by leveraging Photon PUN to manage server-client interactions and synchronize game states.
The project underscores the technical challenges and learning opportunities presented by developing an online multiplayer game. By navigating these challenges, developers gain valuable insights into network synchronization, latency management, and game optimization. The culmination of the project is a fully functional online tactical action game, which not only showcases the integration of theoretical knowledge and practical skills but also serves as a testament to the educational journey undertaken. Ultimately, this project contributes to the academic discourse on game development by providing a detailed case study on the practical application of Unity and C# in creating engaging and technically sound online multiplayer games.
The findings and methodologies outlined in this project offer a valuable resource for students and professionals seeking to enhance their understanding and capabilities in game development. 11 TECHNOLOGIES USED In this project I used four technologies Unity Visual studio Playfab Photon These technologies together form a powerful stack for developing multiplayer games (assuming that's your project's goal), combining game development (Unity), code editing (Visual Studio), backend services (PlayFab), and multiplayer networking (Photon). Each plays a crucial role in different aspects of your project, from game design and development to backend infrastructure and multiplayer functionality. Comprehensive Understanding and Development of an Online Tactical Action Game Using Unity Introduction In the rapidly evolving field of game development, understanding the architecture and functionality of game engines like Unity is essential.
Unity's versatility and extensive networking capabilities make it a popular choice for developing engaging online multiplayer games. This report outlines the objectives and strategies involved in creating an online tactical action game using Unity and C#, emphasizing the importance of teamwork, strategy, and quick reflexes in achieving gameplay success. Objective 1: Comprehensive Understanding of Unity's Architecture and Functionality Unity is a powerful game engine known for its robust architecture and comprehensive functionality. It employs a component-based system where game objects are defined by the components attached to them, allowing for modular and flexible design.
Understanding this architecture is fundamental for effective game development. Networking Capabilities One of Unity's standout features is its networking capabilities, essential for online multiplayer games. Unity provides several solutions for networking, including the deprecated UNet, the community-driven Mirror, and third-party solutions like Photon. These tools enable developers to manage server-client interactions, synchronize game states, and handle latency issues.
12 Objective 2: Development of an Engaging Online Tactical Action Game Creating an engaging online tactical action game involves meticulous planning and execution. The game's core should focus on tactical battles where teamwork, strategy, and quick reflexes determine the outcome. Game Mechanics: Player Movement and Interaction: Implementing realistic and responsive player movement is crucial. Unity's physics and animation systems can be leveraged to enhance player interactions and create an immersive experience.
Shooting Mechanics: Accurate shooting mechanics, including hit detection and damage calculation, are vital. Raycasting can be used to simulate bullets, ensuring precise and realistic shooting experiences. Health and Damage System: A robust health and damage system is necessary to manage player health, damage reception, and potential healing or armor mechanisms. Objective 3: Gameplay Mechanics To engage players in intense tactical battles, the game must provide various gameplay elements that require strategy and teamwork.
Objective 4: Winning Conditions Clear and achievable winning conditions are crucial for motivating players and providing a sense of accomplishment. Mission Objectives Various mission objectives such as capturing the flag, securing a location, or defusing a bomb add diversity and excitement to the gameplay. These objectives require players to collaborate and strategize effectively. Elimination and Control Points Tracking enemy player eliminations and implementing control points that must be held for a set duration provide clear goals and enhance competitive gameplay.
Objective 5: Losing Conditions Defining losing conditions creates stakes and tension, making the game more thrilling. Respawn System A respawn system with a limited number of lives adds a layer of strategy, as players must balance aggression with caution to avoid depleting their team's lives. Time Limits and Opposing Forces Setting time limits for mission objectives and creating scenarios where players can be overwhelmed by opposing forces increase the game's intensity and urgency.