Skip to content

insert-coin/CloudyGameThinClient

Repository files navigation

Build Status

Thin Client

This is an application that the player uses to play the game. The player will read a broadcasted video stream from the game engine, and send the player's keyboard and mouse inputs to the game engine via this application.

Prerequisites for using the Thin Client

You need:

  1. Python 3.5
  2. pygame 1.9.2
  3. numpy 1.8
  4. OpenCV 3.1.0

Ensure that the above dependencies are obtained for Python 3. We use the above mentioned versions during development. Other versions may work, but not guaranteed.

Obtaining and installing dependencies (for Windows)

Python 3.5

  1. We recommend downloading the Anaconda distribution for Python 3. It is a prepackaged version of Python that sets up all required system environment variables for you, and no configuration is needed (it is a simple .exe installer).
  2. You can download Anaconda here. Ensure that you download Python 3.X.

pygame

  1. Obtain the .whl file for your Python version here. There are 32-bit and 64-bit files, so make sure you get the version that matches your installation of Python.
  2. Open the terminal, and navigate to where you placed your .whl file. Type pip install filename.whl, replacing the filename with the correct one.

numpy

  1. Open your terminal at the root of the repository directory.
  2. Type pip install -r requirements.txt.

OpenCV

  1. Obtain the .whl file for your Python version here. There are 32-bit and 64-bit files, so make sure you get the version that matches your installation of Python.
  2. Open the terminal, and navigate to where you placed your .whl file. Type pip install filename.whl, replacing the filename with the correct one.

Launching the client

To run the thin client itself, you will need to pass in 3 arguments: the IP from which to receive the video stream from, the port number, and the player controller ID. The fourth argument (game session ID) is optional, and will default to 1 if not given.

Example:

Using all 4 arguments:
python main.py 127.0.0.1 30000 0 --session 1

Using only 3 arguments:
python main.py 127.0.0.1 30000 0

However, if you are an end user, you do not need to launch the thin client manually on your own. The thin client should be launched automatically by Cloudy Launcher when you want to play a game.

Using The Thin Client

Press ESC to unlock the mouse cursor from the window.

Running tests

To run the tests, navigate to the root folder of the repository (..\CloudyGameThinClient\).

Then, type the following: python -m unittest discover

Cloudy Launcher

This is an application that allows users to access and manage games available to them.

Prerequisites for compiling

You need:

  1. JavaFX 2.0 or newer
    • Already included in the Java Development Kit (JDK)
  2. Java SE 8.0 or newer
    • Download the Java Development Kit (JDK) here.
    • Accept the License Agreement, then download the correct version for your computer.
    • You will need to add the Java bin directory into the system environment variables.
      • If you downloaded the 64-bit version, the bin directory should be found at C:\Program Files\Java\jdk1.8.0_73\bin. Your JDK version may be different.
      • If you downloaded the 32-bit version, the bin directory should be found at C:\Program Files (x86)\Java\jdk1.8.0_73\bin. Your JDK version may be different.
      • If you need help on how to add a system environment variable for Windows, please read this guide here.
  3. JSON dependency
    • Can be obtained from here
    • Version used in development: 20151123
    • Place it in the same directory as the .java files
  4. SimpleCaptcha dependency
    • Can be obtained from here
    • Download SimpleCaptcha for Java 6
    • Place it in the same directory as the .java files

To compile and run automatically

Ensure that the required dependencies are in the same directory as the java files. For Windows, simply run the file "make.bat". For Mac/Linux, simply run the file "make.command".

Otherwise, see the following sections on how to compile and run it manually.

To compile on the command line

Include the JSON .jar file and the SimpleCaptcha .jar file in the classpath (separate the .jar files using : for Linux/Mac and ; for Windows):

Linux/Mac:
javac -cp path/to/json/jar/file:path/to/captcha/jar/file *.java

Windows:
javac -cp path/to/json/jar/file;path/to/captcha/jar/file *.java
  • Example command for Windows:

    Assuming that you have placed the .jar files together with your .java files, type:

    javac -cp json-20151123.jar;simplecaptcha-1.2.1.jar *.java
  • Example command for Mac/Linux:

    javac -cp \* *.java
    

To run on the command line

Include the JSON .jar and the SimpleCaptcha .jar in the classpath:

Linux/Mac:
java -cp .:path/to/json/jar/file:path/to/captcha/jar/file CloudyLauncher

Windows:
java -cp .;path/to/json/jar/file;path/to/captcha/jar/file CloudyLauncher
  • Example command for Mac/Linux:

    java -cp .:json-20151123.jar:simplecaptcha-1.2.1.jar CloudyLauncher

    or simply type java -cp .:\* CloudyLauncher (only for Mac/Linux)

  • Example command for Windows:

    java -cp .;json-20151123.jar;simplecaptcha-1.2.1.jar CloudyLauncher

Notes About Running The Launcher

Cloudy Launcher communicates with CloudyWeb to obtain its user and game information. As such, Cloudy Launcher has to be configured properly with the URL of the CloudyWeb server.

To do this, open CloudyLauncherServerInterface.java. The URL can be found on line 44:

39    /**
40     * Constructor for a CloudyLauncherServerInterface object. Url will default
41     * to the deployed CloudyWeb if not specified.
42     */
43    public CloudyLauncherServerInterface() {
44        baseUrl = "http://127.0.0.1:8000/";
45    }

If CloudyWeb is deployed locally (i.e. you would like to run the entire CloudyGame project on a single computer), you can set the baseUrl to http://127.0.0.1:8000/.

About

This is the application that the player uses to play the game (Launcher + thin client)

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors