Skip to content

Commit

Permalink
Added metadata field to VectorEnv. Implements Farama-Foundation#1005
Browse files Browse the repository at this point in the history
  • Loading branch information
TimSchneider42 committed Apr 10, 2024
1 parent 6047a8c commit f2e28b8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gymnasium/vector/vector_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ class VectorEnv(Generic[ObsType, ActType, ArrayType]):
:func:`make_vec` is the equivalent function to :func:`make` for vector environments.
"""

# Set this in SOME subclasses
metadata: dict[str, Any] = {"render_modes": []}

spec: EnvSpec | None = None
render_mode: str | None = None
closed: bool = False
Expand Down Expand Up @@ -446,6 +449,11 @@ def render_mode(self) -> tuple[RenderFrame, ...] | None:
"""Returns the `render_mode` from the base environment."""
return self.env.render_mode

@property
def metadata(self) -> dict[str, Any]:
"""Returns the `metadata` from the base environment."""
return self.env.metadata

@property
def np_random(self) -> np.random.Generator:
"""Returns the environment's internal :attr:`_np_random` that if not set will initialise with a random seed.
Expand Down

0 comments on commit f2e28b8

Please sign in to comment.