mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2026-01-03 10:09:29 +00:00
Envs
These are the core integrated environments. Note that we may later
restructure any of the files, but will keep the environments available
at the relevant package's top-level. So for example, you should access
AntEnv as follows:
# Will be supported in future releases
from gym.envs import mujoco
mujoco.AntEnv
Rather than:
# May break in future releases
from gym.envs.mujoco import ant
ant.AntEnv
How to add new environments to Gym
- Write your environment in an existing collection or a new collection. All collections are subfolders of `/gym/envs'.
- Import your environment into the
__init__.pyfile of the collection. This file will be located at/gym/envs/my_collection/__init__.py. Addfrom gym.envs.my_collection.my_awesome_env import MyEnvto this file. - Register your env in
/gym/envs/__init__.py:
register(
id='MyEnv-v0',
entry_point='gym.envs.my_collection:MyEnv',
)
- Add your environment to the scoreboard in
/gym/scoreboard/__init__.py:
add_task(
id='MyEnv-v0',
summary="Super cool environment",
group='my_collection',
contributor='mygithubhandle',
)