Skip to content

Instantly share code, notes, and snippets.

@mikepsn
Last active April 4, 2022 21:49
Show Gist options
  • Save mikepsn/b8d3d8664e3aed62c1dbe2785f6cb0ec to your computer and use it in GitHub Desktop.
Save mikepsn/b8d3d8664e3aed62c1dbe2785f6cb0ec to your computer and use it in GitHub Desktop.
How setup Google Research Football on Linux

Setting Up Google Research Football on Linux

  • 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
    $ python -m gfootball.play_game --action_set=full
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.

Kaggle

The competition is over but the top submissions can be found here:

Docker

  • 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment