schola.gym.env.GymVectorEnv

class schola.gym.env.GymVectorEnv(unreal_connection, verbosity=0)[source]

Bases: VectorEnv

A Gym Vector Environment that wraps a Schola Environment.

Parameters:
  • unreal_connection (UnrealConnection) – The connection to the Unreal Engine.

  • verbosity (int, default=0) – The verbosity level for the environment.

reset_infos

The information returned from the last reset.

Type:

List[Dict[str,str]]

Methods

__init__(unreal_connection[, verbosity])

Base class for vectorized environments.

batch_obs(obs)

call(name, *args, **kwargs)

Call a method, or get a property, from each parallel environment.

call_async(name, *args, **kwargs)

Calls a method name for each parallel environment asynchronously.

call_wait(**kwargs)

After calling a method in call_async(), this function collects the results.

close()

Close all parallel environments and release resources.

close_extras(**kwargs)

Clean up the extra resources e.g. beyond what’s in this base class.

get_attr(name)

Get an attribute from the environment.

get_wrapper_attr(name)

Gets the attribute name from the environment.

render()

Compute the render frames as specified by render_mode during the initialization of the environment.

reset(*[, seed, options])

Reset all parallel environments and return a batch of initial observations and info.

reset_async([seed, options])

Reset the sub-environments asynchronously.

reset_wait([seed, options])

Retrieves the results of a reset_async() call.

set_attr(name, values)

Set a property in each sub-environment.

step(actions)

Take an action for each parallel environment.

step_async(actions)

Asynchronously performs steps in the sub-environments.

step_wait()

Retrieves the results of a step_async() call.

unbatch_actions(actions)

Unbatch actions from Dict[ObsID,Batched] to a nested Dict[EnvId,Dict[AgentId,Dict[ObsId,Value]]], effectively moving the env, and agent dimensions into Dictionaries.

Attributes

metadata

np_random

Returns the environment’s internal _np_random that if not set will initialise with a random seed.

render_mode

reward_range

spec

unwrapped

Returns the base non-wrapped environment.

action_space

observation_space

__init__(unreal_connection, verbosity=0)[source]

Base class for vectorized environments.

Parameters:
  • num_envs – Number of environments in the vectorized environment.

  • observation_space – Observation space of a single environment.

  • action_space – Action space of a single environment.

  • unreal_connection (UnrealConnection)

  • verbosity (int)

batch_obs(obs)[source]
Parameters:

obs (Dict[int, Dict[int, Dict[str, ndarray]]])

Return type:

Dict[str, ndarray]

close()[source]

Close all parallel environments and release resources.

It also closes all the existing image viewers, then calls close_extras() and set closed as True.

Warning

This function itself does not close the environments, it should be handled in close_extras(). This is generic for both synchronous and asynchronous vectorized environments.

Note

This will be automatically called when garbage collected or program exited.

Parameters:

**kwargs – Keyword arguments passed to close_extras()

Return type:

None

get_attr(name)[source]

Get an attribute from the environment.

Parameters:

name (str) – The name of the attribute to get.

Return type:

List[None]

Notes

This method is not implemented and will always return a list of None values, as sub-environments are not individually accessible.

reset_async(seed=None, options=None)[source]

Reset the sub-environments asynchronously.

This method will return None. A call to reset_async() should be followed by a call to reset_wait() to retrieve the results.

Parameters:
  • seed – The reset seed

  • options – Reset options

reset_wait(seed=None, options=None)[source]

Retrieves the results of a reset_async() call.

A call to this method must always be preceded by a call to reset_async().

Parameters:
Returns:

The results from reset_async()

Raises:

NotImplementedError – VectorEnv does not implement function

Return type:

Tuple[Dict[str, ndarray], Dict[int, Dict[str, str]]]

step_async(actions)[source]

Asynchronously performs steps in the sub-environments.

The results can be retrieved via a call to step_wait().

Parameters:

actions (Dict[int, ndarray]) – The actions to take asynchronously

Return type:

None

step_wait()[source]

Retrieves the results of a step_async() call.

A call to this method must always be preceded by a call to step_async().

Parameters:

**kwargs – Additional keywords for vector implementation

Returns:

The results from the step_async() call

Return type:

Tuple[Dict[str, ndarray], ndarray, ndarray, ndarray, Dict[int, Dict[str, str]]]

unbatch_actions(actions)[source]

Unbatch actions from Dict[ObsID,Batched] to a nested Dict[EnvId,Dict[AgentId,Dict[ObsId,Value]]], effectively moving the env, and agent dimensions into Dictionaries.

Parameters:

actions (Dict[int,np.ndarray]) – The batched actions to unbatch.

Returns:

The unbatched actions.

Return type:

Dict[int,Dict[int,Dict[str,np.ndarray]]]

Related pages

  • Visit the Schola product page for download links and more information.

Looking for more documentation on GPUOpen?

AMD GPUOpen software blogs

Our handy software release blogs will help you make good use of our tools, SDKs, and effects, as well as sharing the latest features with new releases.

GPUOpen Manuals

Don’t miss our manual documentation! And if slide decks are what you’re after, you’ll find 100+ of our finest presentations here.

AMD GPUOpen Performance Guides

The home of great performance and optimization advice for AMD RDNA™ 2 GPUs, AMD Ryzen™ CPUs, and so much more.

Getting started: AMD GPUOpen software

New or fairly new to AMD’s tools, libraries, and effects? This is the best place to get started on GPUOpen!

AMD GPUOpen Getting Started Development and Performance

Looking for tips on getting started with developing and/or optimizing your game, whether on AMD hardware or generally? We’ve got you covered!

AMD GPUOpen Technical blogs

Browse our technical blogs, and find valuable advice on developing with AMD hardware, ray tracing, Vulkan®, DirectX®, Unreal Engine, and lots more.

Find out more about our software!

AMD GPUOpen Effects - AMD FidelityFX technologies

Create wonder. No black boxes. Meet the AMD FidelityFX SDK!

AMD GPUOpen Samples

Browse all our useful samples. Perfect for when you’re needing to get started, want to integrate one of our libraries, and much more.

AMD GPUOpen developer SDKs

Discover what our SDK technologies can offer you. Query hardware or software, manage memory, create rendering applications or machine learning, and much more!

AMD GPUOpen Developer Tools

Analyze, Optimize, Profile, Benchmark. We provide you with the developer tools you need to make sure your game is the best it can be!