1. Homepage
  2. Programming
  3. CS3357A COMPUTER NETWORKING Assignment #4: Building a multi-player server-client snake game

CS3357A COMPUTER NETWORKING Assignment #4: Building a multi-player server-client snake game

Engage in a Conversation
UWOCS3357ACOMPUTER NETWORKINGmulti-player server-client snake gameRSAPython

CS3357A COMPUTER NETWORKING CourseNana.COM

Assignment #4: Building a multi-player server-client snake game. CourseNana.COM

Assignment Purpose CourseNana.COM

The goal of this assignment is to extend the functionality of the previously developed Snake game to support three additional features: CourseNana.COM

  1. 1-  The server should handle multiple clients/snakes simultaneously. Each client will have its own snake, enabling a multiplayer environment where multiple snakes share the field. Each client will receive a game state that includes the position of all snakes to display them. You can decide colors. Check the “Communication Protocol and Game State” section for instruction on implementing the multi-player feature. CourseNana.COM

  2. 2-  While playing, Clients can send a public message to the server to be broadcasted to all clients. Check the chatting section for instruction on implementing the public messaging part. CourseNana.COM

  3. 3-  Both the server and the clients encrypt their messages using RSA encryption algorithm. In the RSA algorithm, each party generates a key pair (public key, private key), where the private key is kept as a secret at the sender and is used to encrypt the sender messages, and the public key is publicly shared with the receiver and is used to decrypt the messages at the receiver side. Check the Encryption section for instruction on implementing messages and control inputs encryption. CourseNana.COM

The image below shows the game window that should be displayed on the client side in this assignment. CourseNana.COM

Figure 1 A screenshot showing the graphical interface of the snake game on the client side, containing three snakes and 4 snacks. The screenshot also shows the terminal of one of the three connected clients with messages exchanged between clients. CourseNana.COM

The server is responsible for: CourseNana.COM

  1. Accepting multiple client connections. CourseNana.COM

  2. Managing the game's logic for all connected clients. CourseNana.COM

  3. Broadcasting the game state to all clients. CourseNana.COM

  4. Receiving and parsing each client's input commands. CourseNana.COM

  5. Applying the received game controls to update the game state. CourseNana.COM

  6. Receive public messages from clients and broadcast them to all clients. CourseNana.COM

  7. Encrypting outgoing public messages. CourseNana.COM

  8. Decrypting incoming controls inputs and public messages. CourseNana.COM

The snake client is responsible for: CourseNana.COM

  1. Connecting to the server. CourseNana.COM

  2. Sending control inputs to the server. CourseNana.COM

  3. Receive and parse the game state. CourseNana.COM

    Receive the public messages broadcasted by the server and display them on the terminal. CourseNana.COM

  4. Encrypts outgoing control inputs and public messages before sending them to the server. CourseNana.COM

  5. Decrypts incoming public messages received from the server. CourseNana.COM

Assignment Description CourseNana.COM

Modify the snake_server.py and snake_client.py files of assignment 3 to support handling multiple players, RSA-based secure communication, and public messaging between clients. Each client will be assigned a snake where he will be able to control it by sending encrypted control inputs to the server. On the other hand, the server manages the game logic including recording snakes and snacks positions; applying control inputs; and returning the game state. CourseNana.COM

