Assignment 2: Peer-to-Peer Four-player Pong
In this assignment, you are to implement a four-player Pong game in Java using peer-to-peer architecture. Pay attention to improving the consistency of the game, make the game playable in the presense of network delay and jitter, and how (if at all) cheating can be detected.
Due Date:12 November, 2007 (5 weeks)
- Source code
- A 5-page report (single spacing, 11 point font) detailing your implementation. You should justify the techniques you choose to use in your implementation
- A demo and presentation (13 November 2007)
You should do this assignment in a team of 1-2 person with the same team from Assignment 1. If you work solo in Assignment 1, you may look for a partner (who work solo in Assignment 1 too) and work together for Assignment 2.
- Correctness (50%) -- correct implementation of what you claimed, use the right choice of properly justified techniques.
- Achivement (20%) -- amount of work done, novel techniques used, effort in UI improvements etc.
- Source code (5%) -- well structured, properly formatted and documented
- Report (10%) -- well structured and well written.
- Demo/Presentation (15%) -- explain clearly, able to answer questions etc.
In this assignment, you are to modify your client/server-based 2-player Pong game as follows:
- Use a peer-to-peer architecture for communication. You should use a server only to register the players initially and for the players to rendezvous with each other, but the server must not be involved in state maintainence of paddle and balls, in making any game decisions, and in forwarding and ordering of update messages.
- Extend it to four players. The paddles of the players will be positioned at the top, bottom, left, and right of the game area.
- When delaying messages, your code should introduce variation to delay. If the specified average delay value is d, then your code should pick a delay randomly and uniformly from [d-v, d+v], where v is the variation. Your client (or peer) program should take in, as command line argument, the average delay value to each of the other three players and the maximum variation in delay (the maximum variation to all three players is the same).
- For testing purposes, your client should have the option to be controlled by bot. Your client should take in, as command line argument, a value "1" or "0" to indicate if the client's paddle should be ran by human (1) or bot (0). If your paddle is to be controlled by bot, your program should include the necessary code to move the paddle by itself based on the position of the ball. This feature is for convinience in testing. Your design should always assume that the paddle is controlled by human. The bot is also useful if you want to demonstrate a specific type of cheating and how you can detect such cheats.
It is important to justify the techniques that you choose. For example, if you want to sacrifice responsiveness in favour of cheat-proving your game, you should explain that in your report.
You are encouraged to discuss your approach with the instructor or among yourselves on the IVLE forum.
You may improve upon the game as you see fit (for example, fancy UI, sound effect, visualization of the states at the server). If you need to change the rules of Pong game, however, you need to ask for permission from instructor (This is to prevent, say, you make the game into turn-based Pong game).