TicTacToe-Multiplatform

A TicTacToe game Tomcat server with Web and Swing clients that serves as an educational tool for those who want to set up a Tomcat server that manages a session among two or more players.

Setup

Web: Open the project in IntelliJ Ultimate, select a Java 1.8 SDK as the project is not compatible with higher versions, then delete .template from the SENSITIVE_DATA.txt.template file, add your database credentials and deploy. Contact me if you want some demo database credentials. Tomcat, Jersey and the JDBC Driver are already provided in the lib folder.

Swing: Open the project in IntelliJ (any edition) and run. Jersey is already provided in the lib folder.

Screenshots

Creating an account and logging in:

1 2

Upon the first player clicking “Enter Lobby”, a new lobby will form and await for a second player to join before assigning this lobby to a “Game Session”. Upon the second player clicking “Enter Lobby”, both players will join a “Game Session” and the lobby will become available for joining again.

3

As the game unfolds, the players will continuously and periodically poll to a flag in the Game Session that checks their availability.

4 5 6

Let’s say that, supposedly, during the game, a player disconnects abruptly, in which case the Game Session will notice the availability flag has not been polled to for some time and will begin the process of ending the session unless the disconnected player promptly reconnects.

7 8