Table of Contents

Namespace Gym.Environments

Classes

EnvViewerExtensions

The asynchronous path for any IEnvViewer (DR-85): awaits an IAsyncEnvViewer's own methods, and runs a synchronous viewer's on the caller's thread, so an asynchronous env writes one call for both.

GymEnvironments

Registers Gym.NET's built-in env ids with the registry, as importing gymnasium registers Gymnasium's (gymnasium/envs/init.py): the same ids, step limits and reward thresholds, with the env classes as entry points (DR-12). After it, Gymnasium.Make("CartPole-v1") works.

NullEnvViewer

A viewer that shows nothing: human mode without a window, for headless tests and servers. Since DR-20 nothing falls back to it silently; pass Factory (as viewer_factory, or as Gymnasium.HumanViewerFactory) to run human mode headless, where Gymnasium would need a display.

Structs

ViewerInput

One input a window reported, in the window's own order. Keys are SDL keycodes (pygame's event.key): a printable key is its unshifted character ('a' is 97), any other is its scancode with bit 30 set (K_LEFT is 1073741904); Gym.Rendering.KeyCode names them. The mouse is reported as GLFW reports it to MuJoCo's viewer (DR-70): the pointer in the client area's units from its top-left corner, buttons numbered as GLFW's (LeftButton, RightButton, MiddleButton), the wheel in notches with a positive ScrollY away from the user.

Interfaces

IAsyncEnvViewer

A viewer that also renders asynchronously (DR-85): RenderAsync(NDArray, CancellationToken) and CloseAsync() complete once the UI has taken the frame or closed the window, without blocking the caller's thread. The same factory creates it as any viewer; an inherently asynchronous env checks for this interface and awaits it, and falls back to the synchronous Render(NDArray) otherwise (RenderAsync(IEnvViewer, NDArray, CancellationToken) does both).

IEnvViewer

A window that shows an env's human-mode frames, synchronously (DR-85): the path the envs' human mode uses inside Step and Reset, which every viewer has. The env owns the viewer its factory made and closes it when the env closes.

IInteractiveEnvViewer

A viewer whose window also reports the user's input, as SDL reports a pygame window's and GLFW a MuJoCo viewer's: keys, the close button, resizes and the mouse. Gym.Rendering.Display pumps the keys, the close button and resizes into pygame's event queue (Gym.Rendering.EventQueue), which is how Gym.Utils.Play lets a person play an env from the keyboard; a MuJoCo env's human window reads all of it for Gymnasium's viewer controls (DR-70: orbit, pan and zoom with the mouse, the keys of its menu).

Enums

ViewerInputKind

What a window reported: a key pressed or released, its close button, a new client size, or the mouse (a button pressed or released, the pointer moved, the wheel turned).

Delegates

EnvViewerFactory

Creates the window an env renders into in render_mode="human" (Gymnasium's pygame display), synchronously (DR-85): envs call it once, on their first human render, with the frame size and a title, and use the viewer it returns at once. Set one app-wide through Gymnasium.HumanViewerFactory, or per env through its viewer_factory argument (DR-20).