(WIP) Creating Environments: Repository Structure#
Welcome to the first of five short tutorials, guiding you through the process of creating your own PettingZoo environment, from conception to deployment.
We will be creating a parallel environment, meaning that each agent acts simultaneously.
Before thinking about the environment logic, we should understand the structure of environment repositories.
Environment repositories are usually laid out using the following structure:
Custom-Environment ├── custom-environment └── env └── custom_environment.py └── custom_environment_v0.py ├── README.md └── requirements.txt
/custom-environment/envis where your environment will be stored, along with any helper functions (in the case of a complicated environment).
/custom-environment/custom_environment_v0.pyis a file that imports the environment - we use the file name for environment version control.
/README.mdis a file used to describe your environment.
/requirements.txtis a file used to keep track of your environment dependencies. At the very least,
pettingzooshould be in there. Please version control all your dependencies via
Advanced: Additional (optional) files#
The above file structure is minimal. A more deployment-ready environment would include
/custom-environment/__init__.pyfor depreciation handling, and
Github actions for continuous integration of environment tests.
Implementing these are outside the scope of this tutorial.
The entirety of your environment logic is stored within
from pettingzoo.utils.env import ParallelEnv class CustomEnvironment(ParallelEnv): def __init__(self): pass def reset(self, seed=None, return_info=False, options=None): pass def step(self, actions): pass def render(self): pass def observation_space(self, agent): return self.observation_spaces[agent] def action_space(self, agent): return self.action_spaces[agent]