4-In-A-Row Multiplayer Distributed Game
The purpose of this project was to design and implement a distributed system that runs on three or more nodes. To demonstrate the idea, a simple game ‘4-In-A-Row’ was chosen as the application layer.
The system design consists of identical applications running on different peers; communicating with each other to form a distributed system. Each peer runs the same core program (a java servlet) that renders the GUI on a web browser using a web server. It must be noted that the web server runs locally on every peer just to render the UI on the web page and does not participate in the
inter-peer communication. The peers communicate using a
messaging protocol (designed specifically for this project)
over a UDP data-link layer.
The game logic is rather simple. Each player takes turn to select one of the boxes on the game grid, and the first one to mark four blocks in a row wins. If the grid becomes full without any player succeeding to mark four boxes in a row, the game is tied.