diff --git a/docs/graphics/index.md b/docs/graphics/index.md index 9f6989824..2b78c86e0 100644 --- a/docs/graphics/index.md +++ b/docs/graphics/index.md @@ -9,11 +9,13 @@ Environment rendering is done with [pygame](https://www.pygame.org/news), which A window is created at the first call of `env.render()`. Its dimensions can be configured: ```python -env = gym.make("roundabout-v0") -env.configure({ - "screen_width": 640, - "screen_height": 480 -}) +env = gym.make( + "roundabout-v0", + config={ + "screen_width": 640, + "screen_height": 480 + } +) env.reset() env.render() ``` diff --git a/docs/make_your_own.md b/docs/make_your_own.md index e301de44d..d31d77ba1 100644 --- a/docs/make_your_own.md +++ b/docs/make_your_own.md @@ -43,8 +43,8 @@ See {ref}`vehicle behaviors ` for reference, and existing envi To make a part of your environment configurable, overload the {py:meth}`~highway_env.envs.common.abstract.AbstractEnv.default_config` method to define new `{"config_key": value}` pairs with default values. These configurations then be accessed in your -environment implementation with `self.config["config_key"]`, and once the environment is created, it can be configured with -`env.configure({"config_key": other_value})` followed by `env.reset()`. +environment implementation with `self.unwrapped.config["config_key"]`, and once the environment is created, it can be configured with +`env.unwrapped.config["config_key"] = other_value` followed by `env.reset()`. ## Register the environment diff --git a/docs/multi_agent.md b/docs/multi_agent.md index 309895609..0607f0c16 100644 --- a/docs/multi_agent.md +++ b/docs/multi_agent.md @@ -11,12 +11,17 @@ To that end, update the {ref}`environment configuration th.Tensor: def make_configure_env(**kwargs): - env = gym.make(kwargs["id"]) - env.configure(kwargs["config"]) + env = gym.make(kwargs["id"], config=kwargs["config"]) env.reset() return env diff --git a/tests/envs/test_actions.py b/tests/envs/test_actions.py index 451b84550..ac1e3c634 100644 --- a/tests/envs/test_actions.py +++ b/tests/envs/test_actions.py @@ -15,8 +15,7 @@ ], ) def test_action_type(action_config): - env = gym.make("highway-v0").unwrapped - env.configure({"action": action_config}) + env = gym.make("highway-v0", config={"action": action_config}) env.reset() for _ in range(3): action = env.action_space.sample() diff --git a/tests/graphics/test_render.py b/tests/graphics/test_render.py index f11062493..ae5f91a62 100644 --- a/tests/graphics/test_render.py +++ b/tests/graphics/test_render.py @@ -10,7 +10,7 @@ @pytest.mark.parametrize("env_spec", ["highway-v0", "merge-v0"]) def test_render(env_spec): env = gym.make(env_spec, render_mode="rgb_array").unwrapped - env.configure({"offscreen_rendering": True}) + env.config.update({"offscreen_rendering": True}) env.reset() img = env.render() env.close() @@ -25,7 +25,7 @@ def test_render(env_spec): @pytest.mark.parametrize("env_spec", ["highway-v0", "merge-v0"]) def test_obs_grayscale(env_spec, stack_size=4): env = gym.make(env_spec).unwrapped - env.configure( + env.config.update( { "offscreen_rendering": True, "observation": {