Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: online multiplayer #119

Merged
merged 42 commits into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
32c95c9
wip
thomas-mauran Nov 26, 2024
d5559ed
refactor: use enum for popups
thomas-mauran Nov 26, 2024
25006e5
wip: tokio
thomas-mauran Nov 26, 2024
92e195f
wip: tokio errors
thomas-mauran Nov 26, 2024
6cac14f
wip
thomas-mauran Nov 27, 2024
ca652a8
test
thomas-mauran Nov 27, 2024
c05db4d
feat: stream in game
thomas-mauran Nov 28, 2024
2b9a433
wip
thomas-mauran Nov 28, 2024
3b493ed
wip
thomas-mauran Nov 29, 2024
50af95b
refactor: use std instead of tokio
thomas-mauran Nov 30, 2024
3e2f126
feat: tcp connexion working with move
thomas-mauran Nov 30, 2024
43a253e
feat: game full
thomas-mauran Nov 30, 2024
db18cd4
refactor: improve logic
thomas-mauran Dec 1, 2024
6e84761
wip
thomas-mauran Dec 1, 2024
f74a7d1
wip
thomas-mauran Dec 2, 2024
f4e19aa
fix: turn of the board
thomas-mauran Dec 3, 2024
736bc7b
fix: board last_move_render
thomas-mauran Dec 7, 2024
9a932f3
feat: waiting for other player to start the game
thomas-mauran Dec 8, 2024
cb5ff87
fix: move_history and board last move ui
thomas-mauran Dec 9, 2024
b1e1358
fix: promotion for multiplayer and bot
thomas-mauran Dec 9, 2024
a908e2a
feat: handle end for multiplayer
thomas-mauran Dec 9, 2024
029f4a6
fix: draw exit and shutdown when player quits
thomas-mauran Dec 9, 2024
a41c882
feat: handle game stop and closing the server
thomas-mauran Dec 10, 2024
b49d766
fix: back to normal board
thomas-mauran Dec 11, 2024
1e41fc8
fix: network
thomas-mauran Dec 11, 2024
e7657d4
feat: show host ip
thomas-mauran Dec 11, 2024
201b2b4
fix: piece move
thomas-mauran Dec 14, 2024
1b5ea27
fix: promotion with mouse
thomas-mauran Dec 14, 2024
5d6428b
refactor: let user choose the port when joining
thomas-mauran Dec 14, 2024
97f7bb0
docs: add doc for multi
thomas-mauran Dec 14, 2024
0e90429
chore: small fix and upgrade to uci 0.21
thomas-mauran Dec 14, 2024
167b31c
chore: fmt
thomas-mauran Dec 14, 2024
985d552
refactor: player is now opponent to make it easier
thomas-mauran Dec 14, 2024
1957b8e
fix: add panick hook
thomas-mauran Dec 14, 2024
caafc9d
refactor: split select_cell
thomas-mauran Dec 14, 2024
6f5c6df
docs: render videos
thomas-mauran Dec 15, 2024
ce53287
docs: update classes
thomas-mauran Dec 15, 2024
de23de2
docs: update and fix bug
thomas-mauran Dec 15, 2024
53221de
docs: minor
thomas-mauran Dec 15, 2024
775981a
Merge branch 'main' into feat/2-players
thomas-mauran Dec 15, 2024
10c3569
chore: lint
thomas-mauran Dec 15, 2024
618bdd8
chore: lint
thomas-mauran Dec 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 47 additions & 40 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repository = "https://github.com/thomas-mauran/chess-tui"
clap = { version = "4.4.11", features = ["derive"] }
dirs = "5.0.1"
ratatui = "0.28.1"
uci = "0.2.0"
uci = "0.2.1"
toml = "0.5.8"

[features]
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">
<h1>chess-tui</h1>
A chess TUI implementation in rust 🦀
A rusty chess game in your terminal 🦀

![board](./examples/play_against_white_bot.gif)

Expand All @@ -10,6 +10,10 @@ A chess TUI implementation in rust 🦀
</div>
</div>

### Description

Chess-tui is a simple chess game you can play from your terminal. It supports local 2 players mode, online multiplayer and playing against any UCI compatible chess engine.

### Quick install

```bash
Expand All @@ -30,7 +34,11 @@ If you want to install the game with your favorite package manager, you can find
</details>
<details>
<summary>Local 2 player mode</summary>
<img src="./examples/demo.gif" alt="Helper menu" />
<img src="./examples/demo.gif" alt="Local 2 players" />
</details>
<details>
<summary>Online multiplayer</summary>
<img src="./website/static/gif/multiplayer.gif" alt="Online multiplayer" />
</details>
<details>
<summary>Draws</summary>
Expand Down
Binary file modified examples/demo-two-player.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
73 changes: 37 additions & 36 deletions examples/demo-two-player.tape
Original file line number Diff line number Diff line change
Expand Up @@ -15,61 +15,62 @@ Set WindowBarSize 40
Type "cargo run" Sleep 500ms Enter

Sleep 0.5s
Down @0.8s
Down @0.8s
Down @0.8s
Down @0.8s
Down @0.8s
Space @0.8s
Down @0.3s
Down @0.3s
Down @0.3s
Down @0.3s
Down @0.3s
Down @0.3s
Space @0.3s
Sleep 1.5s

Down @0.8s
Down @0.8s
Space @0.8s
Down @0.3s
Down @0.3s
Space @0.3s
Sleep 0.8s
Space @0.8s
Space @0.3s

Sleep 0.8s
Left @0.8s
Space @0.8s
Left @0.3s
Space @0.3s
Sleep 0.8s
Space @0.8s
Space @0.3s

Down @0.8s
Space @0.8s
Down @0.3s
Space @0.3s
Sleep 0.8s
Space @0.8s
Space @0.3s
Sleep 0.8s

Right @0.8s
Right @0.8s
Right @0.8s
Space @0.8s
Right @0.3s
Right @0.3s
Right @0.3s
Space @0.3s
Sleep 0.8s
Space @0.8s
Space @0.3s
Sleep 0.8s

Left @0.8s
Space @0.8s
Left @0.3s
Space @0.3s
Sleep 0.8s
Right @0.8s
Right @0.8s
Space @0.8s
Right @0.3s
Right @0.3s
Space @0.3s
Sleep 0.8s

Up @0.8s
Right @0.8s
Right @0.8s
Space @0.8s
Up @0.3s
Right @0.3s
Right @0.3s
Space @0.3s
Sleep 0.8s
Space @0.8s
Space @0.3s
Sleep 0.8s


Up @0.8s
Up @0.8s
Up @0.8s
Space @0.8s
Up @0.3s
Up @0.3s
Up @0.3s
Space @0.3s
Sleep 0.8s
Space @0.8s
Space @0.3s
Sleep 0.8s
Binary file modified examples/helper.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/helper.tape
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Sleep 2s
Down @0.3s
Down @0.3s
Down @0.3s
Down @0.3s
Space @0.3s
Sleep 1s

Expand Down
Binary file modified examples/play_against_black_bot.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading