2. Before starting game development¶
2.1. Updating the Python path¶
Note
If you are using the pre-configured VirtualBox image of CTGames supplied by your supervisor, the first command mentioned in this section, python setup.py, will already have been run for you when the image was configured. However, it will not be a problem to run python setup.py again.
The first time you clone the git repository (if you need to clone the repository) you need to update the Python path. Open a terminal in any directory and enter:
cd ~/gitlab.cs.nuim.ie/ctgames/ctgames/CTGames/
python setup.py
Sign out of Ubuntu and sign in again for the changes to permanently take effect. (Simply exiting the terminal and starting a new terminal may work, but logging out and in is guaranteed to work.)
Tip
Any time you move the git repository to a different place in your filesystem, or if you create a new user, you need to update the Python path again by running python setup.py so that Python can find the CTGames framework.
If the Python path has been updated successfully you will be able to run command-line versions of other developers’ games, as described next.
2.1.1. Learning how to run command-line versions of other developers’ games¶
Open a terminal in any directory, and enter
conda activate ctgames
cd ~/gitlab.cs.nuim.ie/ctgames/ctgames/CTGames/bin/
git pull
git status
This ensures that your working directory is the CTGames bin directory, and that you are in the ctgames conda environment. Then, to run any particular game, e.g. Password, enter the directory name of that game
python cli.py password
Over one hundred games are under development using the CTGames framework, some in a more advanced state than others. To list the directory names of all CTGames games under development, enter
python cli.py -l
To get a list of all accepted parameters and options for cli.py, enter
python cli.py -h
2.2. PyCharm¶
PyCharm is the recommended IDE for this project.
PyCharm gives you hints to help you ensure your Python code style is to a professional standard. Please use them. Also, an automatic code formatter called Blackpp, installed during the CTGames installation process, will reformat your code each time you save.