1. Homepage
  2. Programming
  3. [2022] COMPSCI 711: Parallel and Distributed Computing - Assignment 2: A multithreaded game server

[2022] COMPSCI 711: Parallel and Distributed Computing - Assignment 2: A multithreaded game server

Engage in a Conversation
The University of AucklandCOMPSCI711Parallel and Distributed Computing

A multithreaded game server

·       Due 27 May by 23:00 CourseNana.COM

·       Points 15 CourseNana.COM

This assignment requires you to design and implement a multithreaded game server suitable for two-player games (such as Backgammon, Checkers, Chess, Go, etc.). The server helps to pair up players and to coordinate the exchange of game moves. It does not know anything about the underlying game itself. CourseNana.COM

The server should be programmed using the C# programming language (Links to an external site.), and needs to be constructed using a synchronous server socket (Links to an external site.) from the ground up. Higher-level APIs (such as HTTPListener (Links to an external site.)) cannot be used. Please ask if in doubt. CourseNana.COM

The server should use HTTP REST as the basis for communication with the game clients. To this end, the following (GET) endpoints are suggested: CourseNana.COM

/register CourseNana.COM

This endpoint generates a random username for a player, registers this name, and returns to the user the registered name. The player is required to pass this username in all subsequent transactions for identification. CourseNana.COM

/pairme?player={username} CourseNana.COM

This endpoint attempts to pair the given player with another player. It returns a game record (or a suitable subset of it). The game record is a tuple containing a game ID, game state, username of the first player, user name of the second player, last move of the first player, and the last move of the second player.
When there is no other player waiting, the game record will contain a newly allocated game ID (which could be a GUID), a game state indicating "wait", and the username of the requesting player as first player. The rest of the elements in the tuple are not defined. When there is a waiting player, the game record will be the game record first created for the waiting player, updated to add the second player and the state indicating "progress". The state "progress" tells both players that the game can now begin.
The endpoint can be invoked by both players as many times as they want before the commencement of the game. This helps the first player to "poll" the state to see if a second player has been paired up.
CourseNana.COM

/mymove?player={username}&id={gameId}&move={move} CourseNana.COM

This endpoint, when used during the game's "progress", will supply the user's move to the server. The "last move" of the player in the corresponding game record will be updated with this supplied move. CourseNana.COM

/theirmove?player={username}&id={gameId} CourseNana.COM

This endpoint, when used during the game's "progress", will collect the other player's move from the server. The game server will supply the "last move" of the other player from the game record corresponding to the given game ID. CourseNana.COM

/quit?player={username}&id={gameId} CourseNana.COM

This endpoint notes to the server the intention of the player to quit the game. The server will remove the game record corresponding to the given game ID. Attempt by the players to access the game record (for example, to get a move) will fail after the record is removed. CourseNana.COM

You may wish to implement other endpoints for diagnostic or informational purposes (e.g., a /debug endpoint or a /version endpoint). You may also wish to implement a /favicon.ico endpoint that supplies to the caller the "favicon" — this is particularly useful for browser-based clients. CourseNana.COM

You need to take appropriate actions when errors are encountered (e.g., invalid endpoints, malformed endpoints, invalid parameters to endpoints, etc.). CourseNana.COM

Typically, a single thread will handle a single player's endpoint interactions. The server, for the sake of efficiency, should keep the connection alive to handle the player's requests in the same thread. However, it is possible that the client may, from time to time, close the connection. For example, a browser will close the connection if it deems the connection inactive for a period of time. The server should be able to gracefully handle this scenario and continue to serve the client (potentially using a new thread). CourseNana.COM

Think about what information is shared among the threads and avoid potential race conditions efficiently using appropriate concurrency controls. You should not persist any of the information, meaning that, the information is kept only in nonpersistent memory and lost if the server is restarted. CourseNana.COM

The server should be a command-line application using .NET 6, and should be runnable with a standard .NET 6 installation (no third-party components are admissible). It should be able support browser-based game clients. CourseNana.COM

Testing CourseNana.COM

You need to come up with an appropriate testing strategy for verifying the correctness of the server. One way to do this could be to build a browser-based client for a chosen two-player game. CourseNana.COM

Report CourseNana.COM

Your submission should include a short report in the IEEE two-column style. The report should discuss the problem, explore alternatives, critically analyse your choices, design (which may include the specification), and implementation, and present an evaluation of your work. The report should include appropriate references. It should also have an appendix outlining what you learnt doing the assignment and any fedback or reflections you may want to share. CourseNana.COM


CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
The University of Auckland代写,代写,COMPSCI711代写,Parallel and Distributed Computing代写,The University of Auckland代编,代编,COMPSCI711代编,Parallel and Distributed Computing代编,The University of Auckland代考,代考,COMPSCI711代考,Parallel and Distributed Computing代考,The University of Aucklandhelp,help,COMPSCI711help,Parallel and Distributed Computinghelp,The University of Auckland作业代写,作业代写,COMPSCI711作业代写,Parallel and Distributed Computing作业代写,The University of Auckland编程代写,编程代写,COMPSCI711编程代写,Parallel and Distributed Computing编程代写,The University of Aucklandprogramming help,programming help,COMPSCI711programming help,Parallel and Distributed Computingprogramming help,The University of Aucklandassignment help,assignment help,COMPSCI711assignment help,Parallel and Distributed Computingassignment help,The University of Aucklandsolution,solution,COMPSCI711solution,Parallel and Distributed Computingsolution,