1. Trang chủ
  2. » Luận Văn - Báo Cáo

Đồ án xây dựng multiplayer peer to peer game

53 3 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Building Multiplayer Peer-to-Peer Game
Tác giả Nguyễn Tuấn Kiệt
Người hướng dẫn Trần Thị Hồng Yến
Trường học Vietnam National University - Ho Chi Minh City University of Information Technology
Chuyên ngành Software Engineering
Thể loại đề tài
Năm xuất bản 2022
Thành phố Hồ Chí Minh
Định dạng
Số trang 53
Dung lượng 832,23 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Cấu trúc

  • Chapter I: Introduction (14)
    • I. Basic Information (14)
      • 1. Group Information (14)
      • 2. Project Information (14)
      • 3. Technology Used (14)
    • II. Statement Of The Project (16)
      • 1. Story (16)
      • 2. Brief About Objects In Game (17)
      • 3. Functional Requirements (18)
      • 4. Non-functional Requirements (20)
  • Chapter II: Use Case (22)
    • I. User story (22)
    • II. Use Case Models (23)
  • Chapter III: Data Design (36)
    • I. Local Data Control (36)
    • II. Database Design (36)
      • 1. User (26)
      • 2. Character (36)
      • 3. LobbyRoom (37)
  • Chapter IV: Interface Design (38)
    • I. Regulation (38)
    • II. List Of UIs (38)
    • III. Details Description (38)
  • Chapter V: Installation (51)
  • Chapter VI: Conclusion (52)
    • I. Result (52)
    • II. Limitations (52)

Nội dung

Introduction

Basic Information

20520906 Nguyễn Tuấn Kiệt 20520906@gm.uit.edu.vn

• Project name: Building a multiplayer peer-to-peer game.

Godot is a cross-platform, free and open-source game engine released under the MIT license It was initially developed by Argentine software

Developed by Juan Linietsky and Ariel Manzur, this versatile development environment was initially utilized by various companies across Latin America before its public release Compatible with multiple operating systems such as Linux, BSDs, macOS, and Microsoft Windows, it is specifically designed for creating both 2D and 3D games for PC, mobile, and web platforms Additionally, it can be employed to develop non-game software, including editors.

Godot provides a comprehensive game development environment, enabling developers to create games without the need for additional tools beyond those for content creation, such as visual assets and music Its architecture revolves around a tree of "nodes," which are organized into "scenes" that are reusable, instanceable, inheritable, and nestable All game resources, including scripts and graphical assets, are stored in the computer's file system rather than a database, promoting seamless collaboration among game development teams utilizing software version control systems.

C# is a contemporary, object-oriented programming language created by Microsoft within the NET framework, first introduced in 2002 It is extensively utilized for developing Windows desktop applications, web applications, mobile applications, and games.

C# is a simple, efficient, and type-safe programming language that enforces strict type checking to minimize compile-time errors With features like garbage collection, automatic memory management, and multithreading support, C# is ideal for developing scalable and high-performance applications.

C# syntax resembles that of other C-style languages like Java and C++, incorporating essential features such as classes, interfaces, inheritance, and generics Additionally, it offers modern capabilities like async/await for asynchronous programming, LINQ for efficient data querying, and extension methods that enhance the functionality of existing types.

C# is a widely-used programming language for developing enterprise-level applications, backed by robust support from Microsoft and the NET community Its extensive collection of third-party libraries and frameworks facilitates the rapid development of complex applications.

GitHub is a cloud-based platform designed for software development and version control with Git, offering features such as access control, bug tracking, task management, and continuous integration It serves as a comprehensive tool for managing projects, including wikis for documentation Based in California, GitHub has been a subsidiary of Microsoft since 2018.

GitHub is a leading platform for hosting open-source software development projects, boasting over 83 million developers and more than 200 million repositories as of June 2022 Among these, there are at least 28 million public repositories, making GitHub the largest source code host as of November 2021.

Statement Of The Project

