[Proposal] Add the functionality of FireResetEnv to the AtariPreprocessing wrapper #781
Closed
1 task done
Labels
enhancement
New feature or request
Proposal
I am porting an example of DQN on Atari Breakout from Gym/Stable-Baselines3 to Gymnasium, and unfortunately there is no equivalent to the Stable-Baselines3's FireResetEnv wrapper in Gymnasium. The very good AtariPreprocessing wrapper seems to handle all the other functionality present in Stable-Baselines3's Atari wrappers, but not this.
I propose building this into the existing AtariPreprocessing as an optional feature, and if there is interest, I am more than happy to do this myself and submit a pull request :)
Motivation
Breakout requires an agent to use FIRE to launch the next "ball" after losing a life or losing the game.
Without this feature, the agent can get stuck if it hasn't learned to press FIRE after losing a life (or losing the game), and the FIRE action otherwise does nothing.
I am not sure if other Atari environments also have this problem, or only Breakout.
I found this long discussion about the functionality in the gym repo. Regardless, I don't understand the reason this wasn't ported, or (apparently) ported and then later removed? If it's default behavior in SB3, there are certainly people who would be interested in using it in Gymnasium.
Pitch
I would propose adding this functionality directly to the AtariPreprocessing wrapper, with a corresponding argument to switch the behaviour on and off. The default behaviour would remain the same. The wrapper would monitor the return value of
lives()
from the ALE (as it already does forterminal_on_life_loss
), and apply an action withself.env.step(1)
if lives have decreased. For reference, here is the source code of the FireResetEnv wrapper in Stable-Baselines3.This implementation would be independent of the episodic life behavior (i.e. you have FireReset without episode life, or vice versa, or both features together).
Alternatives
One alternative is to directly use Stable-Baselines3's FireResetEnv wrapper, but this only works if also using the EpisodicLifeEnv wrapper. The fire reset functionality only triggers on an environment reset, not on a loss of life.
Maybe it's also possible to add the FIRE action to the environment's
getStartingActions
, but this is probably messy and backwards-incompatible.Additional context
No response
Checklist
The text was updated successfully, but these errors were encountered: