All Projects → google-research → Football

google-research / Football

Licence: apache-2.0
Check out the new game server:

Programming Languages

python
139335 projects - #7 most used programming language
Jupyter Notebook
11667 projects
shell
77523 projects

Projects that are alternatives of or similar to Football

Gam
A PyTorch implementation of "Graph Classification Using Structural Attention" (KDD 2018).
Stars: ✭ 227 (-92.02%)
Mutual labels:  reinforcement-learning
Pytorch Drl
PyTorch implementations of various Deep Reinforcement Learning (DRL) algorithms for both single agent and multi-agent.
Stars: ✭ 233 (-91.8%)
Mutual labels:  reinforcement-learning
Roboleague
A car soccer environment inspired by Rocket League for deep reinforcement learning experiments in an adversarial self-play setting.
Stars: ✭ 236 (-91.7%)
Mutual labels:  reinforcement-learning
Applied Reinforcement Learning
Reinforcement Learning and Decision Making tutorials explained at an intuitive level and with Jupyter Notebooks
Stars: ✭ 229 (-91.95%)
Mutual labels:  reinforcement-learning
Nn
🧑‍🏫 50! Implementations/tutorials of deep learning papers with side-by-side notes 📝; including transformers (original, xl, switch, feedback, vit, ...), optimizers (adam, adabelief, ...), gans(cyclegan, stylegan2, ...), 🎮 reinforcement learning (ppo, dqn), capsnet, distillation, ... 🧠
Stars: ✭ 5,720 (+101.2%)
Mutual labels:  reinforcement-learning
Rl learn
我的强化学习笔记和学习材料📖 still updating ... ...
Stars: ✭ 234 (-91.77%)
Mutual labels:  reinforcement-learning
Ma Gym
A collection of multi agent environments based on OpenAI gym.
Stars: ✭ 226 (-92.05%)
Mutual labels:  reinforcement-learning
Rl Cheatsheet
RL Notation and Pseudocode for Udacity's MLND program
Stars: ✭ 245 (-91.38%)
Mutual labels:  reinforcement-learning
Machine Learning Uiuc
🖥️ CS446: Machine Learning in Spring 2018, University of Illinois at Urbana-Champaign
Stars: ✭ 233 (-91.8%)
Mutual labels:  reinforcement-learning
Supergo
A student implementation of Alpha Go Zero
Stars: ✭ 236 (-91.7%)
Mutual labels:  reinforcement-learning
Deep Rl Trading
playing idealized trading games with deep reinforcement learning
Stars: ✭ 228 (-91.98%)
Mutual labels:  reinforcement-learning
Rl Agents
Implementations of Reinforcement Learning and Planning algorithms
Stars: ✭ 232 (-91.84%)
Mutual labels:  reinforcement-learning
Aleph star
Reinforcement learning with A* and a deep heuristic
Stars: ✭ 235 (-91.73%)
Mutual labels:  reinforcement-learning
Evostra
A fast Evolution Strategy implementation in Python
Stars: ✭ 227 (-92.02%)
Mutual labels:  reinforcement-learning
Learningx
Deep & Classical Reinforcement Learning + Machine Learning Examples in Python
Stars: ✭ 241 (-91.52%)
Mutual labels:  reinforcement-learning
Deeprl Grounding
Train an RL agent to execute natural language instructions in a 3D Environment (PyTorch)
Stars: ✭ 226 (-92.05%)
Mutual labels:  reinforcement-learning
Awesome Real World Rl
Great resources for making Reinforcement Learning work in Real Life situations. Papers,projects and more.
Stars: ✭ 234 (-91.77%)
Mutual labels:  reinforcement-learning
Open spiel
OpenSpiel is a collection of environments and algorithms for research in general reinforcement learning and search/planning in games.
Stars: ✭ 2,991 (+5.21%)
Mutual labels:  reinforcement-learning
Train Robot Arm From Scratch
Build environment and train a robot arm from scratch (Reinforcement Learning)
Stars: ✭ 242 (-91.49%)
Mutual labels:  reinforcement-learning
Learning To Communicate Pytorch
Learning to Communicate with Deep Multi-Agent Reinforcement Learning in PyTorch
Stars: ✭ 236 (-91.7%)
Mutual labels:  reinforcement-learning

Google Research Football

This repository contains an RL environment based on open-source game Gameplay Football.
It was created by the Google Brain team for research purposes.

