Iudex Gundyr#
The SoulsGym environment for Iudex Gundyr.
The player and Iudex always start from their respective start poses at full HP/SP. A fall from the cliff is considered an instantaneous death and is eagerly reset to avoid falling out of the world. The player starts with the knight base stats and the default starting weapons without any upgrades. We do not allow shield blocking or two handing at this point, although this can easily be supported. Parrying is enabled.
Note
Phase 2 of the boss fight is available by setting the environment keyword argument phase.
See envs for details.
- class soulsgym.envs.darksouls3.iudex.IudexEnv(game_speed: float = 1.0, phase: int = 1, random_player_pose: bool = False, skip_steps: bool = False)#
Bases:
SoulsEnvGymnasium environment class for the Iudex Gundyr bossfight.
The environment uses the ground truth information from the game as observation space.
- __init__(game_speed: float = 1.0, phase: int = 1, random_player_pose: bool = False, skip_steps: bool = False)#
Initialize the observation and action spaces.
- Parameters:
game_speed – Determines how fast the game runs during
SoulsEnv.step().phase – Set the boss phase. Either 1 or 2 for Iudex.
random_player_pose – Flag to randomize the player pose on reset.
skip_steps – Flag to skip steps while the player is disabled.
- property game_id: str#
Return the ID of the souls game that is required to run for this environment.
- Returns:
The game ID.
- property obs: dict[str, Any]#
Observation property of the environment.
- Returns:
The current observation of the environment.
- property info: dict#
Info property of the environment.
- Returns:
The current info dict of the environment.
- game_state() IudexState#
Read the current game state.
- Returns:
The current game state.
- reset(**kwargs: Any) Any#
Reset the environment to the beginning of an episode.
- Parameters:
seed – Random seed. Required by gymnasium, but does not apply to SoulsGyms.
options – Options argument required by gymnasium. Not used in SoulsGym.
- Returns:
A tuple of the first game state and the info dict after the reset.
- static compute_reward(game_state: IudexState, next_game_state: IudexState) float#
Compute the reward from the current game state and the next game state.
- Parameters:
game_state – The game state before the step.
next_game_state – The game state after the step.
- Returns:
The reward for the provided game states.
- close()#
Unpause the game, reset altered game properties and reload.
Note
Does not wait for reload to complete.
- current_valid_actions() list[int]#
Get the set of currently valid actions.
- Returns:
An array of integers containing the currently allowed actions.
- property np_random: Generator#
Returns the environment’s internal
_np_randomthat if not set will initialise with a random seed.- Returns:
Instances of np.random.Generator
- render()#
Render the environment.
This is a no-op since we can’t render the environment and the game has to be open anyways.
- seed() list[int]#
Set the random seed for the environment.
Since we cannot control the randomness of the game and can’t precisely control the game, loop, this function does not have any effect.
Note
Setting the seed will not lead to reproducible results!
- Parameters:
seed – Random seed.
- Returns:
A list with 0 to comply with OpenAI’s function signature.
- step(action: int) tuple[dict, float, bool, bool, dict[str, Any]]#
Perform a step forward in the environment with a given action.
Each step advances the ingame time by step_size seconds. The game is paused before and after the step.
- Parameters:
action – The action that is applied during this step.
- Returns:
A tuple of the next game state, the reward, the terminated flag, the truncated flag, and an additional info dictionary.
- Raises:
ResetNeeded – step() was called after the episode was already finished.
- property unwrapped: Env[ObsType, ActType]#
Returns the base non-wrapped environment.
- Returns:
The base non-wrapped
gymnasium.Envinstance- Return type:
Env
- class soulsgym.envs.darksouls3.iudex.IudexImgEnv(game_speed: int = 1.0, phase: int = 1, random_player_pose: bool = False, skip_steps: bool = False, resolution: tuple[int, int] = (90, 160))#
Bases:
IudexEnvGymnasium environment class for the Iudex Gundyr bossfight.
The environment uses the ground truth information from the game as observation space. The boss HP are available in the info dict.
- __init__(game_speed: int = 1.0, phase: int = 1, random_player_pose: bool = False, skip_steps: bool = False, resolution: tuple[int, int] = (90, 160))#
Overwrite the observation space to use the game image.
- Parameters:
game_speed – Determines how fast the game runs during
SoulsEnv.step().phase – Set the boss phase. Either 1 or 2 for Iudex.
random_player_pose – Flag to randomize the player pose on reset.
skip_steps – Flag to skip steps while the player is disabled.
resolution – The resolution of the game image.
- property obs: ndarray#
Return the current observation.
- property info: dict#
Info property of the environment.
- Returns:
The current info dict of the environment.
- close()#
Unpause the game, reset altered game properties and reload.
Note
Does not wait for reload to complete.
- static compute_reward(game_state: IudexState, next_game_state: IudexState) float#
Compute the reward from the current game state and the next game state.
- Parameters:
game_state – The game state before the step.
next_game_state – The game state after the step.
- Returns:
The reward for the provided game states.
- current_valid_actions() list[int]#
Get the set of currently valid actions.
- Returns:
An array of integers containing the currently allowed actions.
- property game_id: str#
Return the ID of the souls game that is required to run for this environment.
- Returns:
The game ID.
- game_state() IudexState#
Read the current game state.
- Returns:
The current game state.
- property np_random: Generator#
Returns the environment’s internal
_np_randomthat if not set will initialise with a random seed.- Returns:
Instances of np.random.Generator
- render()#
Render the environment.
This is a no-op since we can’t render the environment and the game has to be open anyways.
- reset(**kwargs: Any) Any#
Reset the environment to the beginning of an episode.
- Parameters:
seed – Random seed. Required by gymnasium, but does not apply to SoulsGyms.
options – Options argument required by gymnasium. Not used in SoulsGym.
- Returns:
A tuple of the first game state and the info dict after the reset.
- seed() list[int]#
Set the random seed for the environment.
Since we cannot control the randomness of the game and can’t precisely control the game, loop, this function does not have any effect.
Note
Setting the seed will not lead to reproducible results!
- Parameters:
seed – Random seed.
- Returns:
A list with 0 to comply with OpenAI’s function signature.
- step(action: int) tuple[dict, float, bool, bool, dict[str, Any]]#
Perform a step forward in the environment with a given action.
Each step advances the ingame time by step_size seconds. The game is paused before and after the step.
- Parameters:
action – The action that is applied during this step.
- Returns:
A tuple of the next game state, the reward, the terminated flag, the truncated flag, and an additional info dictionary.
- Raises:
ResetNeeded – step() was called after the episode was already finished.
- property unwrapped: Env[ObsType, ActType]#
Returns the base non-wrapped environment.
- Returns:
The base non-wrapped
gymnasium.Envinstance- Return type:
Env
- class soulsgym.envs.darksouls3.iudex.IudexEnvDemo(game_speed: float = 1.0, random_player_pose: bool = False)#
Bases:
SoulsEnvDemo,IudexEnvDemo environment for the Iudex Gundyr fight.
Covers both phases. Player and boss loose HP, and the episode does not reset.
- __init__(game_speed: float = 1.0, random_player_pose: bool = False)#
Initialize the demo environment.
- Parameters:
game_speed – Determines how fast the game runs during
SoulsEnv.step().random_player_pose – Flag to randomize the player pose on reset.
- reset(seed: int | None = None, options: Any | None = None) tuple[dict, dict]#
Reset the environment to the beginning of an episode.
- Parameters:
seed – Random seed. Required by gymnasium, but does not apply to SoulsGyms.
options – Options argument required by gymnasium. Not used in SoulsGym.
- Returns:
A tuple of the first game state and the info dict after the reset.
- step(action: int) tuple[dict, float, bool, bool, dict[str, Any]]#
Perform a step forward in the environment with a given action.
Each step advances the ingame time by step_size seconds. The game is paused before and after the step.
- Parameters:
action – The action that is applied during this step.
- Returns:
A tuple of the next game state, the reward, the terminated flag, the truncated flag, and an additional info dictionary.
- close()#
Unpause the game, reset altered game properties and reload.
Note
Does not wait for reload to complete.
- static compute_reward(game_state: IudexState, next_game_state: IudexState) float#
Compute the reward from the current game state and the next game state.
- Parameters:
game_state – The game state before the step.
next_game_state – The game state after the step.
- Returns:
The reward for the provided game states.
- current_valid_actions() list[int]#
Get the set of currently valid actions.
- Returns:
An array of integers containing the currently allowed actions.
- property game_id: str#
Return the ID of the souls game that is required to run for this environment.
- Returns:
The game ID.
- game_state() IudexState#
Read the current game state.
- Returns:
The current game state.
- property info: dict#
Info property of the environment.
- Returns:
The current info dict of the environment.
- property np_random: Generator#
Returns the environment’s internal
_np_randomthat if not set will initialise with a random seed.- Returns:
Instances of np.random.Generator
- property obs: dict[str, Any]#
Observation property of the environment.
- Returns:
The current observation of the environment.
- render()#
Render the environment.
This is a no-op since we can’t render the environment and the game has to be open anyways.
- seed() list[int]#
Set the random seed for the environment.
Since we cannot control the randomness of the game and can’t precisely control the game, loop, this function does not have any effect.
Note
Setting the seed will not lead to reproducible results!
- Parameters:
seed – Random seed.
- Returns:
A list with 0 to comply with OpenAI’s function signature.
- property unwrapped: Env[ObsType, ActType]#
Returns the base non-wrapped environment.
- Returns:
The base non-wrapped
gymnasium.Envinstance- Return type:
Env