-
Follow the instructions for Linux on: https://github.com/google-research/football
-
I set this up using the KUbuntu variant of Ubuntu 20.04.4 LTS x86_64
-
I already had git, cmake and build-essentials installed so apt installed the following packages:
sudo apt-get install 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
- I already had anaconda installed
- Created a new conda environment with Python 3.10
conda create --name gfootball python=3.10
conda activate gfootball
- My gfootball conda environment alreade had setuptools and wheel installed so I just needed to install psutil.
conda install psutil
- I then needed to install the gfootball python package using pip:
python -m pip install gfootball
-
The alternative is to installed it by cloning the git repo from: https://github.com/google-research/football
-
I was then able to run the default environment (with rendering) as follows:
$ python -m gfootball.play_game --action_set=full
-
The gfootball package has a bunch of examples and scenarios. They can be found in the following directories.
-
https://github.com/google-research/football/tree/master/gfootball/examples
-
https://github.com/google-research/football/tree/master/gfootball/scenarios
-
It wasn't clear how to run them easily so doing some digging I found that many of the scenarios are Gym environments which you can instantiate. By changing the value of the game variable in the Python code below you can try different scenarios from the scenario directory.
import gfootball.env as football_env
game = "1_vs_1_easy"
#game = "5_vs_5"
#game = "academy_3_vs_1_with_keeper"
#game="academy_run_to_score"
#game="11_vs_11_easy_stochastic"
env = football_env.create_environment(env_name=game, render=True)
env.reset()
steps = 0
while True:
obs, reward, done, info = env.step(env.action_space.sample())
steps += 1
if steps % 10000 == 0:
print("Step %d Reward %f" % (steps, reward))
if done:
break
print(">Steps %d Reward: %.2f" % (steps, reward))
Note that I haven't set this up with TensorFlow so I haven't had time to train any models or to explore this environment in any detail.
-
There seems to be a Kaggle competition around this environment and lots of associated code/notebooks.
-
I'm not sure if the agent models (aka the neural networks) are availablef for download but that might be a possibility.
-
Some links:
The competition is over but the top submissions can be found here:
- https://www.kaggle.com/competitions/google-football/discussion/204645
- Leaderboard: https://www.kaggle.com/competitions/google-football/leaderboard
- Note that the gfootball github repo also has instructions on how to setup the environmentin a docker container.
- I managed to set this up but I couldn't get it to render the environment through the local X11 server. I tried a lot of things but had no luck so had to move on.