Multiplayer Pong

For this project I, along with two other classmates, programmed a multiplayer pong game. The game was completely programmed in JavaScript and HTML, meaning that it is playable in any web browser. Here was what was required of us for the client and server:

  • Client

    • Include text fields for the users to specify server IP address, port, and game ID

    • Implement scoreboard which shows the IDs and scores of each player

  • Server

    • Record connected player’s ID

    • Incorporate game physics for the ball and paddles

    • Deny service to incoming requests once a game has already started or 4 players have already connected

    • Start the game only when there are more than two players and stop the game if anyone disconnects

    • Implement artificial latency (random, fixed, increasing) and latency estimation

    • Latency mitigation and synchronization between player machines

In addition to the tasks above, we were also asked to record and report the artificial latency. In order to accomplish this I programmed a real-time latency graph so that the players could see the latency on their machine at any given time. This also allowed the team to be able to discern what the latency was while testing and see if the effect on the game was commensurate. The graph also proved to be helpful when implementing and testing our latency mitigation measures. The implementation of this graph can be seen below.

Natural Latency

Natural Latency

Random Latency

Random Latency

Fixed Latency

Fixed Latency

Incremental Latency

Incremental Latency