Install conda if it is not already installed in your system. Then create and activate a virtual environment using the following commands:
conda create -n football-env python=3.9
conda activate football-env
sudo apt-get install git cmake build-essential libgl1-mesa-dev libsdl2-dev \
libsdl2-image-dev libsdl2-ttf-dev libsdl2-gfx-dev libboost-all-dev \
libdirectfb-dev libst-dev mesa-utils xvfb x11vnc python3-pip
python3 -m pip install --upgrade pip setuptools psutil wheel
First install brew. It should automatically install Command Line Tools. Next install required packages:
brew install git python3 cmake sdl2 sdl2_image sdl2_ttf sdl2_gfx boost boost-python3
python3 -m pip install --upgrade pip setuptools psutil wheel
Install Git and Python 3.
Update pip in the Command Line (here and for the next steps type python
instead of python3
)
python -m pip install --upgrade pip setuptools psutil wheel
python3 -m pip install gfootball
(On Windows you have to install additional tools and set an environment variable, see Compiling Engine for detailed instructions.)
git clone https://github.com/google-research/football.git
cd football
Optionally you can use virtual environment:
python3 -m venv football-env
source football-env/bin/activate
Next, build the game engine and install dependencies:
python3 -m pip install .
This command can run for a couple of minutes, as it compiles the C++ environment in the background. If you face any problems, first check Compiling Engine documentation and search GitHub issues.
pip install stable-baselines3==1.5.0
Please replace the original stable_baselines3/common/offpolicyalgorithm.py
and stable_baselines3/common/torch_layers.py
files of the sb3 library with the files provided in the changes to_sb3
directory. I will incorporate these changes in a smarter way later instead of this brute force way. The reason behind this is that I have changed the code of the offpolicyalgorithm.py
for changing the action sampling policy of DQN and the torch_layers.py
file has been changed to incorporate changes such as dropout in the policy network both for DQN and PPO.
pip install notebook
pip install tensorboard
- epoch=146-step=479366.ckpt - IL agent without batch normalization
- gfootball-stable-baselines3-DQN.ipynb - for running DQN experiments including DDQN.
- gfootball-stable-baselines3-PPO.ipynb - for running PPO experiments.
- gfootball-stable-baselines3-test-agent.ipynb - for testing how an agent performs