Skip to content

zhengxingXue/gym_futbol_v1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gym_futbol_v1

This project is a 2D simulation of real world soccer.

It continues the work on gym-futbol(https://github.com/yc2454/gym-futbol).

simulation recording

Trained PPO2 agent on the left (red). Random action agent on the right (blue).

Quick start

To install the Python module:

git clone https://github.com/zhengxingXue/gym_futbol_v1.git
cd gym_futbol_v1
pip install -e .

To try the environment with PPO2 agent (trained 1M timestep):

python main.py

The simulation is recorded and showed in the pop up window. The video file is saved in videos/ directory.

tutorial.ipynb contains example for training, to start:

jupyter notebook tutorial.ipynb 

Env

To create the futbol environment:

import gym, gym_futbol_v1
env = gym.make('futbol-v1')  # 2v2 settings
env.render()

Training

To train the futbol environment with PPO2(MlpPolicy) algorithm for 100,000 time step:

python training/ppo2_mlp_policy.py --timestep 100000

The trained model and best model during the training are saved in training/logs/MlpPolicy-{time} directory.

Examples

Recording of initialized PPO2 agent vs. random opponents:

pre train recording

Recording of a trained PPO2 agent (1 Million time step) vs. random opponents:

post train recording

About

2D simulation of real world soccer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published