Coder Social home page Coder Social logo

chess2's Introduction

Chess Chase

Chess-Chase is a multi-player real time strategy game based on the classic game of Chess.

Installing

Installing on macOS and Windows

Download the app from the releases page

Other platforms

  • Install Python (version 3.3 or above)
  • In your terminal:
  • python3 -m pip install kivy --pre --extra-index-url https://kivy.org/downloads/simple/
  • python3 -m pip install pystun3
  • To run the game type python3 main.py from the game's folder

Playing

Chess Chase is played vs friends over the network.

  • Both players need to open the game
  • At the top of each player an address such as "BASK DAWN ALAN" will appear
  • Such an address can be sent over to the other player via any chat platform
  • The other player should type the address to connect

Internals

Networking setup

  • During the game its communication is direct peer to peer over UDP (for minimum latency a la RTS games like Starcraft)
  • To establish a UDP connection the peers first need to find their external ip address and port, which they do using a STUN service
  • To connect without each typing the other's address, they connect to the matching server over HTTP which assigns each player a three word identifier
  • When the identifier is entered the game asks the server for the address it represents
  • The host also polls the server until a connection is established, and the server tells it the ip address and port of the other player
  • Then both players send UDP packets to each other and in such scenario Routers/NAT allow the communication to happen

Building

Building a macOS app

python3 setup.py py2app

# Remove unneeded resources to reduce app size
cd dist
rm Chess\ Chase.app/Contents/Frameworks/lib*.dylib
rm -rf Chess\ Chase.app/Contents/Resources/lib/{tcl,tk}*
rm -r Chess\ Chase.app/Contents/Resources/lib/python3.8/numpy

# Sign and notarize (One needs to join the apple paid developer program for this)
codesign --timestamp -s "Developer ID Application: <YOUR-SIGNING-ID>" -f --deep Chess\ Chase.app
zip -r "chesschase-mac.zip" "Chess Chase.app"
xcrun altool -u <APPLE-ID-EMAIL> -p <APP-SPECIFIC-PASSWORD> --notarize-app --primary-bundle-id org.yairchu.chesschase -f chesschase-mac.zip

To find signing id, run:

security find-identity -v -p codesigning

(this worked for me on macOS 10.14.6 with Python 3.8.2 and kivy v2.0.0rc1)

Building a Windows exe

pip install pyinstaller
pyinstaller -F main.py
copy chess.png dist
copy <PYTHONPATH>\share\sdl2\bin\libpng<VER>.dll dist

Build the iOS app

  • Clone a clean project directory without any build artifacts
  • Copy the stun python module to the project directory
  • Follow the instructions at https://kivy.org/doc/stable/guide/packaging-ios.html and use the clean source directory
  • Tick the "Requires full screen" check-box in Xcode's "General" tab
  • brew install Nonchalant/appicon/appicon
  • Use appicon to generate the icon from a png source and add it in Xcode
  • In chess-chase-Info.plist, add a NSCameraUsageDescription field explaining that the app doesn't use the camera, and it's due to kivy

chess2's People

Contributors

yairchu avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

uri247

chess2's Issues

[macOS] Hang on quit

Test system: MBP 13.3" 2018 / 10.14.6 / #01dcc210
Steps to reproduce:

  1. open dist/Chess 2.app
  2. wait until you have established connection / got code.
  3. From Chess 2 Menu, click Quit (or Cmd+Q).

Expected:
App should quit

Actual:
App stuck, not responding requiring force quit.

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.