Google Research Football¶
Overview¶
The Google Research Football Environment (GRF) is an MARL environment developed by the Google Brain team. It is specifically designed for RL research, particularly for MARL scenarios. Here are some key details about it:
Environment: GRF simulates a highly challenging football (soccer) game environment.
Purpose: It is used to test and develop reinforcement learning algorithms in scenarios that involve strategy, teamwork, and complex decision-making.
Focus: It emphasizes multi-agent RL, long-term planning, and continuous control.
Key Features¶
Realistic Physics: The environment is based on the gameplay of football, including realistic physics and dynamic player interactions.
Multi-Agent Scenarios: Supports both single-agent and multi-agent settings where agents can collaborate or compete.
Customizable Matches: Users can customize team configurations, game scenarios, and even create custom reward structures.
Diverse Observations: Provides rich observational data, such as: player positions, ball position, velocities, game state (e.g., goals scored, possession).
- Action Space:
Discrete: Actions like shooting, passing, moving, etc.
Continuous: Detailed control over players’ movements and actions.
Challenging Environment: It includes complex strategies, requiring hierarchical planning and effective coordination among agents.
Applications¶
Policy Learning: Test RL algorithms in competitive and cooperative multi-agent scenarios.
Teamwork and Collaboration: Study cooperative behaviors and communication strategies among agents.
Generalization: Investigate how well RL policies generalize across different scenarios or team compositions.
Installation and Usage¶
Step 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:
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:
python -m pip install --upgrade pip setuptools psutil wheel
Step 2: Install gfootball¶
Method 1: Install from PyPi.
python3 -m pip install gfootball
Method 2: Installing from GitHub repository.
git clone https://github.com/google-research/football.git
cd football
python3 -m pip install .
注意
All python packages including gfootball environment should be installed in a same conda environment.
See https://xuance.readthedocs.io/en/latest/documents/usage/installation.html#install-via-pypi.
Test installation¶
python3 -m gfootball.play_game --action_set=full
APIs¶
- Football Benchmarks:
11_vs_11_stochastic: A full 90 minutes football game (medium difficulty)
11_vs_11_easy_stochastic: A full 90 minutes football game (easy difficulty)
11_vs_11_hard_stochastic: A full 90 minutes football game (hard difficulty)
- Football Academy - with a total of 11 scenarios
academy_empty_goal_close: Our player starts inside the box with the ball, and needs to score against an empty goal.
academy_empty_goal: Our player starts in the middle of the field with the ball, and needs to score against an empty goal.
academy_run_to_score: Our player starts in the middle of the field with the ball, and needs to score against an empty goal. Five opponent players chase ours from behind.
academy_run_to_score_with_keeper: Our player starts in the middle of the field with the ball, and needs to score against a keeper. Five opponent players chase ours from behind.
academy_pass_and_shoot_with_keeper: Two of our players try to score from the edge of the box, one is on the side with the ball, and next to a defender. The other is at the center, unmarked, and facing the opponent keeper.
academy_run_pass_and_shoot_with_keeper: Two of our players try to score from the edge of the box, one is on the side with the ball, and unmarked. The other is at the center, next to a defender, and facing the opponent keeper.
academy_3_vs_1_with_keeper: Three of our players try to score from the edge of the box, one on each side, and the other at the center. Initially, the player at the center has the ball and is facing the defender. There is an opponent keeper.
academy_corner: Standard corner-kick situation, except that the corner taker can run with the ball from the corner.
academy_counterattack_easy: 4 versus 1 counter-attack with keeper; all the remaining players of both teams run back towards the ball.
academy_counterattack_hard: 4 versus 2 counter-attack with keeper; all the remaining players of both teams run back towards the ball.
academy_single_goal_versus_lazy: Full 11 versus 11 games, where the opponents cannot move but they can only intercept the ball if it is close enough to them. Our center back defender has the ball at first.