Skip to content

Add FireResetEnv and enable terminal_on_life_loss for Atari#124

Merged
dnddnjs merged 1 commit into
masterfrom
atari-fire-reset-life-loss
May 17, 2026
Merged

Add FireResetEnv and enable terminal_on_life_loss for Atari#124
dnddnjs merged 1 commit into
masterfrom
atari-fire-reset-life-loss

Conversation

@dnddnjs

@dnddnjs dnddnjs commented May 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add FireResetEnv wrapper that presses FIRE on reset for games that need it (Breakout). Pong unaffected since FIRE isn't in its action set.
  • Flip terminal_on_life_loss to True to match the Nature DQN / CleanRL convention.

Why

PPO on Breakout was plateauing around ~14 mean return at ~870k frames. Two standard pieces of the Atari preprocessing stack were missing:

  • Without FIRE-on-reset, the agent burns frames every episode waiting to randomly press FIRE before the ball even launches.
  • With life-loss not terminating the episode, the credit for a death-causing action is diluted across hundreds of steps and 4 surviving lives.

Both DQN and PPO share 3-atari/env.py, so both benefit.

Note

Reported recent_mean_return on Breakout will look ~5x smaller now since it reflects per-life score instead of full-game (5-life) score. The thing to watch is the slope, not the absolute number.

Test plan

  • Re-run python 3-atari/2-ppo.py --env breakout and confirm return climbs faster than the prior baseline
  • Sanity check python 3-atari/2-ppo.py --env pong still runs (FireResetEnv should be skipped)
  • Sanity check python 3-atari/1-dqn.py --env breakout still runs

Breakout requires pressing FIRE to launch the ball after reset / life loss;
AtariPreprocessing only does NOOPs, so the agent wastes frames waiting for a
random FIRE. FireResetEnv presses it automatically on reset (applied only to
games whose action set contains FIRE, so Pong is unaffected).

terminal_on_life_loss=True is the Nature DQN / CleanRL convention: each life
becomes its own episode so credit for the death-causing action isn't diluted
across hundreds of steps. Reported returns will look ~5x smaller on Breakout
since they now reflect per-life score, not full-game score.
@dnddnjs dnddnjs merged commit b495daa into master May 17, 2026
@dnddnjs dnddnjs deleted the atari-fire-reset-life-loss branch May 17, 2026 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant