This assignment should be done in pairs.
This assignment is worth 60 points instead of the normal 30 points.
You will be implementing a first version of the multi-player Gem collector game.
You are required to implement the multi-player avatar and message facilities. You do not need to implement gems or points (except for extra-credit).
Overview.
Your manager decided since social media is all the rage, it might be better to first come out with a web-based 2D avatar chat program.
You can always add gems, lasers, or what not later.
The chat world is an 800x400 2D canvas in which players get to choose a name and an avatar.
They can make their avatar walk around the screen.
They can post a message that is display under their avatar for 5 seconds.
Players stop moving if they run into another player.
You can play my version of the chat version of the game.
You can also play the full game with gems.
Architecture.
The application is designed to be transient with no persistant state once a player closes their browser window.
As such, using a SQL database is overkill.
You should instead use memcached to provide tracking of state that needs to be shared between players.
You should configure a web farm of two servers with both servers running an instance of memcached.
Players will be connected to either web server via an (imaginary) load balancing network appliance.
A player is assumed to only open a single browser tab to the application.
All players are put into the same world.
Requirements:
The canvas should be 800x400 pixels with a border.
Upon first visiting the page, players can observe the other players moving around and chatting.
A player can choose and optional name and must select one of 5+ avatars.
Once an avatar is selected, the user clicks on the canvas to create their avatar at that location.
The new player is forbidden from creating a new avatar on top of an existing one.
Once created, a player can click at different locations on the canvas to move their avatar to that location.
The new target location should be shown to the user (but not other players) via some visual indicator.
The avatar should move to the indicator in an aesthetically pleasing manner and then stop.
If on the way to the indicator, the player collides with another player, the players stops moving.
Collision detection can assume avatars are a circle with a radius equal to one-half the maximum of the avatar height/width.
The optional name of the player should appear about the avatar image.
Once created, the player can type short messages via a text box.
Messages appear in quotes below the avatar image for five seconds and then disappear.
If a new message is issued before five seconds, it replaces the old message.
A current player can delete their avatar by clicking a button. The player should then disappear within 5 seconds for all players of the game.
Movement of other players and their messages should be shown in a timely manner to the player (5+ updates/second).
The application should work in current versions of Chrome and Firefox.
If a player closes their browser, their avatar should disappear within 5 seconds from the viewpoint of other player.
A player is assumed to connect only one time via any particular browser+computer combination.
The game should support as many players as can reasonably fit on the canvas.
The application should be able to run indefinitely without needing manual intervention to prune old data, etc.
Performance should not degrade the longer the application has been up.
Unless completely surrounded by the edge of the world or other players, a player should always be able to move in some direction.
Your source code should be suitably commented to allow future developers to understand what you did.
Submission.
Submit your source programs to the Moodle dropbox.
The Moodle timestamp is the completion time for the assignment.
I will be testing your program using both Chrome and Firefox browsers.
I will test by connecting to one or both of your two configured network lab computers.