Once upon a time, there was a kind of creature named Poppit They are cute, dynamic and they love to run here and there Therefore, the highest king of

17 the whole Poppit decide to hold a competition, seeking for the fastest, strongest, most intelligent to lead the whole kingdom side by side with the king

They call it – THE POPPIT ARENA

2 Brief About Objects In Game

- The Game Object that we control based on rules of the game

- Player can do all of the things that were mentioned in the feature section above

- The Boat is the object that will carry the players to lobby screen

- It can be interacted with by using keyboards or click on the floating button

- The Boat has cute floating animation

- This is where users can change the player’s appearance

- It can be interacted with by using keyboards or click on the floating button

- This is where users can watch the credits

- It can be interacted with by using keyboards or click on the floating button

- This is the flag appearing in each game session (map)

- The first player touch the Victory Flag will be the winner of that game session

- Hash & Salt is a method to secure the users’ passwords by creating a random string after X times hashing – which means the password is chosen after X times randomly created

- Salt is a chain that will be mixed into the encrypted password that will give the game hint to check if the "pure text” users input match the password

- Hash password and salt string will be kept in the Firestore Database

The database has divided into multiple classes and parts which will create a better protection to the private information such as name, appearance of the character,…

Peer-to-peer (P2P) is a decentralized communication model that enables direct connections between two or more computers or devices without relying on a centralized server or authority In a P2P network, each device operates as both a client and a server, allowing for efficient resource sharing and collaboration.

19 can act as both a client and a server, allowing them to share resources and information with each other

In a P2P network, every device operates on equal footing, enabling both the initiation and response to requests This structure promotes faster and more efficient communication by eliminating single points of failure and bottlenecks within the network.

P2P networks facilitate file sharing by enabling users to exchange files directly without the need for a central server Additionally, these networks support decentralized applications like cryptocurrency systems, where every node retains a complete copy of the ledger.

- While P2P networks have several advantages, they also have some drawbacks, including the potential for security vulnerabilities and the difficulty of managing large-scale networks

Universal Plug and Play (UPnP) is a collection of networking protocols that facilitates the discovery and communication between devices on a local network Designed to streamline the connection process, UPnP is commonly utilized in home networking equipment, including routers, printers, and media servers.

UPnP allows devices to automatically identify and connect with one another on a network, eliminating the need for manual setup by the user For instance, a device equipped with UPnP can seamlessly find and link to a router, which in turn can automatically adjust the device's network configurations.

UPnP's essential feature is its support for port forwarding, enabling devices on a network to receive incoming internet traffic This capability is crucial for applications like online gaming and remote access to home networks.

- While UPnP can simplify the process of connecting devices to a network, it has also been criticized for potential security vulnerabilities Because

UPnP enables automatic discovery and communication between devices, but it also poses a risk by facilitating the spread of malicious software across a network Therefore, it is crucial to exercise caution when using UPnP and to ensure that all devices on the network are adequately secured.

3.2.3 Using Database instead of UPnP

To utilize UPnP effectively, it is essential to enable UPnP settings on every network modem However, its functionality may be limited in various scenarios, particularly when connecting to public networks like those found in coffee shops and malls.

While there are concerns about the potential dangers of UPnP for users, it's essential to address these issues effectively to ensure optimal security.

To ensure unique identifiers for users, I store their public IP addresses in a database when creating a room, converting them into a random combination of five alphanumeric characters It is essential to verify that each generated combination has not been previously created to avoid duplication of string codes.

The game has improved its connectivity by eliminating the need for UPnP to scan the internet for room IDs; instead, it now loads all stored IDs directly in the lobby This enhancement allows users to connect with one another seamlessly, without the concerns of sharing IP addresses or opening ports.

- Uniform and easy to read the texts and commands

- Easy to understand what to do

- Player should feel that the game is hard enough to try but still feel it is beatable

- Gives Player the ability to complete the game without failing

Should be able to run on Windows 7 or later

- Any game object/entity that has been destroyed need to be realeased from memory

- Graphics should have no blur