Useful links:

We'd like to thank Bastiaan Konings Schuiling, who authored and open-sourced the original version of this game.

Quick Start

In colab

Open our example Colab, that will allow you to start training your model in less than 2 minutes.

This method doesn't support game rendering on screen - if you want to see the game running, please use the method below.

Using Docker

This is the recommended way to avoid incompatible package versions. Instructions are available here.

On your computer

1. Install required packages

Linux

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

macOS

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

Windows

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

2. Install GFootball

2a. From PyPi package

python3 -m pip install gfootball

2b. Installing from sources using GitHub repository

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.

To compile the engine on Windows you have to install additional tools and set environment variables. See Compiling Engine for detailed instructions.

3. Time to play!

python3 -m gfootball.play_game --action_set=full

Make sure to check out the keyboard mappings. To quit the game press Ctrl+C in the terminal.

Contents

Training agents to play GRF

Run training

In order to run TF training, you need to install additional dependencies

  • Update PIP, so that tensorflow 1.15 is available: python3 -m pip install --upgrade pip setuptools wheel
  • TensorFlow: python3 -m pip install tensorflow==1.15.* or python3 -m pip install tensorflow-gpu==1.15.*, depending on whether you want CPU or GPU version;
  • Sonnet and psutil: python3 -m pip install dm-sonnet==1.* psutil;
  • OpenAI Baselines: python3 -m pip install git+https://github.com/openai/baselines.git@master.

Then:

  • To run example PPO experiment on academy_empty_goal scenario, run python3 -m gfootball.examples.run_ppo2 --level=academy_empty_goal_close
  • To run on academy_pass_and_shoot_with_keeper scenario, run python3 -m gfootball.examples.run_ppo2 --level=academy_pass_and_shoot_with_keeper

In order to train with nice replays being saved, run python3 -m gfootball.examples.run_ppo2 --dump_full_episodes=True --render=True

In order to reproduce PPO results from the paper, please refer to:

  • gfootball/examples/repro_checkpoint_easy.sh
  • gfootball/examples/repro_scoring_easy.sh

Playing the game

Please note that playing the game is implemented through an environment, so human-controlled players use the same interface as the agents. One important implication is that there is a single action per 100 ms reported to the environment, which might cause a lag effect when playing.

Keyboard mappings

The game defines following keyboard mapping (for the keyboard player type):

  • ARROW UP - run to the top.
  • ARROW DOWN - run to the bottom.
  • ARROW LEFT - run to the left.
  • ARROW RIGHT - run to the right.
  • S - short pass in the attack mode, pressure in the defense mode.
  • A - high pass in the attack mode, sliding in the defense mode.
  • D - shot in the attack mode, team pressure in the defense mode.
  • W - long pass in the attack mode, goalkeeper pressure in the defense mode.
  • Q - switch the active player in the defense mode.
  • C - dribble in the attack mode.
  • E - sprint.

Play vs built-in AI

Run python3 -m gfootball.play_game --action_set=full. By default, it starts the base scenario and the left player is controlled by the keyboard. Different types of players are supported (gamepad, external bots, agents...). For possible options run python3 -m gfootball.play_game -helpfull.

Play vs pre-trained agent

In particular, one can play against agent trained with run_ppo2 script with the following command (notice no action_set flag, as PPO agent uses default action set): python3 -m gfootball.play_game --players "keyboard:left_players=1;ppo2_cnn:right_players=1,checkpoint=$YOUR_PATH"

Trained checkpoints

We provide trained PPO checkpoints for the following scenarios:

In order to see the checkpoints playing, run python3 -m gfootball.play_game --players "ppo2_cnn:left_players=1,policy=gfootball_impala_cnn,checkpoint=$CHECKPOINT" --level=$LEVEL, where $CHECKPOINT is the path to downloaded checkpoint. Please note that the checkpoints were trained with Tensorflow 1.15 version. Using different Tensorflow version may result in errors. The easiest way to run these checkpoints is through provided Dockerfile_examples image. See running in docker for details (just override the default Docker definition with -f Dockerfile_examples parameter).

In order to train against a checkpoint, you can pass 'extra_players' argument to create_environment function. For example extra_players='ppo2_cnn:right_players=1,policy=gfootball_impala_cnn,checkpoint=$CHECKPOINT'.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].