GithubHelp home page GithubHelp logo

game_chess's Introduction

game_chess

stability-experimental desktop web beta

Desktop Prerequisites

The project uses utility cargo-make. To install it run:

cargo install cargo-make

To build Bevy on Linux the libraries libuv and libalsa are required. To install it run:

sudo apt install libudev-dev libalsa-ocaml-dev

The project uses module Egui and plugin bevy_egui. To compile the modules on Linux install xcb:

sudo apt install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev

The project uses protobuff to implement multiplayer. To install it:

  • Linux:
sudo apt install protobuf-compiler
  • MacOS:
brew install protobuf
  • Pre-compiled binaries (any OS):
  1. Load from here for your system. File which you need is protoc-<version>-<sys-name>.zip
  2. Unzip to some folder
  3. Add the path to this folder to your system environment variable Path. The path should look like this: <your_path>/protoc/bin

How to run on Desktop

To run desktop target execute:

cargo run

How to develop

Before cloning the repository please make a fork on Github to been able to open pull requests. Please open pull request into the branch alpha.

Platforms

Supported platforms:

To run the project on default platform execute:

cargo run

Frequently Asked Questions

Take a look at FAQ page.

game_chess's People

Contributors

26letterz avatar al-mehedi avatar artemhlezin avatar barsik-sus avatar dmvict avatar drooxie avatar energycsdx avatar epsylon42 avatar ihor-tarasov avatar kradenkov avatar mvlabat avatar nastyavicodin avatar olgzzz avatar qarux avatar sinnrrr avatar supremist avatar thebesttvarynka avatar twentyone212121 avatar vmihdal avatar wandalen avatar wtools-bot avatar zero-gear avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

game_chess's Issues

Messaging

Task consists of next steps:

  • Design messaging interface for the message.
  • Implement messaging API on the server.
  • Implement messagin API on the client.
  • Implement command .online.msg to send message to opponent.
  • Spectator should be able to send a message if #59 feature is implemented.

Messaging API consists of two methods:

  • push_msg
  • read_msgs

Basic requirements:

  • The implementation of game should be independent of implementation of Chat.
  • No new structures that contains different instances of game structures.
  • Chats should be added to the separate vector.
  • To push or pull message request should query the chat from vector of chats by ID. ID should be identical to ID of game.
  • Basic implementation should use no streams.
  • Advanced implementation adds streams.

List saved games

Task consists of next steps:

  • Implement routine to read persistent with game files.
  • Implement command .games.list.

Highlight legal moves

Depends on issues:

Task consists of next steps:

  • Extend the systems implemented in #45 to highlight the legal moves for the selected piece.
  • Piece selection should be triggered by a click.

Optional:

  • The selected cell and legal moves should have different colors.

The next samples can be helpful:

Useful links:

Ability to move pieces in multiplayer

Task consists of next steps:

  • Implement server API methods:
    • push_move
    • pull_board_state
  • Implement command .online.move - apply move.
  • Add auto-updating of the game.

Implement sound system

Task consists of next steps:

  • Extend setup system to load sound assets.
  • Put you audio files into directory assets/sound in the root of module game.
  • Implement events handling in the module.

Feature:

  • Sound for move.
  • Sound for draw.
  • Sound for lose/win.

The next samples can be helpful:

Useful links:

Web target working

Complexity : high

Make it possible to build the game for web.
Some preliminary work already have been done.

Github CD script for web is currently off. To switch it on uncomment this lines.

Print history

Task consists of next steps:

  • Implement method to print moves history.
  • Implement command .moves.history. Command prints the history of steps. Command accepts no arguments.

After closing the issue, consider closing related task #36.

Implement game with a AI

Task consists of next steps:

  • Implement routine to create the new game with AI.
  • Implement command .new.ai.

Command .new.ai creates a game where moves of the second player are generated by a PC.

Multiplayer games list

Task consists of next steps:

  • Implement basic servers side game API.
    • push_game_create
    • push_game_accept
    • pull_games_list
  • Implement commands:
    • .online.new - create new online game and share it.
    • .online.join - join some shared game as a gamer.

The next samples can be helpful:

Useful links:

'cargo make' error: failed to parse manifest

Dear game_chess maintainers, hi @Wandalen,

Thanks for game_chess; it looks very useful to be. Can you imagine how disappointed I was when I could not get it to run :-) ?

I simply followed the instructions in the README, so after cloning this repo and installing the deb packages, I did:

cargo make

This resulted in:

(base) richel@N141CU:~/GitHubs/game_chess$ cargo make
[cargo-make] INFO - cargo make 0.35.6
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: default
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Execute Command: "cargo" "run" "--manifest-path" "/home/richel/GitHubs/game_chess/module/game/platform/desktop/../../Cargo.toml" "--bin" "desktop"
error: failed to parse manifest at `/home/richel/GitHubs/game_chess/module/game/Cargo.toml`

Caused by:
  feature `edition2021` is required

  consider adding `cargo-features = ["edition2021"]` to the manifest
