Skip to content

Observations

Observation plugins publish structured state during FINALIZE. Use observation("grid") for symbolic grid state, observation("image") for image rendering plus structured info, or configure GridEngineEnv with the matching observation_type.

Grid Observation

Structured Info

Bases: TypedDict

Image Observation

render(world)

Render convenience wrapper using stored configuration.

Render a World into a PIL Image.

Parameters:

Name Type Description Default
world World

Game world to visualize.

required
resolution int

Output image width in pixels (height derived from aspect ratio).

DEFAULT_RESOLUTION
subicon_percent float

Relative size of corner icons compared to a cell's size.

DEFAULT_SUBICON_PERCENT
image_map ImageMap | None

Mapping from (appearance name, property tuple) to asset path.

None
asset_root str

Root directory containing the asset hierarchy (e.g. "assets").

DEFAULT_ASSET_ROOT
tex_lookup_fn TexLookupFn | None

Override for image loading/recoloring/overlay logic.

None
cache dict | None

Memoization dict keyed by (path, size, group, move_dir, speed).

None
cell_cache dict | None

Optional per-cell composition cache (default lookup only).

None
base_cache dict | None

Optional memoization for the floor-filled base image.

None

Returns:

Type Description
Image

Image.Image: Composited RGBA image of the entire grid.