Use Case

User story

As a player, I want to create an account player system database sign up player – system - database

As a player, I want to login player system database sign in player – system - database

As a player, I want to find my password in case I forget it player system database find password player – system - database

As a player, I want to name my character player system database naming player – system - database

As a player, I want to customize character’s appearance player system database HUD customize player – system – database - HUD

As a player, I want to know the credits player system database HUD credits player – system – database - HUD

As a player, I want to go to the lobby player system database HUD navigate to lobby player – system – database - HUD

As a player, I want to create a new room with my selected map and restrict the number of players player system database HUD create room player – system – database - HUD

As a player, I want to join a room by multiple ways player system database HUD join room player – system – database - HUD

Use Case Models

The game only has 1 Use Case Model which is “the Player” Other main mechanics are game system, database and synchronizer

Image 3: Player Use Case Diagram

No Actor’s Name Brief Description

Is the entity that you use to interact with the game Player can move, jump, fall, wall climbing, wall jumping and interact with other elements

No Element’s Name Brief Description

The Game System is the central element that governs all gameplay actions It assesses whether an action occurs remotely, locally, or in both contexts, and it also distinguishes between actions taken during active gameplay sessions and those during idle states.

The element notifies other peers in the game session when a user's action has been executed This message is sent to the Game System for examination and is then relayed to all available peers Upon receiving the signal, peers trigger the corresponding method related to that signal.

The real-time event control element in a game is crucial, as it manages various mechanics related to the database Key aspects such as customization, attended tutorials, room participants, passwords, and names must be updated promptly to ensure a seamless gaming experience.

No Use Case’s Name Brief Description

The use case begins when user triggers an action relative to information like: save, update, create, delete,…

2 Sign Up The use case begins when user presses Sign

3 Find Password The use case begins when user presses Find

4 Sign In The use case begins when user presses Sign In

5 Customize The use case begins when user presses or interacts with Customize Button

6 Watch Credits The use case begins when user presses or interacts with Watch Credits Button

7 Quit The use case begins when user presses or interacts with Quit Button

8 Navigate To Lobby The use case begins when user presses or interacts with Navigate To Lobby Button

9 Filter The use case begins when user triggers one or many filters

10 Host The use case begins when user presses Host

The use case begins when user presses Join Button to input the Room’s ID, or, presses Join Button of the available rooms

12 Play The use case begins when user completes Host or Join action

13 Move The use case begins when user presses Left or

14 Jump The use case begins when user presses X

15 Wall Climb The use case begins when user presses C

16 Wall Jump The use case begins when user presses X

17 Interact The use case begins when user presses E

18 Check Restriction The use case begins when user triggers an action relative to collision

The use case begins when user triggers an action

20 Sync With Peers The use case begins when user triggers an action

Short Description The use case begins when user triggers an action relative to information like: save, update, create,

1 User triggers an action relative to information

2 Game System tries to access the Firestore Database

3 The Game temporarily pauses waiting for the result

5 Ignore the action if it failed to access the database This will help reduce chance to occur error during the data getter session

6 Handle the requested action due to the result

Special Requirements The device needs to be connecting to the Internet

Pre-Condition The game is not in any special cases

Short Description The use case begins when user presses Sign Up

2 User presses the Sign Up Button

3 The UI will change from the Sign In UI to Sign

4 The game will check for if the account has already exited

5 When the user finishes signing up – the game will require the user to name their character

6 The game will store the step to the database to remember if the user has completed the naming step or not

Special Requirements Every input area needs to be filled

Short Description The use case begins when user presses Find

2 User presses the Find Password Button

3 The game will check the online database to check if the username’s email is valid

4 The game will send the password to the email if it is valid

Special Requirements The email is valid

Short Description The use case begins when user presses Sign In

2 User presses the Sign In Button

3 The game will check if the account is available

4 If it is valid, the game will check if the account has named the character

5 If it has not been done, navigates user to the naming screen instead of main screen

Special Requirements Every input area needs to be filled

