Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sanjarzayniev/iks-nolik

The multiplayer edition Tic-Tac-Toe game, made using Java SWING.
https://github.com/sanjarzayniev/iks-nolik

game java multiplayer-game server-client swing tictactoe

Last synced: 2 days ago
JSON representation

The multiplayer edition Tic-Tac-Toe game, made using Java SWING.

Awesome Lists containing this project

README

        

# **🎲 iks-nolik**



> [!NOTE]
> The multiplayer edition **Tic-Tac-Toe** game, made using Java SWING.
>
> - Sanjar Zayniev

## **💫 Client**

> Author: Sanjar Zayniev

Dependencies:

- Java SWING
- OpenJDK 17.0.8
- OpenJDK Runtime Environment
- OpenJDK 64-Bit Server VM
- Assets like `icons` and `sound` effects

## **🚀 How to Run?**

Using terminal:

```shell
$ java src/Client.java
```

> [!IMPORTANT]
> You should configure your environment. There are many imports from internal modules, you should specify your classpath. Otherwise, it will not run properly. It is better to use some `IDE` which will do it for you.

## **🔓 Login Screen**



Simple, minimalistic. It can handle exceptions:



✅ Successful login:



## **Game frame**



The game will not start until the opponent connects. `X` is the mark of the current player, `Wait...` status text sent by the server and `sanjar` is the name of the current user.

> [!NOTE]
> The server should be started before the client.

> [!TIP]
> You wanna play with your friend, and you are not in the same network? No problem, install `ngrok` or `jprq`, open tunnel. Change server host and port from `Settings.java` and enjoy! (Dragunov).

## **Server**

> Contributor: Abduaziz Ziyodov

Dependencies:

- PostgreSQL (16)
- OpenJDK 17.0.8
- OpenJDK Runtime Environment
- OpenJDK 64-Bit Server VM
- PostgreSQL Driver For Java (`*.jar` file)
- Java SWING

## **🚀 How to Run?**

Using terminal:

```shell
$ java src/Server.java
```

If Postgres driver does not exist on your Java classpath, you should specify it:

```shell
$ java -cp lib/postgresql-42.7.0.jar src/Server.java
```

TCP(not UDP) server is running on host `localhost` and port `2121`:



> [!TIP]
> Instead of running `Client.java`, you can use tools like `netcat` or `telnet`. But you will not have a beautiful `GUI`.

If a client connects:



> [!IMPORTANT]
> If the game ends, you need to restart both `Server.java` and `Client.java`.

> [!NOTE]
> Server will control the entire game, GUI should handle and represent it. There are several types of server-side events to control the game:
* `wait` - blocks client interaction with GUI.
* `your_move` - unblocks a client.
* `your_mark` - after successful login, the server will send the client's mark (X or O).
* `opponent_moved` - event for synchronizing current players board with opponent's.
* `valid_move` and `invalid_move` - status of last move.
* `victory` and `defeat` - each of the clients will get their own (e.g. if (1) gets `victory`, (2) should get `defeat`).
* `draw` - friendship.