[cargo-make] ERROR - Error while executing command, exit code: 101
[cargo-make] WARN - Build Failed.

I followed the advince and modified Cargo.toml to this:

(base) richel@N141CU:~/GitHubs/game_chess$ cat Cargo.toml 
cargo-features = [
  "edition2021",
  "named-profiles", # custom named profile
#  "build-std", # rebuild srd
#  "strip", # strip either symbols or debuginfo
#  "weak-dep-features", # ability to use dep_name?/feat_name syntax
]

# [other things]

Then cargo make again, however, resulting in the same error:

(base) richel@N141CU:~/GitHubs/game_chess$ cargo make
[cargo-make] INFO - cargo make 0.35.6
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: default
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Execute Command: "cargo" "run" "--manifest-path" "/home/richel/GitHubs/game_chess/module/game/platform/desktop/../../Cargo.toml" "--bin" "desktop"
error: failed to parse manifest at `/home/richel/GitHubs/game_chess/module/game/Cargo.toml`

Caused by:
  feature `edition2021` is required

  consider adding `cargo-features = ["edition2021"]` to the manifest
[cargo-make] ERROR - Error while executing command, exit code: 101
[cargo-make] WARN - Build Failed.

As a rustling, I assume the problem is at my side or how to fix it. I know that it has been a long time since a build has been tested on GitHub Actions, so I cannot conclude that game_chess builds in one way or the other either.

Is game_chess in a cargo make-able state? If no, how can I fix the problem from my side?

Below are my specs.

Thanks for your help and cheers, Richel Bilderbeek

Specs

  • Ubuntu 20.04 LTS with updated packages
(base) richel@N141CU:~/GitHubs/game_chess$ rustup --version
rustup 1.24.3 (ce5817a94 2021-05-31)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.57.0 (f1edd0429 2021-11-29)`
(base) richel@N141CU:~/GitHubs/game_chess$ cargo version
cargo 1.53.0

Declare the forfeit

Task consists of next steps:

  • Implement routine that allows user to declare the forfeit ( leave the game losing game ).
  • Implement command .gg ( good game ).
  • Bind routine to gui gg feature if #56 is implemented.
  • Extend enum GameStatus adding variant gg.

Features of command:

  • If user plays with the computer, then routine close the game.
  • If user plays with another user, then routine prints to the opponent about declared forfeit and prints that opponent wins.

Store list of games on the server

The task is to implement an in-memory game store.

In our app architecture, every game store implements the GameStore trait ( see src/store/mod.rs ). For now, we decide you use an in-memory store. It means that we save all games in memory (RAM. Just in a vector of the Games).

The file with main code: src/store/memory.rs.

Task consists of next steps:

  • Implement method add_game. The method saves game into container.
  • Implement method get_game. The method iterates over container and gets the game by string id.
  • Implement method get_games. The method returns reference to own container.
  • Implement method update_game. The method find a game by the id and replace data from source game.

List of available moves

Task consists of next steps:

  • Implement routine that returns list of legal moves for a current player.
  • Implement command .moves.list. Command prints the list of steps.

The next samples can be helpful:

Make a random move

Depends on issues :

Task consists of next steps:

  • Use a routine from #31 to generate list of available steps.
  • Get random move from list and apply it to the game.
  • Implement command .move.random.

Board margins

Tweak the camera to get expected results.

Task consists of next steps:

  • Investigate how to work the camera projection.
  • Add offsets in the camera projection.
  • Implement system that draws margins around board.
  • Add system to the Bevy main app.

Feature:

  • Board should not go outside window neither touch edges of window.
  • To avoid that introduce parameter during drawing, number of cells for gap between board and window edge.

image

The next samples can be helpful:

Improve board output

Complexity : mid

Task consists of next steps:

  • Extend Board.print() method to draw ranks and files, similar to:
8 | 56 57 58 59 60 61 62 63
7 | 48 49 50 51 52 53 54 55
6 | 40 41 42 43 44 45 46 47
5 | 32 33 34 35 36 37 38 39
4 | 24 25 26 27 28 29 30 31
3 | 16 17 18 19 20 21 22 23
2 | 8  9  10 11 12 13 14 15
1 | 0  1  2  3  4  5  6  7
  -------------------------
     a  b  c  d  e  f  g  h

Note. The numbers 0-63 will be replaced by board output.

The next samples can be helpful:

Dead games cleaning

Task consists of next steps:

  • Extend structures that implements multiplayer game and move by field with timestamp of creation ( structures Game and GameMove ).
  • Implement routine to remove inactive game. Consider to setup default inactive time near 1h.
  • Setup server to run routine periodically.

Prompt for quit

Complexity : mid

Task consists of next steps:

  • Implement routine that asks the confirmation of quit.
  • Extend interface of command .quit.

CRITICAL : Serialization / Deserialization of Game

Complexity : mid

Task consists of next steps:

  • Choose the data format ( consider FEN format and JSON for online )
  • Implement routine/trait to serialize game state.
  • Implement routine/trait to deserialize saved data.

Turns ( moves ) in graphics

Task consists of next steps:

  • Implement system that handle mouse events on the board.
    • Click.
    • Move.
  • Implement logic for operations with pieces ( except highlighting ).

Feature:

  • The interface should use common API with the CLI interface to make moves.

The next samples can be helpful:

Pause / resume the game

Depends on issue:

Task consists of next steps:

  • Add method to pause the user timer.
  • Implement command .pause.
  • Add method to resume the user timer.
  • Implement command `.resume.
  • Command .move should auto-resume game. Also, command .move switches the timers.