Short Description The use case begins when user presses or interacts with Customize Button

1 User can navigate to Customization Screen from the Main Screen by interacting with E Key or pressing directly the floating button

2 The system will bring the user to the Customization Screen

3 User can choose the skin, the mask in the UI

4 User can preview by watching the model on the right of the screen

5 Press the Back Button to auto confirm the changes

6 The game will update the information to the online database

Post-Condition Every other screen needs to update with new information

Short Description The use case begins when user presses or interacts with Watch Credits Button

1 User can navigate to Watch Credits Screen from the Main Screen by interacting with E Key or pressing directly the floating button

2 The system will take the user to the Watch Credits Screen

3 The user can learn which assets the game is using

4 Press the Back Button to auto confirm the changes

Short Description The use case begins when user presses or interacts with Quit Button

1 User can quit the game by going to the exit door at the left most of the Main Screen Game’s platform

2 The dialog will show up for the player to choose one of the two options

3 If the player confirms the quit action, the game will turn off

1 User can quit the game at the Login Screen by pressing the Quit Button

2 The dialog will show up for the player to choose one of the two options

3 If the player confirms the quit action, the game will turn off

Pre-Condition Pause the game

Post-Condition Un-pause the game

Short Description The use case begins when user presses or interacts with Navigate To Lobby Button

1 User can navigate to Lobby Screen from the Main Screen by interacting with E Key or pressing directly the floating button

2 The system will take the user to the Lobby Screen

3 The lobby will access the online database and retrieve the information and display all of it

Short Description The use case begins when user triggers one or many filters

1 The user enters Lobby Screen

2 The user triggers one of the filters like name, max players, maps

3 The game system will access the online database to filter the list

4 Update the list in the user’s screen

Post-Condition The game system needs to pull the newest information

Short Description The use case begins when user presses Host

1 The user enters Lobby Screen

2 The user presses the Host Button

3 The Host UI will show up

4 The user fills in necessary information

5 The user presses Confirm Button

6 The game system will access online database to check if the room is available

7 If it is valid, navigate the user to the relative map and create the room in the online database

The use case begins when user presses Join Button to input the Room’s ID, or, presses Join Button of the available rooms

1 The user enters Lobby Screen

2 The user presses the Join Button

3 The Join UI will show up

4 The user fills in necessary information

5 The game system will access the online database to check if there is a matched room

6 If yes, navigate the user to the relative map

7 The game system will retrieve the information of others in the same room to load it into the user’s device

1 The user enters Lobby Screen

2 The user presses the Join Button of one in many rooms

3 The Password UI will show up

4 The user fills in necessary information

5 The game system will access the online database to check if there is matched room

6 If yes, navigate the user to the relative map

7 The game system will retrieve the information of others in the same room to load in the user’s device

Short Description The use case begins when user completes Host or

1 The user is currently in a “map”

2 The user can test the movement while waiting for others

Short Description The use case begins when user presses Left or

1 The user presses Left or Right Button

2 The character will move toward the relative direction of the input and holding button time

3 The animation player will run the animation if the character is on the ground

4 The game system will notice the movement to other peers

5 The other peers will update the signal action

Short Description The use case begins when user presses X Button

1 The user presses or holds X Button

2 The character will jump off the ground The strength is based on the time pressing the X Button

3 The animation player will run the animation if the velocity.y < 0 (upward)

4 The game system will notice the movement to other peers

5 The other peers will update the signal action

Short Description The use case begins when user presses C Button

1 The user controls the character to move against the wall

3 The game system checks if the character is colliding against the wall

4 If yes, the character will change state to Wall Climb

5 The game system will notice the movement to other peers

6 The other peers will update the signal action

Short Description The use case begins when user presses X Button when holding C Button

1 The user controls the character to move against the wall

3 The game system checks if the character is colliding against the wall

4 If yes, the character will change state to Wall Climb

5 The user presses X Button while at Wall Climb State

6 The character will jump out of the wall in the opposite direction