In the previous assignment (assignment #3), you were given the server side code which is separated into two files: snake.py and snake_server.py, and you had to implement the client side code. These files will be used as the starting code for this assignment.
In this assignment, no new files are given, but you are required to use and modify the server/client code files of the previous assignments to support the new functionalities. CourseNana.COM

As this assignment builds on previous ones, the following diagrams illustrate the connection between assignment 2, assignment 3, and assignment 4: CourseNana.COM

Snake game CourseNana.COM

The snake game that we will implement in this assignment is similar to the one implemented in the previous assignment with additional features.
The rules of the game are implemented in the snake.py file which is used by the server script (snake_server.py).
CourseNana.COM

Game controls CourseNana.COM

In assignment 3, we implemented seven game controls sent by the client to enable him to control the snake. Since we are using the code scripts of the previous assignment as a starting code for this assignment, these seven game controls are still used in this assignment. However, feel free to change the format of the control messages. For example, instead of sending the get command as “get”, you can send “control:get” instead. This way the server knows this is a control input and not a public message that should be broadcasted to all clients. CourseNana.COM

Chatting CourseNana.COM

Players will be able to send a message to all other players by sending a message to the server and the server will broadcast the message to all players. Therefore, in each cycle, the server can receive a control input or a message from each client. The two conditions apply: CourseNana.COM

1. A player can only send a public message to all players, he cannot send a private message to a particular player. For example, if three players are connected, A, B, and C. Player A can send a CourseNana.COM

public message to the server and the server will broadcast this message to A, B, and C. Player A CourseNana.COM

can’t send a private message to player B or C.
2. Instead of having the user type in the message it wants to send to the server, each player should
CourseNana.COM

have a set of predefined messages each associated with a hotkey. When the user presses a hotkey, the corresponding message should be sent to the server to be broadcasted to all other players. Each player chooses its unique set of messages. should be sent to the server. The server will then broadcast the message to users B and C. Upon receiving player A’s message from the server, users B and C will display the received message on their terminal. You are required to implement a client that has a set of three predefined messages each assigned a key. CourseNana.COM

Encryption CourseNana.COM

RSA Encryption Workflow CourseNana.COM

Consider a client k that wants to securely communicate with a server using RSA algorithm. First, client k must generate its own RSA key pair: (client_k_public_key, client_k_private_key). Similarly, the server will construct its own RSA key pair: (server_public_key, server_private_key). The server will share its public key with every client that connects to it. After that, if the server wants to send an encrypted message to client k, it will encrypt the message using its own private key. Client k will then be able to decrypt the received message using the server’s public key. CourseNana.COM

What to encrypt CourseNana.COM

In this assignment, the server exchanges various types of data with clients. Each cycle, the client must send a control message and possibly a public message to be broadcasted to all clients. On the other hand, the server sends the game state and the public messages that it received from any client to broadcast to other clients. Therefore, the client can send two types of data: control inputs and public messages, and the server can send two types of data: the game state and public messages. You are required to encrypt all the exchanged data between the server and client except the game state which can be sent without encryption. We don’t encrypt the game state because encryption becomes more expensive (takes a lot of time) as the length of the text to be encrypted grows. CourseNana.COM

Communication protocol and game state CourseNana.COM

In the previous assignment, the exact form of the game state was provided which contains the coordinates of the snakes and the coordinates of the snacks separated by a “|” character. As this assignment introduces more features that require adjusting both the server and client scripts, the communication protocol provided for the previous assignment will not work. For example, in the previous assignment, the server and the client exchange the control inputs and the game state each cycle. In this assignment, clients can send a public message to the server to be relayed to the other clients. Therefore, the communication protocol should be CourseNana.COM

CourseNana.COM

redesigned such that under the new communication protocol, the client can send both types of data (i.e. control inputs and public messages), and the server can differentiate between both types. CourseNana.COM

Redesign the game communication protocol. This includes re-formatting of the control inputs and the game state; and modifying the sequence and contents of exchanged data. Feel free to make any changes in the client and server scripts of the previous assignment to add the new functionalities (multi-client connection, public chatting between clients, and message encryption). CourseNana.COM

Deliverables CourseNana.COM

Submit four files: CourseNana.COM

  1. snake_server.py: Snake game server-side code which can handle multiple client connections and CourseNana.COM

    public messaging. CourseNana.COM

  2. Snake.py: Helper file for snake_server.py. It contains the functions to handle the game logic. CourseNana.COM

  3. Screenshot.png: Screenshot of the game display showing at least three players (snakes) in the field. CourseNana.COM

    The screenshot should also show the terminal of one of the clients with exchanged messages printed CourseNana.COM

    on the terminal (similar to figure 1). CourseNana.COM

  4. snake_client.py: Snake game client side CourseNana.COM

Use the snake.py, snake_server.py, and snake_client.py files from the previous assignment as starting code. Modifythesefilesasyouwanttoimplementthefeaturesofthisassignment. CourseNana.COM

Rubric CourseNana.COM

This assignment is out of 50. Marks are distributed as follows: CourseNana.COM

  1. Server can handle multiple client connections concurrently. 5 marks CourseNana.COM

  2. Server manages the game's logic for all clients (the game runs as intended). 10 marks CourseNana.COM

  3. Server receives messages from clients and broadcasts them to all clients. 5 marks CourseNana.COM

  4. Client sends a message to the server when the user presses the assigned hotkey. 5 marks CourseNana.COM

  5. Client encrypts the control inputs and public messages it sends to the server. 5 marks CourseNana.COM

Late submission CourseNana.COM

Late assignments will be accepted for up to two days after the due date, with weekends counting as a single day; the late penalty is 20% of the available marks per day. Lateness is based on the time the assignment is submitted.
Extensions will be granted only by your course instructor. If you have serious medical or compassionate grounds for an extension, you
must take supporting documentation to the Academic Counselling unit of your faculty, who will contact the instructor. CourseNana.COM

Good luck!  CourseNana.COM

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
UWO代写,CS3357A代写,COMPUTER NETWORKING代写,multi-player server-client snake game代写,RSA代写,Python代写,UWO代编,CS3357A代编,COMPUTER NETWORKING代编,multi-player server-client snake game代编,RSA代编,Python代编,UWO代考,CS3357A代考,COMPUTER NETWORKING代考,multi-player server-client snake game代考,RSA代考,Python代考,UWOhelp,CS3357Ahelp,COMPUTER NETWORKINGhelp,multi-player server-client snake gamehelp,RSAhelp,Pythonhelp,UWO作业代写,CS3357A作业代写,COMPUTER NETWORKING作业代写,multi-player server-client snake game作业代写,RSA作业代写,Python作业代写,UWO编程代写,CS3357A编程代写,COMPUTER NETWORKING编程代写,multi-player server-client snake game编程代写,RSA编程代写,Python编程代写,UWOprogramming help,CS3357Aprogramming help,COMPUTER NETWORKINGprogramming help,multi-player server-client snake gameprogramming help,RSAprogramming help,Pythonprogramming help,UWOassignment help,CS3357Aassignment help,COMPUTER NETWORKINGassignment help,multi-player server-client snake gameassignment help,RSAassignment help,Pythonassignment help,UWOsolution,CS3357Asolution,COMPUTER NETWORKINGsolution,multi-player server-client snake gamesolution,RSAsolution,Pythonsolution,