#2446 Fix io config parsing order
This commit is contained in:
@@ -28,6 +28,8 @@ class PrimaiteGymEnv(gymnasium.Env):
|
|||||||
super().__init__()
|
super().__init__()
|
||||||
self.game_config: Dict = game_config
|
self.game_config: Dict = game_config
|
||||||
"""PrimaiteGame definition. This can be changed between episodes to enable curriculum learning."""
|
"""PrimaiteGame definition. This can be changed between episodes to enable curriculum learning."""
|
||||||
|
self.io = PrimaiteIO.from_config(game_config.get("io_settings", {}))
|
||||||
|
"""Handles IO for the environment. This produces sys logs, agent logs, etc."""
|
||||||
self.game: PrimaiteGame = PrimaiteGame.from_config(copy.deepcopy(self.game_config))
|
self.game: PrimaiteGame = PrimaiteGame.from_config(copy.deepcopy(self.game_config))
|
||||||
"""Current game."""
|
"""Current game."""
|
||||||
self._agent_name = next(iter(self.game.rl_agents))
|
self._agent_name = next(iter(self.game.rl_agents))
|
||||||
@@ -36,9 +38,6 @@ class PrimaiteGymEnv(gymnasium.Env):
|
|||||||
self.episode_counter: int = 0
|
self.episode_counter: int = 0
|
||||||
"""Current episode number."""
|
"""Current episode number."""
|
||||||
|
|
||||||
self.io = PrimaiteIO.from_config(game_config.get("io_settings", {}))
|
|
||||||
"""Handles IO for the environment. This produces sys logs, agent logs, etc."""
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def agent(self) -> ProxyAgent:
|
def agent(self) -> ProxyAgent:
|
||||||
"""Grab a fresh reference to the agent object because it will be reinstantiated each episode."""
|
"""Grab a fresh reference to the agent object because it will be reinstantiated each episode."""
|
||||||
@@ -168,6 +167,8 @@ class PrimaiteRayMARLEnv(MultiAgentEnv):
|
|||||||
"""
|
"""
|
||||||
self.game_config: Dict = env_config
|
self.game_config: Dict = env_config
|
||||||
"""PrimaiteGame definition. This can be changed between episodes to enable curriculum learning."""
|
"""PrimaiteGame definition. This can be changed between episodes to enable curriculum learning."""
|
||||||
|
self.io = PrimaiteIO.from_config(env_config.get("io_settings"))
|
||||||
|
"""Handles IO for the environment. This produces sys logs, agent logs, etc."""
|
||||||
self.game: PrimaiteGame = PrimaiteGame.from_config(copy.deepcopy(self.game_config))
|
self.game: PrimaiteGame = PrimaiteGame.from_config(copy.deepcopy(self.game_config))
|
||||||
"""Reference to the primaite game"""
|
"""Reference to the primaite game"""
|
||||||
self._agent_ids = list(self.game.rl_agents.keys())
|
self._agent_ids = list(self.game.rl_agents.keys())
|
||||||
@@ -187,9 +188,6 @@ class PrimaiteRayMARLEnv(MultiAgentEnv):
|
|||||||
{name: agent.action_manager.space for name, agent in self.agents.items()}
|
{name: agent.action_manager.space for name, agent in self.agents.items()}
|
||||||
)
|
)
|
||||||
|
|
||||||
self.io = PrimaiteIO.from_config(env_config.get("io_settings"))
|
|
||||||
"""Handles IO for the environment. This produces sys logs, agent logs, etc."""
|
|
||||||
|
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|||||||
Reference in New Issue
Block a user