7 The game system will notice the movement to other peers

8 The other peers will update the signal action

Short Description The use case begins when user presses E Button

1 The user controls the character to move against the objects

3 If the character is in the interaction area, triggers the suitable function of the object

Short Description The use case begins when user triggers an action relative to collision

1 The user controls the character

2 If the user is colliding against other collisions, stop its movement

Short Description The use case begins when user triggers an action

1 The user triggers an action

2 The game system will check if there is any condition relative to the action

Short Description The use case begins when user triggers an action

1 The user triggers an action

2 Determines if the action is local or remote or both

3 If the action is local, run the local method

4 If the action is remote, send signals to other peers to trigger the remote methods

5 Else, do 3 and 4 at the same time

6 Receive the result from other peers

Data Design

Local Data Control

All the changes that are needed to save in the online database will be updated through a local save

To avoid the missing changes when there is no internet, the game will save locally – then update the online database when having chance

This method also helps the game performs better because:

• The game does not need to access to the online database every time the user does some actions

• The local save can store some elements like: isHost, hasStarted, to keep the game logic.

Database Design

Email The email to use when the user needs to find the password

HasReadTutorial This is an array to track which tutorial the user has taken part in

IngameName This is the ingame name – the name of the character that the user controls

IsFirstTime This is to check if the user has named the character

Password This is the password after being hashed

Salt This is the salt to hashed the password

Head This is the index of the Head Assets in the library to show up when loading the character

SkinColor This is the index of the Skin Assets in the library

37 to show up when loading the character

HasStarted This is to check if the game has started or not Host This is to store the host’s name

ID This is the room ID – using instead of the pure

IPAddress This is the IPAddress to connect peers to the

MapName This is the map name of the room

MaxPlayer refers to the maximum number of players allowed in a room The Password indicates whether the room has a password for access PlayerAmount shows the current number of players present in the room.

Interface Design

Regulation

List Of UIs

Details Description

This is the first scene that user can interact with This scene is where the user can fill in her/his information to sign in the game

• Login Screen needs user to fill in username and password

• The main function is to introduce the game’s name and let user hear the theme song

• The Login Screen lets the user to turn off the game, tab into the register UI

This is the screen where the user can fill in information in order to create a new account In this screen, we need:

This screen also gives the user the ability to switch back to the login screen or turn off the game

Naming Screen is where the user chooses their character’s name

Main Screen is the main navigator to other screens such as: credits, customization, lobby

In Main Screen, the user can control the character normally, enjoys the chill soundtrack and view

The Main Screen also gives the user to escape the game

The Credits Screen provides details about all the assets utilized in the game, highlighting contributions from various artists worldwide, rather than solely from the author, Nguyễn Tuấn Kiệt.

All the assets are free for commercial used and non-commercial used

In Customization Screen, we can customize our characters such as: the skin color, the head mask

• The counter to select the available head masks

• The counter to select the default skin colors

• The text area to type in the HEX Color that the user likes!

All of the changes can be previewed with the model in the right of the screen

All of the changes will be updated after leaving the screen

In Lobby Screen, we will have the lobby which shows all of the available rooms for the user to choose

Each room will have its information and a button to connect to the room Filters will have:

In Host UI, we will have some information to fill in like: the map, the password and the max players

In Join UI, we will have some information to fill in like: the room’s ID and the room’s Password if there is any

If the room has password, it will require us to fill in the password

It has text UI like tutorials and Button like Start Button

This is the dialog to notice the user about something – for example, welcome, errors,…

This dialog is to let the user re-confirms his/her decision

Image 16: Yes/No Dialog Window

Installation

• The game will come in the form of a zip file Extract the package and run the exe file to play the game

• The game can also be played on browser at itch.io site

Conclusion

Result

• Finished implementing 100% of the planned features

• Have enough maps to give different experience each time playing the game

Limitations

• Don’t have multiple available languages.

• Cannot change the game controls.

Ngày đăng: 04/09/2023, 20:49

w