[go: nahoru, domu]

Skip to content

A GUI-based LAN game application for Rock Paper Scissors, featuring user profiles, chat functionality, and customizable settings. Each instance is standalone and can function as both a server and client.

License

Notifications You must be signed in to change notification settings

LukeWait/rps-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rock Paper Scissors LAN App

Description

The Rock Paper Scissors LAN App is an interactive GUI tool that allows users to connect over a local area network (LAN) to play Rock Paper Scissors and communicate via text messages.

App Screenshot

Table of Contents

Installation

Executable

Windows

  1. Download the latest Windows release from the releases page.
  2. Extract the contents to a desired location.
  3. Run the RPSApp.exe file.

Linux

  1. Download the latest Linux release from the releases page.
  2. Extract the contents to a desired location.
  3. Make the RPSApp file executable by running the following command in the terminal:
    chmod +x RPSApp
  4. Run the RPSApp file by navigating to the directory in the terminal and executing:
    ./RPSApp

From Source

To install and run the application from source:

  1. Clone the repository:

    git clone https://github.com/LukeWait/rps-app.git
    cd rps-app
  2. (Optional) Create and activate a virtual environment:

    • Windows:
      python -m venv rps_app_venv
      rps_app_venv\Scripts\activate
    • Linux:
      python3 -m venv rps_app_venv
      source rps_app_venv/bin/activate
  3. Install the dependencies:

    • Windows:
      pip install -r requirements.txt
    • Linux:
      sudo apt-get install python3-gi
      sudo apt-get install python3-gi-cairo gir1.2-gtk-3.0
      sudo apt-get install libcairo2-dev
      sudo apt install libgirepository1.0-dev
      pip install pygobject==3.42.2
      pip install -r requirements.txt
  4. Run the application:

    • Windows:
      python src\rps_app.py
    • Linux:
      python src/rps_app.py

Usage

After running the application, you can log in with your username and password or create a new account. Once connected to the network, you can challenge other users to a game of Rock Paper Scissors and chat with them using the built-in messaging system.

  • Add New User: When playing for the first time you will need to create a profile. Click the Add New User button on the login page. Choose an avatar, username and password. Note: Passwords must contain at least 8 characters, 1 number, and 1 symbol. User information, including hashed passwords, is stored in a plain text file (user_data.txt) with the system files:
    • Windows:
      C:\Users\<YourUsername>\AppData\Roaming\rps-app\user_data.txt
    • Linux:
      /home/<YourUsername>/.local/share/rps-app/user_data.txt

New User Screenshot

  • Hosting A Game: From the Host tab you can choose to host a game that others can connect to. You can also select the number of rounds to be played.

Hosting Screenshot

  • Joining A Game: From the Join tab you can search for anyone waiting to host a session on the network.

Joining Screenshot

  • Playing A Game: Once you're connected to another player, the connection status display will update. You can now freely use the text chat feature to communicate. Choose Rock, Paper, and Scissors from the buttons at the top of the output. Once the pre-determined rounds are completed, you will be disconnected.

Playing Screenshot

  • Disconnecting: To stop a current network connection, click on the green network icon in the bottom right corner. Note: disconnecting mid-game will result in forfeiting the remaining rounds.

  • Changing User & Exiting: To log out or exit the application, click on the profile icon in the top left corner. Note: disconnecting mid-game will result in forfeiting the remaining rounds.

  • Settings: From the Settings tab you can choose to turn on/off audio options and select network ports.

Development

Building Executables with PyInstaller

Windows

Run the following command from the project main directory:

pyinstaller --onefile --add-data "assets/images:assets/images" --add-data "assets/fonts:assets/fonts" --add-data "assets/audio:assets/audio" --noconsole src/rps_app.py

Linux

For Linux, you need to create a hook-PIL.py file to handle the PIL library correctly. Follow these steps:

  1. Create a file named hook-PIL.py in the main directory of your project with the following content:
    from PyInstaller.utils.hooks import copy_metadata, collect_submodules
    
    datas = copy_metadata('Pillow')
    hiddenimports = collect_submodules('PIL')
  2. Run the following command from the project main directory:
    pyinstaller --onefile --add-data "assets/images:assets/images" --add-data "assets/fonts:assets/fonts" --add-data "assets/audio:assets/audio" --additional-hooks-dir=. --noconsole src/rps_app.py

This will generate the executable in the dist directory. It will also create a build directory and .spec file. These are used in the build process and can be safely removed.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

Icons used in the app are designed by Freepik - www.freepik.com.

Fonts used in the app are open source Google Fonts.

Source Code

The source code for this project can be found in the GitHub repository: https://github.com/LukeWait/rps-app.

Dependencies

For those building from source, the dependencies listed in requirements.txt are:

  • customtkinter==5.2.1
  • CTkMessagebox==2.5
  • CTkListbox==0.10
  • CTkToolTip==0.8
  • Pillow==10.1.0
  • gTTS==2.4.0
  • playsound==1.2.2

About

A GUI-based LAN game application for Rock Paper Scissors, featuring user profiles, chat functionality, and customizable settings. Each instance is standalone and can function as both a server and client.

Topics

Resources

License

Stars

Watchers

Forks

Languages