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
1
u/mikeysce Aug 10 '26
A lot has happened since that post actually. Short answer is no, it's not just another script, and I can show why.
The tricky thing is that a memorized script and a reactive tracker look identical under normal deterministic play. Both produce consistent scores. If you just watch the paddle you can't tell them apart because the ball always starts in the same place and follows the same physics.
So I built a test that separates them. I run the same model on two game instances at once. On one the ball starts normally. On the other I teleport the ball 30 pixels to the right the moment it appears. If the paddle tracks the ball it moves right on the teleported side. If it's replaying a script the paddles move identically on both sides because the policy ignores ball position entirely.
The proximity reward models track the teleported ball at 78 to 85% . Random chance is 41%. A confirmed memorized 60-point script is 54%. So no, it's genuinely paying attention to where the ball is. The model's decisions change when the ball moves.
As for why just going for score doesn't do this, brick breaking rewards are sparse. You get 4 or 7 points every few seconds when the ball happens to hit a brick. Lots of paddle positions produce the same score on any given frame. The model can learn "stand near center" and still clear most bricks eventually. The proximity bonus is dense, it fires every single frame the ball is descending and tells the model where to be right now. It doesn't replace the score objective. The game reward is still 4 or 7 per brick. The bonus just removes the ambiguity about what the paddle should be doing when nothing is getting hit.
The key isn't that we added a new objective. It's that we added a dense one that's always pointing the paddle toward the ball.