BaseRayEnv
Full path:
schola.rllib.env.BaseRayEnv
schola.rllib.env.BaseRayEnv
BaseRayEnv
BaseRayEnv(protocol, simulator, verbosity=0)Bases: ABC
Abstract base class for Schola RLlib environments.
Provides shared functionality for protocol/simulator management, space initialization, and common properties. Subclasses (RayEnv, RayVecEnv) must implement reset(), step(), and _init_agent_tracking().
This class does NOT inherit from any RLlib environment classes. Subclasses use multiple inheritance to combine BaseRayEnv with their specific RLlib parent (MultiAgentEnv or VectorMultiAgentEnv).
- Shared Attributes:: protocol: Communication protocol with Unreal Engine simulator: Simulator instance managing Unreal processes id_manager: Manages environment and agent IDs possible_agents: All agents that can exist (static after init) num_envs: Number of parallel environments metadata: Environment metadata (autoreset_mode, etc.) _observation_space, _action_space: Gymnasium spaces _single_observation_space, _single_action_space: Per-agent spaces _single_observation_spaces, _single_action_spaces: Dict of agent spaces
Methods
| Item | Description |
|---|---|
| init | Initialize protocol, simulator, and shared environment infrastructure. |
| close_extras | Close protocol and stop simulator. |
| reset | Reset environment(s). |
| step | Step environment(s) with actions. |
Attributes
| Item | Description |
|---|---|
| action_space | Action space (Dict of agent spaces). |
| max_num_agents | Maximum number of agents that can exist. |
| num_agents | Total number of possible agents (ever seen). |
| observation_space | Observation space (Dict of agent spaces). |
| single_action_space | Single-agent action space. |
| single_action_spaces | Dict mapping agent IDs to action spaces. |
| single_observation_space | Single-agent observation space. |
| single_observation_spaces | Dict mapping agent IDs to observation spaces. |
Parameters
protocol (BaseRLProtocol)
simulator (BaseSimulator)
verbosity (int)
init
__init__(protocol, simulator, verbosity=0)Initialize protocol, simulator, and shared environment infrastructure.
Parameters
protocol (BaseRLProtocol)
simulator (BaseSimulator)
verbosity (int)
action_space
action_space: Space | NoneAction space (Dict of agent spaces).
close_extras
close_extras(**kwargs)Close protocol and stop simulator.
max_num_agents
max_num_agents: intMaximum number of agents that can exist.
num_agents
num_agents: intTotal number of possible agents (ever seen).
observation_space
observation_space: Space | NoneObservation space (Dict of agent spaces).
reset
abstractmethod reset(**kwargs)Reset environment(s).
Signature differs by subclass:
- RayEnv: reset(, seed: Optional[int], …) -> Tuple[Dict, Dict]
- RayVecEnv: reset(, seed: Optional[Union[int, List[int]]], …) -> Tuple[List[Dict], List[Dict]]
single_action_space
single_action_space: Space | NoneSingle-agent action space.
single_action_spaces
single_action_spaces: Dict[str, Space]Dict mapping agent IDs to action spaces.
single_observation_space
single_observation_space: Space | NoneSingle-agent observation space.
single_observation_spaces
single_observation_spaces: Dict[str, Space]Dict mapping agent IDs to observation spaces.
step
abstractmethod step(actions)Step environment(s) with actions.
Signature differs by subclass:
- RayEnv: step(actions: Dict) -> Tuple[Dict, Dict[str, float], …]
- RayVecEnv: step(actions: List[Dict]) -> Tuple[List[Dict], List[Dict[str, float]], …]