- 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
librarypip install colorama
-
all the assets are provided in the
chessAssets
directory
-
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
chessAssets/
|
chessEngine/
|-- assets/
| |-- army/
| |-- chessboard.py
| |-- logger.py
| |-- pieces.py
|-- main.py
|
chessServer/
-
Install the
python3-venv
sudo apt install python3-venv
-
Create the virtual env.
python3 -m venv myenv
-
Activate the env.
source myenv/bin/activate
note: to deactivate type deactivate
in terminal
- install the module
pip install pyinstaller
- run the command
pyinstaller --onefile --icon=chessEngine/icon.ico --add-data "chessAssets;chessAssets" --hidden-import socketio --hidden-import colorama --name=chess chessEngine/main.py
- run the final output
./dist/chess
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"))