The registration of a custom Gym environment is easy with the use of the gym.envs.registration.register module; this provides the register method, which in turn takes as an argument id, which is the name of the environment we want to use when calling gym.make(...) and entry_point , the class name for the custom environment implementation we discussed earlier. The code snippet to register the CustomEnv class we implemented is as follows:
from gym.envs.registration import registerregister( id='CustomEnv-v0', entry_point='custom_environments.envs:CustomEnv',)
We will make use of this template later on in this chapter to create a custom Gym environment that uses a very sophisticated driving simulator. ...