43 lines
1.2 KiB
Markdown
43 lines
1.2 KiB
Markdown
# TicTacToe Project
|
|
|
|
This project contains a TCP Game Server, a Java Swing Client, and a Spring Boot Web Client.
|
|
|
|
## Structure
|
|
|
|
- `server/`: Java TCP Server (Port 1870). With Anticheat (Server-side validation).
|
|
- `client/`: Standalone Java Swing Client. Connects to `dokploy.lona-development.org:1870`.
|
|
- `web-client/`: Spring Boot Web Application. Acts as a proxy to the TCP Server via WebSocket.
|
|
|
|
## Running with Docker Compose
|
|
|
|
To start the Server and Web Client:
|
|
|
|
```bash
|
|
docker-compose up --build
|
|
```
|
|
|
|
- **Server** runs on port `1870`.
|
|
- **Web Client** runs on `http://localhost:8080`.
|
|
|
|
## Building the Java Client
|
|
|
|
To build the standalone Java client:
|
|
|
|
```bash
|
|
./build_client.sh
|
|
```
|
|
|
|
To run it:
|
|
|
|
```bash
|
|
java -jar client/target/client-1.0-SNAPSHOT.jar
|
|
```
|
|
|
|
**Note:** The Java client is hardcoded to connect to `dokploy.lona-development.org`. Ensure this domain resolves to your server IP (or adds `127.0.0.1 dokploy.lona-development.org` to `/etc/hosts` for local testing).
|
|
|
|
## Game Protocol
|
|
|
|
- **CREATE**: Starts a new game. Server returns a 6-character code.
|
|
- **JOIN <CODE>**: Joins an existing game.
|
|
- **MOVE <ROW> <COL>**: Places your symbol.
|
|
- **SURRENDER**: Forfeits the game.
|