TicNet is a multiplayer Tic-Tac-Toe game server built in Java. It allows players to connect to a server, create game rooms, join existing ones, and play Tic-Tac-Toe against each other. The server handles multiple connections concurrently using threading and provides real-time game interaction.
- Player Connections: Supports multiple players connecting simultaneously.
- Game Rooms: Allows players to create and join Tic-Tac-Toe game rooms.
- Real-Time Gameplay: Players can make moves and interact in real-time.
- Logging: Logs key actions and events for monitoring the server's status.
- Java 8 or later
- Gradle (for building the project)
git clone https://github.com/om1cael/TicNet.git
cd TicNetTo build the project, run the following Maven command:
./gradlew buildTo start TicNet, use the following command:
./gradlew runThe server will start on port 1024 by default. You can configure the port and thread settings by modifying the Main class.
Players can connect to the server using any compatible client. The server will listen on port 1024 by default. Once connected, players can join or create game rooms to start playing.
The entry point for the TicNet server. It handles the initialization of the server socket, managing player connections, and creating threads to handle client communication.
Manages the creation, joining, and deletion of game rooms. It keeps track of active games and players involved in each game.
Represents a player on the server. This class handles communication with the client, reads player commands, and processes actions such as creating rooms, joining rooms, and making moves in the game.
- create-room: Creates a new game room.
- join-room : Joins an existing game room.
- make-move : Handles a player's move in the game.
The server sends a lot of "responses" to the client, just like HTTP. Varying from ID to game updates (like board moves), they are sent in JSON and the client must update their front-end based on those. All of the responses can be found within the response package, along with their models.
Example (board update response):
{
"code": "BR_600",
"symbol": "x",
"row": 1,
"column": 2
}
Note
The server sends a response with the player's ID upon connection. This can be found on the Player class.
Contributions are welcome! If you'd like to contribute, please fork the repository, create a new branch, and submit a pull request with your changes.
This project is licensed under the MIT License - see the LICENSE file for details.