4.3.8. Getting started with CTGames

PyCharm is the recommended IDE to use for CTGames development. There is a link to the PyCharm IDE in the Ubuntu launcher. Games you create will appear in CTGames/ctgames/ in the project directory structure visible in PyCharm.

Firefox is the recommended browser to run CTGames web app games, and is installed in the virtual appliance. If you encounter any strange behaviour with Firefox, alternative web browsers Chromium and Chrome are also installed to allow you check if the strange behaviour is due to CTGames or any one particular browser.

You can test that the virtual appliance has been configured correctly by starting the CTGames server and playing the web app games. To play the web app games you will need a teacher’s sign-in details and class members’ details that have been pre-populated in the virtual appliance. Your supervisor will give you these.

4.3.8.1. Running locally the web app versions of other developers’ games

Open a terminal in any directory, and enter

cd ~/gitlab.cs.nuim.ie/ctgames/ctgames/CTGames/bin/
git pull

To start the docker containers with web server, Flask server, and database server, within the CTGames Conda environment you can type (without pressing Enter)

./sta

Press Tab and it should autocomplete to ./start_docker_server. Then press Enter. You will be asked to enter the password you used when signing in to Ubuntu.

Note

You do not need to be in the CTGames Conda environment when you run ./start_docker_server. If you do, you will see an error of the form activate: No such file or directory; you can safely ignore this error. Also, ignore an error of the form /etc/init.d/postgresql: command not found; it just represents a check in case you are running a local version of PostgreSQL.

You will have to leave this program running in the terminal as long as you need the web server to be active. So, if you have other work to do on the command line, you’ll have to open a new terminal.

Tip

If you are using the VirtualBox image for CTGames development, a teacher name, email, and password have been created for you and are in a text file on the Ubuntu desktop called ~/Desktop/Player PINs.txt. This file also contains a class name and class members’ IDs and PINs.

Alternatively, if you are installing CTGames directly on your computer according to the previous instructions, you will have already created the class members’ IDs and PINs by this point.

The teacher credentials are needed to activate the class (to allow class members to sign in). Point Firefox to http://127.0.0.1:8080/teachers and sign in as a schoolteacher. Choose the appropriate class and click Activate.

Any of the player credentials can be used to play the web-based versions of games. Point Firefox to http://127.0.0.1:8080/ and sign-in as one of the class members using the appropriate ID and PIN.

To stop the server, go back to the terminal. Enter Ctrl-c and wait a couple of seconds for the server to shut down.