PlatformWin32 LanguageJava/JavaCC GraphicsJava Swing
Tic-Tac-Toe is a distributed multiplayer game built on a client/server architecture. The choice of the game itself was purposely kept simple, in order to focus on the client/server design. The client GUI consists of two main components, a game room with integrated chat functionality, where the player first arrives and can meet with other players to arrange a game, and a separate game board for playing the tic-tac-toe game itself, which also includes a private chat area. The game incorporates the use of threads and sockets, and was designed using OOP and design patterns.
When the client is launched, the user first enters the game room where they are required to enter a name. The player's name is then displayed in the current list of players online. In addition to the player list, the game room displays a list of all games that are currently in progress. A new player can use the chat room and game launcher functions to invite any player on the list to play a game of tic-tac-toe. If the opponent accepts the invitation a separate game board is launched and the game begins. The game board provides a private chat area just for the players and allows a player to ask for a rematch once the game is complete. There is no limit to the amount of games a player can participate in at the same time.
I programmed the game logic using Java. The client GUI was created using a text editor and Java Swing. The communication protocol used between the client and server is a text based message passing system. Both the client and the server have dedicated parsers, which I created using JavaCC, that are attached to the socket and interpret incoming and outgoing messages. The parsers run on independent threads and constantly wait to receive and handle messages.
The server contains a game manager which maintains the game state for every player and every game being played. It validates moves, tracks turns, and declares the winner of the game. The server also acts as the communication bridge between players. It routes chat messages and game invitations to the appropriate players.