Timer

Task consists of next steps:

  • Implement structure of the timer for the gamer.
  • Register the timer in the game.
  • Design interface to switch the timers for players.
  • Update interface of command .status, add info about timer in the command output.
  • Extend cammand .game.new to setup timer. Consider one variant for input format of settings :
    • string from prompt
    • list of predefined settings.
  • Implement routine that produce settings for timer taking into account chosen input format. Introduce some default timer settings.
  • Bind GUI to core implementation of timer if feature if #55 is implemented.

After closing the issue, consider closing related task #34.

GUI for playing

Task consists of next steps:

  • Implement system with HUD GUI interface drawing.

Feature:

  • Undo move.
  • To main menu.
  • You can propose the elements of menu and implement the feature If it will be accepted.
  • GG ( good game, see #37 ). Bind gg feature to routine from #37 if it is implemented.

No animation is required.

The next samples can be helpful:

Useful links:

Undo the last move

Depends on issues:

Task consists of next steps:

  • Implement the method that takes the moves history and turn the game to previous state.
  • Implement command .move.undo.

Implement GUI for main menu

Task consists of next steps:

  • Investigate the game shared resources and check access to it ( colors, sound ).
  • Implement system with GUI interface drawing.
  • Bind menu to corresponding features if them are implemented.

Note. The GUI can have a form whatever you want. Maybe, simplest way is to use static side panel ( sample with static panel ). The game board should be locked.

Feature:

  • Button for start new game.
  • Button for start new game with AI.
  • Button for multiplayer.
  • GUI for options ( color schema, sound on/off ).
  • Button for quit.

The next samples can be helpful:

Useful links:

Load game from FEN

Task consists of next steps:

  • Implement routine that reads game file and deserialize it into strict structure of Game. Take into account that game can contain only FEN string ( #50 ) without history.
  • Implement routine to transform FEN string into chess board.
  • Implement command .game.from.fen. Command argument - FEN string

Save game

Complexity : mid

Task consists of next steps:

  • Implement interface to transform chess board state to FEN string.
  • Implement routine to save file. Note: each file should have unique ID that will be recognizable by user.
  • Implement command .game.save.
  • Extend interface of command .quit. Ask to save game.

After closing the issue, consider closing related task to list games and load a game

CRITICAL : Draw chess board

Complexity : mid

Task consists of next steps:

  • Setup the scene with 2d camera.
  • Add UI camera.
  • Add color resources ( for black and white cells ).
  • Add routine to draw 64 cell-sprites to form the board. For positioning use structure PieceLocations.
  • Setup Bevy application with setup stage and default plugins.

The next samples can be helpful:

After closing the issue, consider closing related task

Time bonuses

Depends on issue:

Task consists of next steps:

  • Extend structure of timer to save time bonuses ( if it is not implemented ).
  • Extend method that counts time to apply time bonuses.

Features of timer:

  • Each player have timer.
  • A time bonus should be applied to timer per each move ( for example 20s ).

The format of the timer time and time bonuses looks like the image below:

image

The format explanation: first number is the total time in minutes, the second number is bonus time in seconds.

For example: user set total time to 10 mins. The bonus time will be 50 s. First move user done after 10 s, the timer in moment just after move is : 10m - 10s + 50s = 10m 40s.

After closing the issue, consider closing related task #34.

Load saved game

Depends on issues:

Task consists of next steps:

  • Implement routine that reads game file.
  • Use routine from #26 to load game.
  • Implement command .game.open.

Game spectacles

Task consists of next steps:

  • Implement routine that watches the game.
  • Implement command .online.spectacle.
  • Spectator should be able to send a message if #60 feature is implemented.

Save history

Task consists of next steps:

  • Investigate structure for history saving.
  • Attach time stamp to each move.
  • Extend methods that save and load game to save and load game with history.

After closing the issue, consider closing related task #36.

Add aliases for commands

Complexity : low

Extend CLI module to introduce aliases for commands:

  • .s -> .status
  • .m -> .move

Change CLI main file to add new command aliases.

Also, you can propose new command aliases and if it will be approved, then add it to CLI.

Board zooming

Task consists of next steps:

  • Extend camera to apply zoom.
  • Add handle for mouse scrolling to change zoom.

To reach the goal consider using:

  • add_system_set_to_stage()
  • Res<Windows>
  • Query

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.