Skip to content

karanBRAVO/Chess_Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chess_Game v2

  • Create a chess game from 0 -> END #multiplayer
  • Using: Pygame, Python, Node.js, Socket.io

note: make sure you have installed the colorama library before running the script.

  • to install the colorama library

    pip install colorama
  • all the assets are provided in the chessAssets directory

Usage

  • clone the repository

    git clone https://github.com/karanBRAVO/Chess_Game.git
  • move to the cloned directory

    cd Chess_Game
  • move to the chess server directory

    cd chessServer
  • install the dependencies and run the build command

    npm install && npm run build
  • start the server

    npm run start
  • run the game script (you have to run multiple terminals and run below command from the root dir)

    chmod +x main.sh && ./main.sh

Preview of the Game

image

File Structure

chessAssets/
|
chessEngine/
|-- assets/
|   |-- army/
|   |-- chessboard.py
|   |-- logger.py
|   |-- pieces.py
|-- main.py
|
chessServer/

Virtual Environment Setup (recommended)

  1. Install the python3-venv

    sudo apt install python3-venv
  2. Create the virtual env.

    python3 -m venv myenv
  3. Activate the env.

    source myenv/bin/activate

note: to deactivate type deactivate in terminal

Create the desktop application

  1. install the module
pip install pyinstaller
  1. run the command
pyinstaller --onefile --icon=chessEngine/icon.ico --add-data "chessAssets;chessAssets" --hidden-import socketio --hidden-import colorama --name=chess chessEngine/main.py
  1. run the final output
./dist/chess

Note

To fix the path issue while creating the .exe file

import os
import sys


def resource_path(relative_path):
    """ Get the absolute path to a resource, works for development and PyInstaller bundling """
    base_path = getattr(sys, '_MEIPASS', os.path.abspath("."))
    return os.path.join(base_path, relative_path)

# pygame.image.load(resource_path("chessAssets/rook.png"))

©️ Karan Yadav 2023