<aside> 📖
Congratulations, everyone! Welcome to Two-Player Online Game Part 3.
In this assignment, you will build upon the two-player online battle game developed in Part 2, enhancing its functionality by adding features such as an invitation list, lobby broadcasting, and basic database recording.
The game lobby in this assignment should support multiple games for players (clients) to choose from. Players can upload and manage their games independently, and when creating or joining a room, they will be prompted to download the corresponding game files.
The goals of this assignment are:
Enhance and optimize the lobby functionality to significantly improve the user experience.
Use sockets to Implement basic file upload/download capabilities and read/write management.
Beyond meeting the basic requirements, we encourage students to make their projects resemble a real-world game server. Additionally, consider implementing design patterns, data structures, and algorithms to enhance your code's readability, maintainability, flexibility, and scalability.
</aside>
In this HW, students should inherit the lobby concept from HW2, enhancing its functionality and optimizing its performance. You must complete two main programs, a lobby server and a client (user), and ensure their interactions meet the following requirements.
Similar to the requirements in HW2, except that the "game-playing" function needs to be updated to include an upload/download feature (see Section B. Game file upload and download). Students must ensure the following basic functionalities work correctly:
csv
/txt
or database
Even if the lobby server program is shut down and restarted, registered users should still be able to log in using their previously registered account credentials. Please implement a read/write feature in the lobby server to maintain users' account information using an external data source (such as CSV/txt or database) in the lobby server’s directory so that it can be read when needed in the future.
Basic login and registration
When a user logs in, logs out, or creates a public room,the lobby should broadcast events to all users,other users in the lobby should receive a notification message for these events.
Lobby Broadcasting - player enter
Lobby Broadcasting - player enter
Lobby Broadcasting - player exit
Lobby Broadcasting - player exit
The user should be able to receive multiple invitations, and when an invitation is received, the invited user should be notified. The invited user can open the invitation management interface from the lobby at any time to respond.
(4a). If the invited user accepts the invitation but the inviter has closed the room or the room is full, the invited user should be informed and returned to the lobby.
The user who creates a room will have the "Host" role, allowing them to perform the following functions in room
(5-1). Invite Players:
Send invitations to users in the lobby whose status is "idle.”
(5-2). Start Game:
When the room is full,the host can decide to start the game.
(5-2a). If the room is not full and the host tries to start the game, an error should be shown, and the user in the room should return to the room.
(5-3). Leave Room:
If the host leaves the room, all other users in the room should be notified, and the host role should be transferred to a remaining user. If no other users remain, the lobby server should delete the empty room.
This feature awards an additional 5 pts
If the host selects the "Switch Game" option to change the game, all members in the room should download(see Section B. Game file upload and download) the corresponding game(the game should be playable).