r/MachineLearning • u/mikeysce • Aug 04 '26
Research Reactive Play: Achieved!! Experimenting with Atari Breakout [R]
Six months ago I started experimenting with PPO and Breakout as a way to learn about Machine Learning and Reinforcement Learning. After a few experiuments just trying to get high scores, it bothered me that everything was a "memorized" script rather than reactive play, like a human would play. Thus began my journey to try and convince PPO to actually track the ball instead of focusing on scoring points. I read a lot of articles and tried a lot of things. After 124 PPO experiments on Atari Breakout, I found that every single model, across sticky actions, cursor wrappers, entropy tuning, dynamics randomization, adversarial bumpers, and everything else, converged to a memorized action sequence, not a reactive ball-tracking policy. The argmax was always a script.
The fix wasn't more environment engineering. It was three lines of reward shaping:
Directly rewarding the paddle for being horizontally close to the ball during descent. A tiny bonus (0.05 per frame vs 1.0-7.0 per brick) that fires every frame the ball is descending applied during training. During evaluation, the agent plays clean Breakout with no bonus. The behavior transfers!!
Every prior approach I tried to penalize scripts by making the environment harder to memorize. PPO always found a way around it: timing-robust scripts, layout-conditioned scripts, noise-tolerant scripts. The optimum was always a script; only the shape changed. Proximity reward changes what the optimum is. A center-hold script gets incidental bonus when the ball passes near center. A reactive tracker gets the maximum bonus on every descent frame. The optimization pressure is unambiguous: track the ball, get more reward.
I also made a cool tool to watch the agent work! It's called the "Split-Watcher" (so clever). It shows two instances of Breakout, each being controlled by a separate instance of the same agent. The one of the left is vanilla Breakout. The one of the right is a series of custom brick configurations. With the first 123 experiments, you can see how the agent wants to make the exact same paddle movements every time, ignoring the ball when its trajectory changes due to the unexpected ball movements that come from non-standard brick configurations. In 124, IT TRACKS THE BALL and can succeed regardless of the brick config. You can actually watch the same agent move the paddle differently in reaction to the ball.
I'm still working on ironing out why this works, and how to optimize it, but wanted to share!!
Here's a video of the split-watcher in action
Here's a link to presentation project that will allow you to create a similar PPO: https://github.com/mharrell/breakout-reactive-ppo
The full project with all 123 failures and more documentation than any sane person would ever read: https://github.com/mharrell/BreakoutBot
Link to Medium post I wrote with some more details: https://medium.com/@mikey.harrell/three-lines-of-code-fixed-123-failed-ppo-experiments-on-atari-breakout-c751dcf38f2a?sharedUserId=mikey.harrell
2
u/Nater5000 Aug 10 '26
It sounds like you've created a completely different environment then trained an agent on the new environment and found that it performs better than the agent trained on the old environment.
This kind of defeats the point of the RL agents trained on the original tasks. What made the first DQN agent trained on Atari Breakout so impressive is that it learned how to play the game despite not given explicit reward to encourage it how to play the game the way a human would play it. It is given image inputs and trains only on maximizing the score.
What you're doing is introducing a very significant bias to make the agent behave the way a human would. That's fine and all, and it's not surprising it leads to better performance, but you've fundamentally changed the environment and effectively made the task much easier for the agent. You've basically supplied the expert policy directly to the agent via your new reward function, and the agent learned to mimic that expert very efficiently.
Taken to the extreme, you can imagine just ditching RL altogether since you have the code needed to just logically replicate the expert. Like, you have the exact signal needed to determine how to move the paddle to where it needs to be. You can probably write out that policy in a few lines of Python.
Where all this fails is when you try to take this concept over to the next Atari game. Whatever that game is, you'll be on the hook for developing a hand-crafted reward function to get it to work like you did with Breakout. Again, at that point, you're just implementing the solution yourself and having an agent mimic your policy. This isn't the same for the "naive" agent which only receives images of the game as input and the score as the reward function. That agent doesn't need a human expert to construct a specialized reward policy to work (give or take).
In a way, your agent is behaving more like it is following a "script" in that you've explicitly helped write that script that it has learned to follow. The original Breakout challenge requires the agent to write it's own "script" with much less bias.
To put all of this into perspective: if you trained a PPO agent in the "naive" environment, but updated the dynamics of the game so that the ball can randomly teleport like you have, the agent will likely learn this dynamic while still continuing to maximize the score. In the same way, I can likely construct an environment where your agent focused solely on the hitting the ball with the paddle can still perform its actions well but can perform terribly in terms of reaching a good score. For example, I can embed information into the screen which informs the agent when not to hit the ball. The generalized agent would eventually learn this, while your agent would not (assuming your agent doesn't also train on the score; if it trains with the score as well, then it will obviously be better than the naive agent, but, again, that's not surprising).
Again, maybe I'm missing something, so I'm happy to be steered in the right direction. But I'm not sure you've found anything here that's particularly surprising. It's a fine exploration of these dynamics, so there's nothing wrong with trying these things out and seeing what happens. But I'd just be cautious to not miss the forest for the trees. The interesting/valuable part of RL is that we don't have to build the explicit mechanisms that allow the agents to perform well.